Блог пользователя XGptw

Автор XGptw, история, 8 лет назад, По-английски

hey , i have a doubt regarding misere nim games .. to find the condition for losing position .. i have an approach which is giving me a wrong answer it s like this assign grundy number for each individual pile of size k and it will be k-1 since in our case a pile of size 1 is our terminal position (so for 1 grundy(1)=0 remaining elements grundy(k)=k-1 by ) so if the xorsum of all grundy numbers is 0 then it is a losing position else it is a winning position( according to some sprague grundy theorem i understood only some part of it ) .. but this approach is giving me wrong answer and i have searched over the internet and found some other approach it's like count no of one s and do something.......to get answer .. I want to know why my approach is wrong ....Is it okay to think about misere him games as normal nim games with the terminal position changed...or can't we apply sprage grundy theorem for misere games ?? link to the question :http://www.spoj.com/problems/MMMGAME/

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
8 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

No, your approach is not correct. Here's an easy counter-example: If you have one pile of size 1, you would have the grundy-number grundy(1)=0, which is correct (you loose). But if you have two piles of size 1, than you would have the grundy-number grundy(1) xor grundy(1) = 0 xor 0 = 0, which is wrong (since you will win this game).

I'm currently not really sure, what the best way to solve a misère game is, but take a look at this question: Nimbers for misère games Especially the linked paper seems to answer exactly, how to apply Sprage-Grundy to misère games.

  • »
    »
    8 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    thanks

  • »
    »
    8 лет назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    As a follow up: You can define misère grundy numbers to a game quite easily, but there is no nice operation that allows combining two misère games.

    With normal (not misère ) games, you can simply xor the grundy numbers and end up with the grundy number of the combined game. But this doesn't work with misère games.

    So basically there doesn't exist a nice strategy to solve misère games.

    This is also the reason, why misère games come up so rarely in coding contests. I've only seen it twice (the task you posted, and one task of a recent game theory contest on Hackerrank), and both asked about the misère version of regular nim. You can find the solution to it and a proof of correctness here.

    • »
      »
      »
      8 лет назад, # ^ |
      Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

      hey just asking out of curiosity in the last code forces contest div2 b (spiderman) there was a question which seemed like a game theory question but it can be solved by normal logic i want to know if we can solve it using the sprague grundy theorem define what the sub games are and the grundy number for each sub game and can we show that if xor sum is zero then only it is a losing position ?

      • »
        »
        »
        »
        8 лет назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        Yes, you can. I define a game as only one chain. Lets start computing the grundy numbers:

        grundy(1) = 0 (only one vertex, you loose)

        grundy(2): the only move possible is to make 2 cycles with each 1 vertex. Playing a game with two single positions gives: grundy(1) xor grundy(1) = 0 xor 0 = 0. Therefore grundy(2) = mex({0}) = 1.

        grundy(3): one possibility, one chain with 1 vertex, and one chain with 2 verices, which has grundy(1) xor grundy(2) = 0 xor 1 = 1. Therefore grundy(3) = max({1}) = 0.

        grundy(4). Now we have two options, make two chains with each 2 vertices, or 1 chain with 1 vertex and one vertices. This gives the values: grundy(2) xor grundy(2) = 0, and grundy(1) xor grundy(3) = 0. Therefore grundy(4) = mex({0, 0}) = 1

        Now you should be able to tell, that grundy(even number) = 1, and grundy(odd number) = 0. And it's quite easy to prove it using induction.

        In Div2-B you should calculate grundy(1) xor ... xor grundy(n), which is 1 if there are an odd amount of even numbers in 1..n, or 0 otherwise.

        • »
          »
          »
          »
          »
          7 лет назад, # ^ |
          Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

          How to know if the Game Problem is MISERE or NORMAL ?

          Also, if its NORMAL then we apply Sprague-Grundy BUT when its MISERE then is there any theorem or we have to do it with just OBSERVATIONS ?

          (There is GENUS THEORY for MISERE GAMES but its incomplete).

          • »
            »
            »
            »
            »
            »
            7 лет назад, # ^ |
              Проголосовать: нравится 0 Проголосовать: не нравится

            Normal means, that the first player, that isn't able to make any moves, looses. In a Misere Game, he would win instead.

            There are not really any helpful theorems for misere games (at least I don't know any).

»
7 лет назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

I don't have a proof for this, but trying small values with DP, I found out that if all numbers are  ≤ 1, then the first player wins if the amount of ones is even. Otherwise, the first player wins if xor sum of all numbers is non-zero, just as in normal nim game.