Re: 7 Card Hand Evaluators
Heres a better test for our evaluators:
holeCard1 = 0;
holeCard2 = 1;
for(opCard1 = 0; opCard1 < 52; opCard1++)
{
if(opCard1 == holeCard1 || opCard1 == holeCard2)
continue;
cout<<".";
cout.flush();
for(opCard2 = opCard1 + 1; opCard2 < 52; opCard2++)
{
if(opCard2 == holeCard1 || opCard2 == holeCard2)
continue;
// Loop through all the deck cards
for(c1 = 0; c1 < 52; c1++)
{
if(c1 == holeCard1 || c1 == holeCard2 || c1 == opCard1 || c1 == opCard2)
continue;
for(c2 = c1 + 1; c2 < 52; c2++)
{
if(c2 == holeCard1 || c2 == holeCard2 || c2 == opCard1 || c2 == opCard2)
continue;
for(c3 = c2 + 1; c3 < 52; c3++)
{
if(c3 == holeCard1 || c3 == holeCard2 || c3 == opCard1 || c3 == opCard2)
continue;
for(c4 = c3 + 1; c4 < 52; c4++)
{
if(c4 == holeCard1 || c4 == holeCard2 || c4 == opCard1 || c4 == opCard2)
continue;
for(c5 = c4 + 1; c5 < 52; c5++)
{
if(c5 == holeCard1 || c5 == holeCard2 || c5 == opCard1 || c5 == opCard2)
continue;
WORK OUT OUR HANDS STRENGTH (holeCard1, holeCard2, C1...C5)
WORK OUT OPPONENTS HANDS STRENGTH (opCard1, opCard2, C1...C5)
// Increment totals counters
if(ourHandStrength < oppHandStrength)
totalWins++;
else if (ourHandStrength > oppHandStrength)
totalLosses++;
else
totalDraws++;
}}}}}}}
cout<<endl<<endl<<"Wins : "<<totalWins<<" ("<<((float)totalWins/2097572400)*100<<"%)"<<endl;
cout<<"Draws : "<<totalDraws<<" ("<<((float)totalDraws/2097572400)*100<<"%)"<<endl;
cout<<"Losses : "<<totalLosses<<" ("<<((float)totalLosses/2097572400)*100<<"%)"<<endl<<end l;
cout<<"Total Combinations : "<<totalWins + totalDraws + totalLosses<<endl;
cout<<"Time MS : "<<(endTime-startTime)<<endl;
cout<<"Time Secs : "<<(endTime-startTime)/1000<<endl;
cout<<"Time Mins : "<<((endTime-startTime)/1000)/60<<endl;
cout<<"Iters per second : "<<(2097572400/(endTime-startTime))*1000<<endl<<endl;
My evaluator can run through the 2.1 billion games in 2 minutes. Pretty fast in my opinion, but from the numbers other people are getting im sure it can be beaten flat on it's face!
|