Re: 7 Card Hand Evaluators
[ QUOTE ]
[ QUOTE ]
Heres a better test for our evaluators:
[/ QUOTE ]
(For a constant pair of hole cards, evaluate all combos of one opponent and board). Why is this better? Also, while it won't make a significant difference, one might as well avoid unnecessary loop executions and conditions (untested modification):
<font class="small">Code:</font><hr /><pre>
holeCard1 = 0;
holeCard2 = 1;
for(opCard1 = holeCard2 + 1; opCard1 < 51; opCard1++)
{
cout<<".";
cout.flush();
for(opCard2 = opCard1 + 1; opCard2 < 52; opCard2++)
{
// Loop through all the deck cards > holecard2
for(c1 = holeCard2 + 1; c1 < 48; c1++)
{
if(c1 == opCard1 || c1 == opCard2)
continue;
for(c2 = c1 + 1; c2 < 49; c2++)
{
if(c2 == opCard1 || c2 == opCard2)
continue;
for(c3 = c2 + 1; c3 < 50; c3++)
{
if(c3 == opCard1 || c3 == opCard2)
continue;
for(c4 = c3 + 1; c4 < 51; c4++)
{
if(c4 == opCard1 || c4 == opCard2)
continue;
for(c5 = c4 + 1; c5 < 52; c5++)
{
if(c5 == opCard1 || c5 == opCard2)
continue;
// evaluate and tally here
}}}}}}}</pre><hr />
[/ QUOTE ]
I think the choice of
holeCard1 = 0;
holeCard2 = 1;
was unfortunate.
If it had been
holeCard1 = x;
holeCard2 = y;
where x and y are defines elsewhere then the loop collision checking is required.
even
holeCard1 = 1;
holeCard2 = 10;
would require loop checking.
|