Chopsticks (hand game)
Chopsticks is a hand game for two or more players, in which players extend a number of fingers from each hand and transfer those scores by taking turns to tap one hand against another. Chopsticks is an example of a combinatorial game, and is solved in the sense that with perfect play, an optimal strategy from any point is known. Rules. This official set of rules is called "rollover" where five fingers are subtracted should a hand's sum exceeds 5 as described below. Abbreviation. A chopsticks position can be easily abbreviated to a four-digit code  [ABCD]. A and B are the hands (in ascending order of fingers) of the player who is about to take their turn. C and D are the hands (in ascending order of fingers) of the player who is not about to take their turn. It is important to notate each player's hands in ascending order, so that a single distinct position isn't accidentally represented by two codes. For example, the code  is not allowed, and should be notated . Therefore, the starting position is . The next position must be . The next position must be either   or . Treating each position as a 4-digit number, the smallest position is 0000, and the largest position is 4444. This abbreviation formula expands easily to games with more players. A three-player game can be represented by six-digits (e.g. ), where each pair of adjacent digits represents a single player, and each pair is ordered based on when players will take their turns. The leftmost pair represents the hands of the player about to take his turn; the middle pair represents the player who will go next, and so on. The rightmost pair represents the player  who must wait the longest before his turn (usually because he just went). Moves. Under normal rules, there are a maximum of 14 possible moves: However, only 5 or less of these are available on a given turn. For example, the early position 1312 can go to 2213, 1313, 2413, 0113, or 1222. Game lengths. The shortest possible game is 5 moves. There is one instance: The longest possible game that gets farther from the starting point with each move is 9 moves. There are two instances: The longest possible game with revisitation is indefinite. Positions. Since the roll-over  amount is 5, chopsticks is a base-5 game. Each position is four digits long. Counting from 0000 to 4444 (in base-5) gives us 625 positions. However, most of these positions are incorrect notations (e.g. 0132, 1023, and 1032). They appear different but are functionally the same in gameplay. To find the number of functionally distinct positions, we simply square the number of functionally distinct pairs. There are 15 distinct pairs (00, 01, 02, 03, 04, 11, 12, 13, 14, 22, 23, 24, 33, 34, and 44). Since either player could have any of these pairs, we simply multiply 15*15 , which gives us 225 functionally distinct positions. There are 21 unreachable positions: 0000, 0100, 0200, 0300, 0400, 1100, 1101, 1200, 1300, 1400, 2200, 2202, 2300, 2400, 3300, 3303, 3400, 3444, 4400, 4404, and 4444. There are 14 reachable endgames: 0001, 0002, 0003, 0004, 0011, 0012, 0013, 0014, 0022, 0023, 0024, 0033, 0034, 0044. Satisfyingly enough, these are all the 14 possible endgames; in other words, someone can win using any of the 14 distinct live pairs. Out of these 14 endgames, the first player wins 8 of them, assuming that the games are ended in the minimum amount of moves . Optimal strategy. Using the rules above, two perfect players will play indefinitely; the game will continue in a loop. In fact, even very inexperienced players can avoid losing by simply looking one move ahead. In the cutoff variation, the first player can force a win. One winning strategy is to always reach one of the following configurations after each move, preferentially choosing the first one in the list if there is more than one choice. Conversely, in the Division and Suicide only variation, then the second player has a winning strategy. Generalisations. Chopsticks can be generalized into a (p,r)-type  game, where "p" is the number of players and "r" is the roll-over amount. Less than two players. A game with one player trivially wins the game for virtue of being the last player in the game. A game with zero players is likewise trivial for there are no players in the game and thus no winners. Two players. Given a roll-over of formula_2, Since the roll-over amount is formula_2, chopsticks is a base-formula_2 game. Each position is formula_11 digits long. Enumerating all numbers in base-formula_2 with formula_11 digits gives us formula_5 positions. However, most  of these positions are incorrect notations (e.g. 1002, 0120, and 1020). They appear different but are functionally the same in gameplay. To find the number of functionally distinct positions, we square the number of functionally distinct pairs. For a roll-over of formula_2, there are formula_16 distinct pairs, where formula_16 is the formula_2-th triangular number. Since either player could have any of these pairs, we simply square the resulting value, which gives us formula_6 functionally distinct positions. There are formula_20 unreachable positions for formula_7. More than two players. Given a roll-over of 5. Degenerate cases. A game with  a roll-over amount of 1 is the trivial game, because all hands are dead at start as values of one become values of zero. A game with a roll-over amount of 2 is degenerate, because splitting is impossible and the roll-over and cutoff variations result in the same game. Hands are either 'alive' and 'dead', and attacking a hand kills the hand. In fact, one could simply keep count of the number of 'hands' a player has (by using fingers or some other method of counting), and when a player attacks an opponent, the number of hands  that opponent has decreases by one. There are a total of formula_39 reachable positions in the game, and a game length of formula_40. The two player game is strongly solved as a first person win. When two players have only one hand, the game becomes degenerate, because splits cannot occur and each player only has one move. Given a roll-over of formula_2 each position after formula_25 moves in the game can be represented by the tuple formula_43, where formula_44 is the formula_25-th Fibonacci number with formula_46 and formula_47. The number of positions is given by least positive  number formula_25 such that formula_2 divides formula_50. This variant is strongly solved as a win for either side depending upon formula_2 and the divisibility properties of Fibonacci numbers. The length of the game is formula_52.