Article View: pl.comp.lang.delphi.bazy-danych
Article #82428Help rankung chess football
From: LuigiPaolo
Date: Sun, 30 Nov 2014 20:36
Date: Sun, 30 Nov 2014 20:36
117 lines
2969 bytes
2969 bytes
Sorry for my bad english the code mentioned below is part of an algorithm to generate the list of a chess tournament (a bit more complex than football). Everything is based on the SET of Delphi7 and ranking works perfectly only if the players do not exceed the number of 255. The problem is that the SET can not contain more than 255 items while a chess tournament can be up to 400-500 participants Therefore I'm forced to work with arrays. Some time ago I was suggested to use the functions Contains and Procedure SetBit and below, respectively, instead of the clause INCLUDE and IN of SET, the friend who sent me has and I have not tested despite many efforts have failed to solve the problem. This would replace the IN clause and INCLUDE functions suitable arrays. I would also like to know how do you empty an array, with the SET enough Set1 [] or Set2 [] Thanks for those who can help me by giving me even just a few ideas Voltolini Luigi Italy ? ///////// Suggested Functions type TMySet = array [0..63] of Byte; // 86 bytes = 512 bits Contains function (const S: TMyset; bit: integer): boolean; begin Result: = (S [bit div 8] and (1 shr (bit mod 8))) <> 0; end; procedure SetBit (var S: TMyset; bit: integer); begin S [bit div 8]: = S [bit div 8] or (1 shr (bit mod 8)); end; ////// ? Working code with the SET that replace with ARRAY .... ? ? ////// Set1, Set2: set of 1..255; ? Player with [ColumnA] do begin if (ColumnB in Set1) then begin Include (Set2, ColumnB) end; if not (ColumnB in Set1) then begin Include (Set1, ColumnB); end; .... Player with [ColumnB] do begin if (ColumnA in Set1) then begin Include (Set2, ColumnA) end; if not (ColumnA in Set1) then begin Include (Set1, ColumnA); end;
Technical Details
Message-ID:
<547b7fbb$0$44201$4fafbaef@reader2.news.tin.it>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed.pionier.net.pl!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!newsfeed.tele2net.at!news.panservice.it!feeder.news.tin.it!spool.news.tin.it!not-for-mailShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed.pionier.net.pl!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!newsfeed.tele2net.at!news.panservice.it!feeder.news.tin.it!spool.news.tin.it!not-for-mail Reply-To: "LuigiPaolo" <venus444@alice.it> From: "LuigiPaolo" <venus444@alice.it> Newsgroups: pl.comp.lang.delphi.bazy-danych Subject: Help rankung chess football Date: Sun, 30 Nov 2014 21:36:12 +0100 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Lines: 119 Message-ID: <547b7fbb$0$44201$4fafbaef@reader2.news.tin.it> Organization: TIN.IT (http://www.tin.it) X-Comments: Please send technical notifications to newsmaster@tin.it NNTP-Posting-Host: 79.51.97.125 X-Trace: 1417379771 reader2.news.tin.it 44201 79.51.97.125:2324 X-Complaints-To: Please send abuse reports to abuse@retail.telecomitalia.it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit