Open Side Menu Go to the Top
Register
Twoplustwo Evaluator Question Twoplustwo Evaluator Question

08-23-2017 , 01:07 PM
I am going through the source code of the 2+2 evaluator and trying to make sense of it but having a hard time. Specifically, this is the build I am looking at: https://github.com/tangentforks/TwoP...rate_table.cpp

The way I understand it, for the first pass, the for loop generates every possible combination of cards adjusting for relevant suits.

However for the second pass, I do not understand the logic used to index the HR array. The saveID function should return the index of the card combo within the ID array. Why is he then multiplying by 53, and adding 53? And then why is the maxHR computed as IDnum*53 + card + 53, and why is that being used as the index? Hopefully someone can shed some light on these questions.
Twoplustwo Evaluator Question Quote
08-26-2017 , 07:23 AM
Quote:
Originally Posted by onionsareyummy
I am going through the source code of the 2+2 evaluator and trying to make sense of it but having a hard time. Specifically, this is the build I am looking at: https://github.com/tangentforks/TwoP...rate_table.cpp

The way I understand it, for the first pass, the for loop generates every possible combination of cards adjusting for relevant suits.

However for the second pass, I do not understand the logic used to index the HR array. The saveID function should return the index of the card combo within the ID array. Why is he then multiplying by 53, and adding 53? And then why is the maxHR computed as IDnum*53 + card + 53, and why is that being used as the index? Hopefully someone can shed some light on these questions.
Have you read the threads about the code, such as, http://forumserver.twoplustwo.com/45...97/index9.html
Twoplustwo Evaluator Question Quote
08-28-2017 , 09:06 PM
I am fairly certain the answer is that he's calculating the index of the hand ranking array.

For an explanation of why you would index an array this way (see arrays):

https://www.interviewcake.com/articl...erviews#arrays

Also see the section on pointers as he mentions pointers in the comments on that particular section but HR was of type int and not int* (array of pointers to integers if I have my syntax correct).
Twoplustwo Evaluator Question Quote

      
m