Sort 37 Discussions, By:
Please Login in order to post a comment
Same as regular game of Nim!
Some insight: being able to add to the pile makes no difference to a regular game of nim. If Player A has a winning position in the game of nim, Player A may keep playing optimally as they would play a regular nim game. If, however, Player B decides to add k items to a pile, putting Player A in a losing position, Player A may add the same number, k, items to the same pile, reclaiming thier winning position. Or, even better, Player A may simply remove the items added by Player B.
def pokerNim(k, c):
for i in c:
Given the list of Nim heaps, will player 1 or player 2 win?
I hope that helps!
Here's my math behind the problem. I am not able to understand why is it wrong.
A is first. B is second.
Initially let say the total no. of chips to be T. If T is even After a full move(i.e. A and B both move provided game has not ended) the total no. of chips would still remain even. And same reasoning goes for the odd case.
Now if addition was not allowed T would have determined who is winner. If T were odd A would else B would.
Now even though addition is allowed but after a move the total no. of elements stay in same state. i.e. if T = even, then after each move the total chips would still be even. and vice versa. Hence win is also decided by the same as above. So even though addition is allowed still the factor of 'k'(the total no. of addition available for each pile) is not doing anything to the problem.
So where is the factor k playing role here ? what was the need of i piles when all of this is can be done using single pile ? And where is my math going wrong ??? Have I not understood the Q correctly ?
Heres how I understood the Q.-
There are 2 players A and B. There are i piles. In each pile eachof the players can add maximum of k tokens. They can add even though the ith pile is finished. Now both are playing selfishly. Who will win if A starts