Wyzhov game -- basics

1. Wythoff's game

There are two piles of several items. Two people take turns to take at least one item from either pile or to take the same number of items from both piles at the same time. It is stipulated that at least one item is taken at a time. There is no limit to the number of items.

Strange situation : There are two people A and B. If A is the first mover, the remaining numbers of the two piles of stones are a and b (a<b). If A faces (0,0), (1,2), ( 3, 5), (4, 7), (6, 10), .... In these situations, A must lose. Such situations are called strange situations. You can verify it yourself.

The singular situation satisfies: floor((ba)*(sqrt(5)+1)/2) = a

The golden ratio is 0.618, the Wyzoff game is 1.618, and a and b are approximate golden rectangles.

Second, the topic

1----Determine whether the first player can win the situation

Two piles of stones N and M (N>M), floor((NM)*(sqrt(5)+1)/2)!=M, then A wins first, otherwise B wins.

nyoj 161

2---- Give the difference n, output the singular situations from 0-n; or give n, output the first n singular situations except (0,0).
3----If the first mover wins, output the first stone plan

1. First judge the situation  

According to the theorem: N and M are two piles of stones (N>M), floor((NM)*(sqrt(5)+1)/2)!=M, then A wins first, otherwise B wins.

2. A is the first mover

There are two situations in which A wins the first stone fetching scheme:

(a) Remove the same number of stones from two piles of stones, so the difference of (NM) remains unchanged, and the singular situation where the difference is (NM) is directly output, which is the situation after A is taken.

(b) Take stones from any pile, so that the difference is not unique, and the singular situation is not fixed; enumerate the difference from 0 to N, look at the situation of B, if it is a singular situation that can be proved to be output, A is stable To win, B is facing a strange situation. No matter how you take it, you will definitely lose.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325556168&siteId=291194637
Recommended