{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lecture_Feb8

# Lecture_Feb8 - 9 The Sprague-Grundy Function Definition The...

This preview shows pages 1–9. Sign up to view the full content.

9. The Sprague-Grundy Function. Definition. The Sprague-Grundy function of a graph, (X,F), is a function, g, defined on X and taking non-negative integer values, such that g(x) =min{ n 0 : n g(y) for y F(x)}. (1) In words, g(x) the smallest non-negative integer not found among the Sprague-Grundy values of the followers of x.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
If we define the minimal excludant , or mex , of a set of non-negative integers as the smallest non-negative integer not in the set, then we may write simply g(x) =mex{ g(y) : y F(x)}
Note that g(x) is defined recursively. That is, g(x) is defined in terms of g(y) for all followers y of x. Moreover, the recursion is self-starting. For terminal vertices, x, the definition implies that g(x) = 0, since F(x) is the empty set for terminal x.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Positions x for which g(x) = 0 are P-positions and all other positions are N-positions. The winning procedure is to choose at each move to move to a vertex with Sprague- Grundy value zero. (1) If x is a terminal position, g(x) = 0. (2) At positions x for which g(x) = 0, every follower y of x is such that g(y) 0, and (3) At positions x for which g(x) 0, there is at least one follower y such that g(y) = 0.
Example: Subtraction Game S= {1, 2, 3}? The terminal vertex, 0, has SG- value 0. The vertex 1 can only be moved to 0 and g(0) = 0, so g(1) = 1. Similarly, 2 can move to 0 and 1 with g(0) = 0 and g(1) = 1, so g(2) = 2, and 3 can move to 0, 1 and 2, with g(0) = 0, g(1) = 1 and g(2) = 2, so g(3) = 3. But 4 can only move to 1, 2 and 3 with SG-values 1, 2 and 3, so g(4) = 0.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Continuing in this way we see x 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14. . . g(x) 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2. . . In general g(x) = x (mod 4), i.e. g(x) is the remainder when x is divided by 4.
Example: At-Least-Half. Consider the one-pile game with the rule that you must remove at least half of the counters. The only terminal position is zero. We may compute the Sprague-Grundy function inductively as x 0 1 2 3 4 5 6 7 8 9 10 11 12 . . . g(x) 0 1 2 2 3 3 3 3 4 4 4 4 4 . . . We see that g(x) may be expressed as the exponent in the smallest power of 2 greater than x: g(x) = min{ k : 2 k > x}.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Example: One Pile Example: One Pile Nim Nim For the Nim game with only one pile of n chips, the player can remove 1 to n chips from the pile.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern