PDA

View Full Version : Quick math question


hummusx
04-30-2005, 10:38 PM
I'm trying to finish up a new hand converter (since the old one is broken and there's no indication it'll be fixed soon). My brain is a little fried so I need this bit of math solved for me: if you know your seat number, and you know what number the button is, what's the formula to get my position for this hand? I know it's got to be simple, but for some reason it's all just fuzzy tonight.

Nottom
04-30-2005, 10:49 PM
well its not super easy since its a function of how many players are left and where they are sitting.

BradleyT
04-30-2005, 10:51 PM
You have to parse the text after the words "dealt to" and replace that with the word HERO.

BradleyT
04-30-2005, 10:53 PM
To get position, put each seat into an array list. Look for the text seat X is the button and use that for your 0 index.

Better brush up on your regular expressions /images/graemlins/smile.gif

hummusx
04-30-2005, 10:58 PM
Yeah, I can go through an number them. Yes I can parse out the data. But I really think there should be a calculation that'll just let me get one of the positions directly. Modulus will do the 'around the corner' math. It should work. I want to solve it in a single line.

I'm looking for the elegant way, not the easiest way.

hummusx
04-30-2005, 11:02 PM
[ QUOTE ]
Better brush up on your regular expressions /images/graemlins/smile.gif

[/ QUOTE ]

I'm actually pretty handly with regular expressions. I've done a few screen scraping applications in the past so I've had a lot of practice. All of the hand reading stuff is done, I'm just trying to format it for output.

hummusx
05-01-2005, 12:00 PM
*bump*

Someone...

hummusx
05-01-2005, 12:10 PM
Ok I knew it was just a fuzzy head at night thing. The formula for figuring out your position is:

(Seat number - button seat number - 2) modulus (player count)

hummusx
05-01-2005, 12:30 PM
Oh yeah, you need to get an absolute value before you mod it. Some modulus operators automatically do this (I've always thought of the modulus as being a non-negative value), but in some cases you have to do it yourself.

Now I have another question. In what order to positions get named? In other words, if you have 4 people left, is it UTG, Button, SB, and BB? What about 5, 7, 9? Need help on this please.

Nottom
05-01-2005, 12:40 PM
[ QUOTE ]
Oh yeah, you need to get an absolute value before you mod it. Some modulus operators automatically do this (I've always thought of the modulus as being a non-negative value), but in some cases you have to do it yourself.

[/ QUOTE ]

the mod operator should never return a negative value. not saying they don'e but they shouldn't.

I really think you are probably better off just assigning the seats manually, because none of it really works otherwise unless the players are sitting in consecutive seats.

My thoughts would be to start at the button. And go backwards from there.

i.e. if the button is seat 6. Then assign that player the button. Then assign the BB and count back to find the SB if there is one. Then count backwards from the button assigning any unassigned players a seat in backwards order ... CO, MP3, MP2, ..., UTG

Of course there is probably an easier way.

hummusx
05-01-2005, 01:18 PM
I still have the same problem, even given your suggestion. If there's only 6 people, do I have UTG, MP, CO, Button, SB, BB or UTG, UTG+1, CO, Button, SB, BB or UTG, CO+1, CO, BUtton, SB, BB? What's the progression for each size?

Nottom
05-01-2005, 01:26 PM
Thats upto you i guess. I think its easiest just to start form the back so with 5 people you would have LMP (hi-jack!), CO, Button, SB, BB.

This might not be what you want though and only you can really decide that. If thats the case then you would need to come up with a naming scheme based on how many players are in the pot.