A-> (3,4) is a winning configuration .
3 sticks | 4 sticks |
The first player will take 1 stick from of size 4 pile Now both pile will have three
3sticks | 3sticks |
The 2nd player can take any number of Sticks from any pile because , It is loosing situation same as (1,1) and (2,2)
if it takes 3 sticks ,1st player will take 3 sticks too and player 2 will loose
If it take 1 sticks , 1st will take 1 stick too and it will become (2,2) situation
same for taking 2 sticks it will become (1,1) situation.
There is another way of proving it.If xor of all piles is nonzero then it is winning condition
3 xor 4 is 7 (nonzero ) So it is winning condition
Answer - (b) -> there are 4 piles of 1,2,3,4 sticks
XOR of the is
1 xor 2 = 3
3 xor 3 = 0
0 xor 4 = 4(nonzero)
So it is also winning condition
Moves
1 | 2 | 3 | 4 |
1st player takes 4 sticks from last pile
1 | 2 | 3 |
2nd player take whatever he wants .Lets it takes 1 stick from 2nd pile
1 | 1 | 3 |
1st player takes last pile 3 sticks
1 | 1 |
Now its (1,1) condition for 2nd player ,He will loose and first player will win
If you have any doubt .Please feel free to ask thanks.
1. NIM game is a game with multiple piles of match sticks with the two players...
1. NIM game. This is a different version or easier version of NIM game Consider a pile of 5 matchsticks. Two people take turns removing 1 or 2 sticks each time from this pile. Suppose both players play smartly (nobody plays a fool move trying to let the opponent wins. But there is only one winner anyway) a)If the person getting the last stick wins, will the first player win? Why? Show the steps the first and second player will...
Developing an optimal strategy for a variant of the game Nim Nim is a subtraction game that is played with sticks. The subtraction game variant is simple. A pile of sticks is placed in front of a pair of participants. The players take turns removing either 1, 2, 3, or 4 sticks from the pile. The player who removes that last stick from the pile loses the game. It turns out that there is an optimal strategy for playing this...
Problem 4. (20 points) Pebbles Game. Two players play a game, starting with three piles of n pebbles each. Players alternate turns. On each turn, a player may do one of the following: take one pebble from any pile take two pebbles each from two different piles The player who takes the last pebble(s) wins the game. Write an algorithm that, given n, determines whether the first player can "force" a win. That is, can the first player choose moves...
Answer the following Nim game style questions. (Robert's Game) In this game, two players take turns removing stones from a pile that begins with n stones. The player who takes the last stone wins. A player removes either one stone or p stones, where p is a prime dividing the number of stones in the pile at the start of the turn For which n does the First Player have a winning strategy? A winning strategy for the First Player...
Your task in to design a game of Nim in Python. In this game “Two players take turns removing objects from distinct heaps or piles. On each turn, a player must remove at least one object, and may remove any number of objects provided they all come from the same heap/pile. The goal of the game is to avoid taking the last object.” (Wikipedia) In your implementation of the game, there will be 3 piles of objects. At the start...
Consider a variant of the Nim game called "Stones". Suppose that initially there is a single pile of 5 stones and two players, I and II. Each player takes turns picking up either 1 or 2 stones from the pile. Player I moves first, then Player II, then Player I, etc. until all stones have been picked up 3. Assuming that the loser is the player who picks up the last stone, write the game of Stones out in extensive...
Develop a game using Matlab. Work in groups of two. A Game of Sticks The rules are as follows: Players: 2 Sticks: 20 Players take turns sequentially to pick 1~3 sticks. Loser picks up the last stick! This project has the following deliverables: (1) Your project implements a 2-player version of the game of sticks in the command window. Required display in command window: ‘Welcome to the game!’ ‘Please enter player 1 name:’ ‘Please enter player 1 name:’ ‘Player 1...
Need Help with homework problem writing the game of nim in Python IDLE. Its a well known game with a number of variants. The following variant has an interesting winning strategy. Two players alternately take marbles from a pile. In each move, a player chooses how many marbles to take. The player must take at least one but at most half of the marbles. Then the other player takes a turn. The player who takes the last marble loses. Instructions...
The game of Nim: This is a well-known game with a number of variants. The following variant has an interesting winning strategy. Two players alternately take marbles from a pile. In each move, a player chooses how many marbles to take. The player must take at least one but at most half of the marbles. Then the other player takes a turn. The player who takes the last marble loses. Write a C program in which the computer plays against...