Puzzles where both players play optimally

  • Thread starter Thread starter Avichal
  • Start date Start date
AI Thread Summary
In the discussed game between Alice and Bob, the outcome depends on whether the starting number N is even or odd. If N is even, Alice can always win by subtracting 1 to force Bob into an odd number, which leads to his eventual loss. Conversely, if N is odd, Bob will win as he can maintain the advantage by forcing Alice into an even number. The analysis reveals that optimal play results in a predictable winner based on the parity of the starting number. Understanding these strategies is crucial for solving similar puzzles effectively.
Avichal
Messages
294
Reaction score
0
Puzzles like the following(they are actually programming questions) :-
codechef said:
Alice and Bob play the following game. They choose a number N to play with. The rules are as follows :
1) Alice plays first, and the two players alternate.
2) In his/her turn, a player can subtract from N any proper divisor (not equal to N) of N. The number thus obtained is the new N.
3) The person who cannot make a move in his/her turn loses the game.
Assuming both play optimally, who wins the game ?

codechef said:
Alice and Bob play the following game : There are N piles of stones with Si stones in the ith pile. Piles are numbered from 1 to N. Alice and Bob play alternately, with Alice starting. In a turn, the player chooses any pile i which has at least i stones in it, and removes exactly i stones from it. The game ends when there is no such pile. The player who plays last wins the game. Assuming Alice and Bob play optimally, who will win the game?

How do you solve such puzzles?
Since they say that both play optimally does that mean given the conditions in the game(here let's say number N is given) we already know who will be the winner?
 
Physics news on Phys.org
Playing optimally means that both players will have insight into all possible next moves and will play in such a way to maximize their chance of winning without making a mistake. However, if all moves lead to the other player winning, then this player still has to play, and any move would be equivalent.

In the first puzzle, a player loses when their number is 1. This means that the player at 2 can force their opponent to lose by subtracting 1, and a player at 3 will lose since they can only subtract 1. Similarly, a player at 4 can win by subtracting 1, and a player at 5 will lose.

Note that all odd numbers only have odd factors, so a player at an odd number can only get to an even number since he or she can only subtract an odd number from odd. A player at an even number can then subtract 1 to force the opponent to get to an odd number.

Thus if the game begins on an even number, Alice wins. If the game begins on an odd number, Bob wins.
 
Just ONCE, I wanted to see a post titled Status Update that was not a blatant, annoying spam post by a new member. So here it is. Today was a good day here in Northern Wisconsin. Fall colors are here, no mosquitos, no deer flies, and mild temperature, so my morning run was unusually nice. Only two meetings today, and both went well. The deer that was road killed just down the road two weeks ago is now fully decomposed, so no more smell. Somebody has a spike buck skull for their...
Thread 'RIP George F. Smoot III (1945-2025)'
https://en.wikipedia.org/wiki/George_Smoot https://physics.berkeley.edu/people/faculty/george-smoot-iii https://apc.u-paris.fr/fr/memory-george-fitzgerald-smoot-iii https://elements.lbl.gov/news/honoring-the-legacy-of-george-smoot/ https://www.nobelprize.org/prizes/physics/2006/smoot/facts/ https://www.aps.org/publications/apsnews/200611/nobel.cfm https://inspirehep.net/authors/988263 Structure in the COBE Differential Microwave Radiometer First-Year Maps (Astrophysical Journal...

Similar threads

Back
Top