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.
 
Similar to the 2024 thread, here I start the 2025 thread. As always it is getting increasingly difficult to predict, so I will make a list based on other article predictions. You can also leave your prediction here. Here are the predictions of 2024 that did not make it: Peter Shor, David Deutsch and all the rest of the quantum computing community (various sources) Pablo Jarrillo Herrero, Allan McDonald and Rafi Bistritzer for magic angle in twisted graphene (various sources) Christoph...
Thread 'My experience as a hostage'
I believe it was the summer of 2001 that I made a trip to Peru for my work. I was a private contractor doing automation engineering and programming for various companies, including Frito Lay. Frito had purchased a snack food plant near Lima, Peru, and sent me down to oversee the upgrades to the systems and the startup. Peru was still suffering the ills of a recent civil war and I knew it was dicey, but the money was too good to pass up. It was a long trip to Lima; about 14 hours of airtime...

Similar threads

Back
Top