[ QUOTE ]
[ QUOTE ]
Please could you all run this test on your hand evaluators and let me know the results:
int c1, c2, c3, c4, c5, c6, c7;
int handSetCounters[8] = {0,0,0,0,0,0,0,0};
for(c1 = 0; c1 < 52; c1++) {
for(c2 = c1 + 1; c2 < 52; c2++) {
for(c3 = c2 + 1; c3 < 52; c3++) {
for(c4 = c3 + 1; c4 < 52; c4++) {
for(c5 = c4 + 1; c5 < 52; c5++) {
for(c6 = c5 + 1; c6 < 52; c6++) {
for(c7 = c6 + 1; c7 < 52; c7++) {
CALCULATE RANK
CALCULATE SET ID (HIGH CARD TO STRAIGHT FLUSH)
INCREMENT HANDSETCOUNTERS[SET ID]
}}}}}}}
PRINT HANDSETCOUNTERS
If you could time the speed of your code in that scenario it would be most interesting! Also with a copy of your results (number of flushes etc incase your code is not designed to be 100% accurate).
Thanks for anyone that participates!
Tom
[/ QUOTE ]
<font class="small">Code:</font><hr /><pre>133784560 hands
2.640 secs
50675964 hands/sec
hc 23294460
pr 58627800
tp 31433400
th 6461620
st 6180020
fl 4047644
fh 3473184
fr 224848
sf 41584
using
procedure TForm1.Button2Click(Sender: TObject);
var
Totals : array[0..9] of integer;
c1, c2, c3, c4, c5, c6, c7 : integer;
Count : integer;
Start, Stop : TDateTime;
secs : double;
Score : integer;
begin
Start := Now;
Fillchar(Totals,sizeof(Totals),0);
Count := 0;
for c1 := 0 to 45 do
for c2 := c1+1 to 46 do
for c3 := c2+1 to 47 do
for c4 := c3+1 to 48 do
for c5 := c4+1 to 49 do
for c6 := c5+1 to 50 do
for c7 := c6+1 to 51 do
begin
inc(Totals[Table[Table[Table[Table[Table[Table[Table[c1+52]+c2]+c3]+c4]+c5]+c6]+c7] shr 20]);
inc(Count);
end;
Stop := Now;
secs := (Stop-Start)*86400.0;
memo1.lines.add(format('%d hands',[Count]));
memo1.lines.add(format('%5.3f secs',[secs]));
memo1.lines.add(format('%d hands/sec',[trunc(Count/secs)]));
memo1.lines.add(format('hc %d',[Totals[1]]));
memo1.lines.add(format('pr %d',[Totals[2]]));
memo1.lines.add(format('tp %d',[Totals[3]]));
memo1.lines.add(format('th %d',[Totals[4]]));
memo1.lines.add(format('st %d',[Totals[5]]));
memo1.lines.add(format('fl %d',[Totals[6]]));
memo1.lines.add(format('fh %d',[Totals[7]]));
memo1.lines.add(format('fr %d',[Totals[8]]));
memo1.lines.add(format('sf %d',[Totals[9]]));
end;
and
133784560 hands
1.188 secs
112613302 hands/sec
hc 23294460
pr 58627800
tp 31433400
th 6461620
st 6180020
fl 4047644
fh 3473184
fr 224848
sf 41584
using
procedure TForm1.Button1Click(Sender: TObject);
var
Totals : array[0..9] of integer;
c1, c2, c3, c4, c5, c6, c7 : integer;
u1, u2, u3, u4, u5, u6, u7 : integer;
Count : integer;
Start, Stop : TDateTime;
secs : double;
Score : integer;
begin
Start := Now;
Fillchar(Totals,sizeof(Totals),0);
Count := 0;
for c1 := 0 to 45 do
begin
U1 := Table[52+c1];
for c2 := c1+1 to 46 do
begin
U2 := Table[U1+c2];
for c3 := c2+1 to 47 do
begin
U3 := Table[U2+c3];
for c4 := c3+1 to 48 do
begin
U4 := Table[U3+c4];
for c5 := c4+1 to 49 do
begin
U5 := Table[U4+c5];
for c6 := c5+1 to 50 do
begin
U6 := Table[U5+c6];
for c7 := c6+1 to 51 do
begin
inc(Totals[Table[U6+c7] shr 20]);
inc(Count);
end;
end;
end;
end;
end;
end;
end;
Stop := Now;
secs := (Stop-Start)*86400.0;
memo1.lines.add(format('%d hands',[Count]));
memo1.lines.add(format('%5.3f secs',[secs]));
memo1.lines.add(format('%d hands/sec',[trunc(Count/secs)]));
memo1.lines.add(format('hc %d',[Totals[1]]));
memo1.lines.add(format('pr %d',[Totals[2]]));
memo1.lines.add(format('tp %d',[Totals[3]]));
memo1.lines.add(format('th %d',[Totals[4]]));
memo1.lines.add(format('st %d',[Totals[5]]));
memo1.lines.add(format('fl %d',[Totals[6]]));
memo1.lines.add(format('fh %d',[Totals[7]]));
memo1.lines.add(format('fr %d',[Totals[8]]));
memo1.lines.add(format('sf %d',[Totals[9]]));
end;
</pre><hr />
This was on an AMD 3000+ with 1 gig memory running Win2k
This computer produced
133784560 hands
5.156 secs
25947355 hands/sec
hc 23294460
pr 58627800
tp 31433400
th 6461620
st 6180020
fl 4047644
fh 3473184
fr 224848
sf 41584
using Andrzej Nironen's "Hand Evaluator Speed Demo"
[/ QUOTE ]
Very impressive! (I think you have the results mixed up though - 112.5mil when doing extra work of incrementing the hand type counts, 50mil when not... [img]/images/graemlins/smile.gif[/img] )
Have you considered posting this method on the
pokersource yahoo group?
Juk [img]/images/graemlins/smile.gif[/img]
EDIT: Sorry, I just noticed you print the hand type counts in both procedures... BTW: How fast does it run without doing this (ie: just assigning an integer the hand evaluation rather than incrementing totals[]?)