Two Plus Two Publishing LLC Two Plus Two Publishing LLC
 

Go Back   Two Plus Two Poker Forums > >

Notices

Programming Discussions about computer programming

Reply
 
Thread Tools Display Modes
Old 08-23-2017, 01:07 PM   #1
onionsareyummy
stranger
 
Join Date: Aug 2017
Posts: 1
Twoplustwo Evaluator Question

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.
onionsareyummy is offline   Reply With Quote
Old 08-26-2017, 07:23 AM   #2
au4all
veteran
 
Join Date: Apr 2011
Posts: 2,824
Re: Twoplustwo Evaluator Question

Quote:
Originally Posted by onionsareyummy View Post
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, https://forumserver.twoplustwo.com/45...97/index9.html
au4all is offline   Reply With Quote
Old 08-28-2017, 09:06 PM   #3
just_grindin
Pooh-Bah
 
Join Date: Dec 2007
Posts: 4,342
Re: Twoplustwo Evaluator Question

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).
just_grindin is offline   Reply With Quote

Reply
      

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Forum Jump


All times are GMT -4. The time now is 03:26 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © 2008-2017, Two Plus Two Interactive
 
 
Poker Players - Streaming Live Online