Rockies

Logic Level 3

Bob and Alice have in front of them a pile of 2018 rocks, and suggest to play a game.

The rules are as follows:

  • Alice goes first
  • Each player can take away 1, 3, or 4 rocks from the pile
  • The winner is the person who draws draws last (when there's no more rocks to draw for the next person).

Assuming each player plays optimally, who will win?

Alice will win if she take away 1 rock the first turn Alice will win if she takes away 4 rocks the first turn Alice will win if she takes away 3 rock the first turn Bob wins everytime Alice wins everytime

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Mark Hennings
Jun 2, 2018

Suppose that Alice is faced with a pile of N N stones, where N 0 , 2 ( m o d 7 ) N \equiv 0,2 \pmod{7} . The following table shows that, no matter what move Alice makes, Bob can make a responding move which ensures that Alice is faced with a pile of M M stones, where M 0 , 2 ( m o d 7 ) M \equiv 0,2 \pmod{7} again. N ? ( m o d 7 ) A l i c e B o b M ? ( m o d 7 ) 0 1 4 2 0 3 4 0 0 4 3 0 2 1 1 0 2 3 4 2 2 4 3 2 \begin{array}{cccc} N \equiv ? \pmod{7} & \mathrm{Alice} & \mathrm{Bob} & M \equiv ? \pmod{7} \\ \hline 0 & 1 & 4 & 2 \\ 0 & 3 & 4 & 0 \\ 0 & 4 & 3 & 0 \\ 2 & 1 & 1 & 0 \\ 2 & 3 & 4 &2 \\ 2 & 4 & 3 & 2 \end{array} In addition, if Alice is faced with a pile of N N stones, where N 0 , 2 ( m o d 7 ) N \equiv 0,2 \pmod{7} , then it is not possible for Alice to leave a multiple of 7 7 stones (so that it is impossible for Alice to take the last stone and win). Since any player can always remove a single stone, a stalemate is not possible. Since 2018 2 ( m o d 7 ) 2018 \equiv 2 \pmod{7} , we deduce that Bob must always win.

Alternatively, we can show that the Sprague-Grundy function for this game is G G , where G ( n ) = { 0 n 0 , 2 ( m o d 7 ) 1 n 1 , 3 ( m o d 7 ) 2 n 4 , 6 ( m o d 7 ) 3 n 5 ( m o d 7 ) G(n) \; = \; \left\{ \begin{array}{lll} 0 & \hspace{1cm} & n \equiv 0,2 \pmod{7} \\ 1 & & n \equiv 1,3 \pmod{7} \\ 2 && n \equiv 4,6 \pmod{7} \\ 3 && n \equiv 5 \pmod{7} \end{array} \right. and so the losing positions for Alice at those for which G ( n ) = 0 G(n) = 0 , namely those for which n 0 , 2 ( m o d 7 ) n \equiv 0,2 \pmod{7} .

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...