Knowledge in game

game theory notes 2

game theory notes 2

POKER GAME

Students playing Poker in Hostel. The players are composed of the Junior as well as Senior batch students. These events act as stress busters.

Variation in Nim Game

Nim is a famous game in which two players take turns removing items from distinct piles. During each turn, a player must remove one or more items from a single, non-empty pile. The winner of the game is whichever player removes the last item from the last non-empty pile. Now, For each non-empty pile, either player can remove zero items from that pile and have it count as their move; however, this move can only be performed once per pile by either player. Given the number of items in each pile, determine who will win the game; Player 1 or player 2. If player 1 starts the game and both plays optimally. Approach: Grundy number for each pile is calculated based on the number of stones.To compensate the zero move we will have to modify grundy values we used in standard nim game. If pile size is odd; grundy number is size+1 and if pile size is even; grundy number is size-1. We XOR all the grundy number values to check if final Grundy number(G) of game is non zero or not to decide who is winner of game. Explanation: Grundy number of a state is the smallest positive integer that cannot be reached in one valid move. So, we need to calculate mex value for each n, bottom up wise so that we can induce the grundy number for each n. where n is the pile size and valid move is the move that will lead the current player to winning state. Winning state: A tuple of values from where the current player will win the game no matter what opponent does. (If G!=0) Losing state: A tuple of values from where the current player will loose the game no matter what opponent does. (If G=0)

Find the winner in nim-game

Let’s start the solution step by step. We have total of three option for the XOR of array and this game. XOR of array is already 0: In this case Alice will unable to make a move and hence Alice is winner. XOR of array is not zero: Now, in this case we have two options, either size of array will be odd or even. CASE A: If the array size is odd then for sure Bob will win the game. CASE B: If the array size is even then Alice will win the game. Above conclusion can be proved with the help of mathematical induction. Let A[] = {1} i.e. size of array is odd and XOR of array is non-zero: In this case Alice can select element 1 and then A[] will become empty and hence XOR of array can be considered as zero. Resulting Bob as winner. Let size of array is even and XOR of array is non-zero. Now we can prove that Alice can always find an element to remove such that XOR of remaining elements of array will be non-zero. To prove this lets start from the contradiction i.e. suppose whatever element you should choose XOR of remaining array must be zero. So, let A1 Xor A2 Xor … An = X and n is even. As per our contradiction hypothesis, Ai Xor X = 0 for 1<= i <= n. Calculate XOR of all X Xor Ai (i.e. n equations), After taking XOR of all n equations we have X Xor X…Xor X (n-times) = 0 as N is even. Now, also we have A1 Xor A2 Xor.. An = 0 but we know A1 Xor A2…Xor = X. This means we have at least one element in even-size array such that after its removal XOR of remaining elements in non-zero. Let size of array is even and XOR of array is non-zero. Alice can not remove an element Ai such that xor of remaining number is zero, because that will make Bob win. Now, take the other case when the xor of remaining N?1 number is non-zero. As we know that N?1 is even and from the induction hypothesis, we can say that the position after the current move will be a winning position for Bob. Hence, it is a losing position for Alice.

GMAT HANDBOOK OFFICIAL FULL E-BOOK FOR PREPARATION

GMAT FULL BOOK. GMAT HANDBOOK OFFICIAL FULL E-BOOK FOR PREPARATION

Transforming era of Education

Nowadays, education is transforming at a high pace..This space contains about it...read out more