Urinal Chess

Urinal Chess

Rules: Two players take turns occupying urinals with an endless supply of men who have to pee. You can only occupy one urinal per turn, and if you can you must (everyone has to pee). You may not occupy any urinal adjacent to an occupied urinal (bathroom etiquette, that would be weird). Click a urinal to fill it. Complete your turn by clicking PC move. You win by filling the last available urinal. You move first, or PC moves first if you click PC move.

 

Credit for underlying game design goes to discussions with Tristan Williams. I suggest understanding Nim first. This is a learning project, so please let me know if you have suggestions for improvements. All remaining errors are my own.

Game theoretic explanation This is a take and break style game, see Tom Ferguson's notes section 4 for a detailed explanation. The general idea behind these games is that they can be turned into variants of Nim! You have 4 options for moves: take 1 (only available if the pile is size 1), take 2, take 3, or take 3 and split the pile into two new piles. Without going into detail, by the Sprague-Grundy theorem there is some function g that maps each pile into a natural number. \( g(X_1)\oplus...\oplus g(X_n) =0 \) will be a p-position!
Bonus questions:
Can you find all of the pee, I mean p, positions for the above game? The complete list is: 4, 8, (3,3) (2,2) (1,1) (1,2)
Who wins a game with 3 seperate strings of 7,8, and 9 urinals? If player 1, what's the winning move? Take 2 from 9! This leaves two piles of 7 and a pile of 8. It turns out that 8 is a p-position, and the two 7's will cancel out. \( g(7) \oplus g(7) \oplus g(8) =0 \).
Who wins if you are at a concert with 101 adjacent urinals? It turns out all odds are N positions. So taking urinal 51 to make two strings of 49 will be a winner.
Can you find a general pattern in the Sprague-Grundy function? Let me know: ben.d.pyle at gmail