Staircase Nim)

Source: Internet
Author: User


Today, I made a game question in poj. I learned about the tiered game... I will explain my understanding of the tiered game below ..

  The first is to describe the tiered game... the game is played on a column of tiers... there are several natural points on each step .. two people playing a tiered game... each step moves several vertices (> = 1) in a group to the front .. at last, people who have no point to move will lose ..



For example, this is the initial State of a tiered Game 2 1 3 2 4... only the vertices behind the scenes can be placed in front of the scenes... how can we analyze this problem... in fact, after a tiered game is switched, it can be changed to Nim .. regard All odd steps as N stones .. do Nim .. moving stones from odd heaps to even heaps can be understood as taking stones away .. it is equivalent to several odd-number stones in Nim .. (
As in the example given... 2 ^ 3 ^ 4 = 5 is not zero, so the first hand is defeated.) Why can this be converted?Let's assume we are a pioneer... the odd-number heap of the given stepping stone state can win the NIM first hand... I will move the odd-number heap stones to the even-number heap as per the winning steps... if the opponent is also moving the odd-number heap .. we continue to move the odd-number heap .. if the opponent moves the even-numbered stones to the odd-numbered heaps .. then we will move so many stones that our opponent has moved from that even pile to the odd pile below... after two operations... it is equivalent to moving down a few stones in an even number .. while the odd-number heap is still the original form... that is, the winning status... even if the back hand keeps moving the even number of stones to the odd number of heaps .. we kept following him and moving the stone down .. keep the odd heap unchanged... so proceed .. I can move the even stones to 0 .. then you cannot move these stones... so the whole process .. moving an even-number heap to an odd-number heap does not affect the NIM game of an odd-number heap .. the entire process can be abstracted as an odd number of Nim games... Other situations... those that must be done first... similar reasoning... just judge the situation where the odd number heap is playing the NIM game... Why is it possible to just Nim the odd-number heap... instead of the even-number heap ?... Because if it is Nim for the even-number heap... the opponent moves the stones in the odd-number heap to the even-number heap .. we move these stones to the next odd heap... in the end, the opponent moved these stones to 0 .. we cannot continue to move... we can only destroy the original Nim, leading to uncertainty in the outcome and defeat relationship... so you only need to make a nim judgment on the odd-number heap to know the outcome...

Original article: http://blog.csdn.net/kk303/article/details/6692506

Related Keywords:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.