I am stuck in this problem and cannot really understand my textbook.
Two players take turns to play the following game. A basket contains 5 apples, 6 oranges, and 9 pears. At each turn the players are allowed to take 1, 2 or 3 fruits of same kind. The winner takes the last fruit.
(a) Find the value of the Grundy function at the initial position.
(b) What is a first winning move?
What I have been trying,
Binary Grundy Value
A: | | | | | 5 0101 1
O: | | | | | | 6 0110 2
P: | | | | | | | | | 9 + 1001 + 1
1010 = 10 2
I calculated Grundy Value as 2(which I used XOR). So is 2 correct for problem (a)?
For problem(b), since Grundy Value is 2, first winning move is take 2 from any fruits. (?)