Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine Poker Table Positions - Sit'n Go Tournaments

Note: I do the javascript code according to the ajrwhite answer. Hope it helps someone.

Link: http://codepen.io/eMineiro/pen/EKrNBe

Open codepen console to see the examples working.

In poker we define player position according to the dealer. Like this:

enter image description here

Blue: Small Blind and Big Blind positions

Green: Late and Dealer/Late positions

Yellow: Middle positions

Pink: Early positions

So, assuming these two arrays:

players:[1,2,3,4,5,6,7,8,9,10];
positions:["bb","sb","btn","late","medium","medium","medium","early","early","early"];

In this case, "player1" is the "Big Blind", "player2" is the "Small Blind", "player3" is the "button".....

I want to sort players array, when changePositions(dealer) is called. Example:

changePosition(10); //means that "player10" now is the new Dealer

And the result should be:

players:[2,1,10,9,8,7,6,5,4,3];
positions:["bb","sb","btn","late","medium","medium","medium","early","early","early"];

During the game, players could be eliminated. So I have a function to exclude "last position" in "positions array" and exclude the player. Then I need to call changePosition(X) again, where X is the next non-eliminated player on the left of "player10" (actual dealer).

Example for eliminated "player 1", new arrays should be:

players:[2,10,9,8,7,6,5,4,3];
positions:["bb","sb","btn","late","medium","medium","medium","early","early"];

And I need to call changePosition(X) again, to determine new positions, in this case X=2, because "player2" is on the left of the actual dealer "player10"

changePosition(2);

And should result:

players:[4,3,2,10,9,8,7,6,5];
positions:["bb","sb","btn","late","medium","medium","medium","early","early"];

How can I find the new dealer when player is eliminated?

Note: I created a function named changeNextDealer(). Negative index was not the problem, because the next dealer is clockwise. It's in the code pen link.

dealerArrayPosition-1; //But if bigBlind and smallBlind was eliminated simultaneously I get a negative position.

How can I map a negative index like -1, to the last position. Or -2 to the LastPosition-1? Is there a quickly way?

Note: This question is still no answered, but is not the main question of this discussion. I think a will ask in a separated post.

How should I do the changePosition(dealer) function?

I have tried so much, but can't figure out how to do that.

Note: I created a function named changePosition(). It's in the codepen link.

like image 210
Eduardo Arruda Pimentel Avatar asked May 07 '16 17:05

Eduardo Arruda Pimentel


People also ask

How do you know what position you are in poker?

A player "has position" on opponents acting before him and is "out of position" to opponents acting after him. Because players act in clockwise order, a player "has position" on opponents seated to his right, except when the opponent has the button and certain cases in the first betting round of games with blinds.

Where should I sit at a poker table?

Assuming the table as a whole is acceptable, you ideally want the seat to the left of the tricky, loose, and aggressive players. You want the advantage of seeing how they will act before you decide to enter the pot, and before you decide how you will play your hand.

How do sit and go tournaments work?

A Sit & Go is a type of tournament with no set starting time. Instead, each Sit & Go has a predetermined number of entrants. Once this number is reached and all the spots in the tournament are filled, the tournament begins immediately.


1 Answers

Let's assume the players are always numbered 1-10. We don't need two data structures to store the player positions and statuses. We only need one indexed data structure to store player state:

State 1

positions:["btn","sb","bb","early","early","early","medium","medium","medium","late"];

State 2

positions: ["late","btn","sb","bb","early","early","early","medium","medium","medium"]

State 3

positions: ["eliminated","late","btn","sb","bb","early","early","early","medium","medium"];

This stores the same amount of information as your two arrays, and is more consistent. You simply access positions[0] to see what player 1's state is or positions[9] for player 10.

Now with this more consistent structure, it should be easier to handle status changes at the end of each round.

Eliminating players

After each round, change an eliminated player's status to "eliminated". You may need to have a temporary array at this point so that you can check what has happened in the previous round will still updating information for the next round.

How to treat the array as a circle

Move the dealer chip "btn" to (currentPositionOfBtn+1)%10 - this means the Button moves from 1 to 2 to 3, etc., but by using the remainder operator and the total number of players, we ensure that the move from position 9 (Player 10) cycles back round to 0 (Player 1).

If the player in currentPositionOfBtn+1)%10 has been eliminated, then check currentPositionOfBtn+2)%10 and so on - this is an easy loop to implement.

Recalculating the positions

Now given that the description of the positions changes as players are eliminated (by the end you have no "early" or "medium"), I would suggest recalculating the positions from the Dealer onwards at the end of each round, skipping over any players who are marked as "eliminated".

like image 59
ajrwhite Avatar answered Oct 23 '22 16:10

ajrwhite