Sprague-Grundy values and complexity for LCTR ∗

,


Introduction and background
Combinatorial game theory is a large and growing field that includes in its scope a wide range of game types, generally focusing on two-player games in which both players have perfect information and there are no moves of chance.We restrict ourselves to two-player combinatorial games that end in finitely many moves.Every game ends in one of the two possible outcomes: one of the players wins, while the other loses.Under normal play, the winner is the player who makes the last move, leaving their opponent with no move.Under misère rules, the win condition is reversed.
The main question in combinatorial game theory is, given some position and optimal play, which player has a winning strategy?An N -position (winning position) is one in which the player whose turn it is can guarantee a win.The complementary positions are P-positions (losing positions) in which the player that goes second can guarantee a win.The game is effectively solved if we can classify all of its positions as either N or P. Sprague [10] and Grundy [6] introduced a method of quantifying game positions for normal play impartial games, i.e., those in which both players have the same possible moves in each position.These Sprague-Grundy values are a generalization of winning and losing positions.Furthermore, the Sprague-Grundy values are instrumental in the theory of disjunctive sums of impartial games; see [3,4,6,9,10,11].This is why recent research on impartial games is predominantly focused on the Sprague-Grundy values values rather than on P/N -positions.A more detailed introduction to combinatorial game theory, including impartial games, can be found in [3,4,9].
In this paper we study the impartial finite game introduced in [5], where two players take turns removing from a given Young diagram λ either leftmost column or topmost row -hence the name LCTR.We measure the time complexity of this problems in terms of n, where λ is a partition of n.In [5], the authors studied the behaviour of some specifically structured subfamilies of LCTR games (see Lemma 3) and devised a procedure deciding which player has the winning strategy on a given Young diagram and determining the Sprague-Grundy value associated to the Young diagram in O(n) time units [7], where time unit allows performing a basic arithmetic operation (see Section 6.1).
In Section 2 we cover the basic definitions needed for the study of LCTR and related games.In Section 3 we establish the properties that are common to both normal and misère play of LCTR.In Sections 4 and 5 we take the study of the normal form of LCTR, as well as the normal form of a game called Downright that is closely related to the misère form of LCTR, and show that for both games, the optimal strategy can consist mostly of mirroring the opponent's moves.This allows for computing the exact Sprague-Grundy values for both games in O(log n) time units, as shown in Section 6.In the same section we also cover some other complexity measures of both games, such as state-space complexity, and number of leaves and nodes in the corresponding game tree.

Preliminaries
In this section, we provide background information on partitions and Young diagrams, impartial games, Sprague-Grundy theory, and complexity theory.
The λ j 's are called the parts of λ.When some of the parts of a partition are equal, we may abbreviate λ m 1 1 , . . ., λ m k k , where λ j appears m j ≥ 0 times.The Young diagram of λ is a left-justified array of boxes in which the jth row from the top contains λ j boxes.Partitions are drawn as Young diagrams, and no distinction is made between a partition and its Young diagram.The Young diagram of 6, 4, 3, 3, 1, 1 = 6, 4, 3 2 , 1 2 is shown in Figure 1.The only partition of 0 is the empty sum, which we write as .We define the conjugate partition of λ as λ ′ = λ ′ 1 , . . ., λ ′ λ 1 where λ ′ i is the largest integer such that λ λ ′ i ≥ i.If i and j are such that λ i > 0 and 0 < j ≤ λ i then the box in the ith row and jth column of the Young diagram is called the (i, j)th box of the Young diagram.The subpartition of λ corresponding to the Young diagram rooted at the where trailing nonpositive entries are removed.We define a corner of a partition λ to be any subpartition λ[i, j] (i.e.rooted at (i, j)th box) which corresponds to the partition 1 .If i and j are positive integers not satisfying the above conditions, then we define λ[i − 1, j − 1] to be the empty partition .Thus λ[0, 0] = λ for any partition.A key property of the subpartitions is that for all non-negative integers i 1 , i 2 , j 1 , j 2 we have the identity For a given partition λ = λ 1 , λ 2 , . . .we make use the notion of Durfee length which is defined as Let r and c be positive integers.The staircase, rectangle, and gamma families of partitions are defined as respectively.

Impartial games and Sprague-Grundy values
In this paper our focus will be exclusively on impartial finite combinatorial games, which we will refer to simply as games.The positions in the games we study are partitions or Young diagrams, which we describe in the following subsection.A subposition of a game is a position that can be reached after a nonnegative number of moves.A combinatorial game is short, if no position can be repeated, and if there exist finitely many reachable subpositions.
A terminal position of a game is a position from which no further moves are possible.Under normal play of a combinatorial game, a player who reaches a terminal position is the winner.Under misère play, a player who reaches a terminal position is the loser.Throughout this paper, we assume normal play unless otherwise indicated.
Let G be a game under normal (misère) play.We define the set of its winning positions N G , and the set of its losing positions P G , as follows: 1. Terminal positions are in P G (N G ).
2. A position is in P G , if none of its moves leads to a position in P G .
3. A position is in N G , if at least one of its moves leads to a position in P G .We denote the above sets simply as P and N , whenever the game in question is clear from the context.
A short two player combinatorial game is impartial if both players have the same possible moves in each position.Let A be a position of such a game G.If there is a move from A to position B, we write A → B. For a finite set S of nonnegative integers the minimum excluded value of S is defined as the smallest nonnegative integer that is not in S and is denoted by mex(S).The Sprague-Grundy value (SG value) of A is defined recursively by A position of SG value t is called a t-position.For the case of terminal positions we have mex(∅) = 0, hence such positions have SG value 0.
SG values provide a useful mechanism for determining winning and losing positions for short impartial games under normal play.In particular, the P-positions are precisely those that have SG value 0 while the N -positions are those with nonzero SG values.The Sprague-Grundy theorem [9] shows that given the sum of impartial games under normal play, we can replace every game with a pile of NIM, with the size corresponding to the SG value of the game.Doing so will not change the P/N -positions of the sum.
For normal play, one can partition the positions to equivalence classes with respect to their SG value.For misère play such equivalence classes, for which we can replace one game with another within the sum, are different and far more difficult to characterize in general.The equivalence classes for misère are called misère quotients and form commutative monoid [8].Hence while one can study misère quotients, one can also focus on just P/N -positions.
We make use of the following corollary, which follows from the definition of SG value.For detailed coverage of combinatorial game theory we refer the reader to [9].Corollary 1.Let A, B be positions such that A → B. Then SG(A) = SG(B).

Complexity theory
We provide some technical definitions regarding complexity in the context of impartial games that will be used later.Let G be an impartial game and let p be a fixed starting position, which we sometimes refer to as G(p).The corresponding game tree T p is a rooted tree obtained by the following procedure.
• The original position p is the root of T p .
• For each subposition p with p → p, there is a directed edge from p to the root of T p.
We distinguish several parameters related to G and p: 1. Number of leaves of the game tree T p is denoted by (T p ), while number of nodes of the game tree T p is denoted by (T p ).We extend those notations by defining (G(p)) = (T p ), and similarly (G(p)) = (T p ).

2.
A height of T p is the length of the longest path from p. Provided that T p has finite height, the height of any proper subtree of T p is at least one less than the height of T p .
3. We say that subpositions p and p of p are distinct if T p is not isomorphic to T p.The state-space complexity of a game is the number of pairwise distinct game positions reachable from the initial position p of the game.
A game G is said to be finite if T p has finite height for any position p of G. Observe that G is short, if and only if (T p ) is finite for all positions p. Computational complexity of a game is the time required to decide whether a given initial position is winning.

LCTR and Downright
We now describe the core objects of this paper, games LCTR and Downright.After providing definitions in Sections 3.1 and 3.2, we mention several important properties of both games in Section 3.3.
The terminal position occurs when r = 0, which we denote by L( ).Let A = L( ) be a non-terminal position.There are two possible moves a player can make, leading to a new position Ã, namely: Given two non-negative integers i < r and j ≤ λ i+1 , or (i, j) = (r, 0), we denote the subposition reached from A by i top row moves and j left column moves as A[i, j], formally

Downright
We now introduce a new game named Downright, which is simpler than LCTR and is a good introduction to the study of LCTR.Normal play in Downright is equivalent to misère play in LCTR in a way that is made more precise in Section 4. In Downright, a "restricted" rook chess piece begins in the top-left box of a Young diagram.The rook can move a single adjacent box down or right.Under normal play, then, the player who gets the rook to a corner, where no moves remain, is the winner.There are similarities with Impartial chess played with a King [1,2], but in Downright we cannot move diagonally and the board is a (not necessarily rectangular) partition.
Let us define the game of Downright D(λ), for a given partition λ = λ 1 , λ 2 , . . ., λ r .There are at most two moves a player can make.In particular, the move resulting in the subposition D(λ[1, 0]) is allowed whenever r > 1, the move resulting in subposition D(λ[0, 1]) is allowed whenever λ 1 > 1.Given two non-negative integers i < r and j < λ i+1 , we denote the subposition reached from A by the rook moving j boxes to the right and i boxes down as A[i, j], formally A[i, j] = D(λ[i, j]).

Observations regarding LCTR and Downright
Let λ be a partition, let i, j be nonnegative integers such that λ[i, j] is defined and nonempty.Within the game tree of either L(λ) or D(λ), a position corresponding to λ[i, j] occurs several times1 but its SG value need only be computed once.Furthermore, in either game we can capture the SG values of every position by only storing the values SG(A[i, j]).
To show this graphically we write the value SG(A[i, j]) inside the box of the Young diagram for A, located on coordinates (i + 1)-th row and (j + 1)-th column (see e.g. Figure 4).Since each position admits at most two moves, we simplify the notation for the minimum excluded value and also use a ▽ b instead of mex({a, b}).According to Equation (2), we can compute the SG value of A = L(λ) as follows: Similarly, we can compute the SG value of A = D(λ) as follows: See Figure 3 for an example.We now describe SG values for some families of games introduced in Section 2.1.
Lemma 2. For a positive integer n we have that . Due to Equations ( 3) and ( 4), we have Hence in both cases the SG values must alternate between 0 and 1 as n increments by 1.
The difference is that is a terminal position for LCTR and has SG value 0, while 1 = 1 is a terminal position for Downright with SG(D( 1)) = 0.
Lemma 3.For positive integers r and c we have Proof.As Equation ( 5) is already shown in Ilić [5] we only consider the case of Downright.If c = 1 or r = 1, then induction shows that SG(A) is 0 if cr is odd and 1 otherwise.Hence SG(A) and cr are of distinct parity.If c > 1 and r > 1, then by definition, Due to Equation (1), every permissible sequence with the same number of left column and top row moves leads to the same position.
On the left side we have the positive prefix of On the right side we have the conjugate of the positive prefix of λ j+1 −i, λ j+2 −i, . . ., λ r − i which corresponds to as desired.We now show Item 2. Let A be either L(λ), or D(λ).We divide the proof into two cases.
1.If min(r, λ 1 ) = 1: By the symmetry of the roles of r and c in Lemma 3, we have The claim holds for this case, since this corresponds to either c = 1 or r = 1.
2. (min(r, λ 1 ) ≥ 2): We show the claim for min(r, λ 1 ) ≥ 2 by induction on τ = r + λ 1 , i.e. the total number of rows and columns.This, together with Equations ( 3) and ( 4) implies τ ≥ 4 and also Now suppose that the claim holds for all values less than τ .Observe that where the former equality follows from Equation ( 7) while the latter equality is obtained from Item 1 of Lemma 5 above.Since both SG(A[0, 1]) ′ as well as SG(A[1, 0]) ′ have the sum of columns and rows strictly less than τ it follows from the induction hypothesis or from Item 1 of this proof, that

LCTR misère play and Downright
As discussed in Section 2.2, it is in general difficult to analyze misère play of a given combinatorial game.Nevertheless, in this section we show that misère LCTR can be analyzed using Sprague-Grundy theory.In fact, Downright is misère LCTR without its terminal positions.
Lemma 6.Let λ = be a partition.Then λ corresponds to a P-position in misère LCTR if and only if it corresponds to a P-position in Downright (under normal play).
Proof.By the definition of P and N positions (Section 2.2), all empty subpositions in misère LCTR belong to N while all corners are in P. For Downright, we have that all corners are in P. Recall that empty partition is not valid input partition for the game Downright.Now consider either of the games (misère LCTR or Downright) played on a row c , c > 1, and observe that such a game belongs to N if and only if the same game played on (c − 1) belongs to P. The same arguments hold for the case of the column game, when either game is played on the partition 1 r , r > 1.We conclude that the membership in N or P coincides for both games, whenever played on a column, or on a row partition.
Consider now an arbitrary partition λ = and consider both games played on λ.We already established that in the cases of subpartitions c or 1 r , both belong to P or N in the same way.Since the definition of P and N (Section 2.2) computes membership of positions from both games recursively in the same way, this concludes the proof of the claim.Lemma 6 motivates the following theorem, from which it can be derived as a corollary.

Definition 7 (truncation).
Let G be a finite impartial game starting on position p.The truncation of G is an impartial game trunc(G) obtained from G as follows: • The starting position of trunc(G) corresponds to p.
• trunc(G) has the same moves as G except moves A → B where B is a terminal position of G no longer exist.
We will assume trunc(G) is played under normal play, unless stated otherwise.
Theorem 8.The P-positions of any finite impartial misère game exactly correspond to those of its truncation.
Proof.Let G be a finite impartial misère game, let H = trunc(G), and denote the sets of their P-positions by P G , P H , respectively.Note that the deleted G-terminal (i.e.terminal in G) positions are not P G , by definition of misère, which supports our claim.All the remaining positions exist in both G and H. Since G is a finite game, for every position A, all of its subpositions have smaller height than A. Hence we can establish P G = P H by induction on the height of the game tree of G.
First we show that the claim holds for all subpositions A such that A is of height 1 in G.The only moves from A are to G-terminal position which are all N G , thus A ∈ P G follows.Since A is H-terminal and H is under normal play, it holds trivially that A ∈ P H . Now assume that the claim holds for all subpositions reachable from A. Let T denote the terminal positions to which we can move in G from A, and let B correspond to the set of non-terminal positions reachable from A in one move.Recall that T ⊆ N G .We consider two cases depending on whether A is P G or N G .
• The above theorem directly implies that N -positions also coincide except on the deleted terminal positions of the original game, as they do not exist in the truncation.We find it noteworthy that the truncation of LCTR is played on the same Young diagram under the rules of Downright.Indeed, since the terminal positions of any LCTR game G are "located" outside its Young diagram, removing them does not alter the diagram for trunc(G).
One might also consider the misère variant of Downright in which case its terminal positions are the corners of the corresponding Young diagram.In this setting, truncated Downright turns out to be equivalent to normal play Downright on an altered Young diagram where all corners are removed.
Lemma 6 further motivates the study of the SG values of Downright, which is the focus of this section.We now show how SG values propagate along diagonals, as seen in Figure 4 (right).To simplify the notation further, we write ❆ ❆ b for an arbitrary integer from the set {0, 1, 2} \ {b}.This allows us to simplify some computations such as ❆ 0 ▽ ❆ 0 = 0, or 0 ▽ ❆ 1 = 1.

Suppose
By Items 1 and 2 it follows Due to Lemma 9, we can now state the main theorem of this section.
Theorem 10.Let λ be a partition, let A = D(λ) be a game of Downright and let ℓ = d(λ).
To put things in perspective, to calculate the SG value of a game of Downright, by Theorem 10 we can calculate the subpartition at the end of the diagonal, which turns out to be always be a gamma partition, which we know how to calculate by Lemma 3.

LCTR normal play
In this section we focus on LCTR as described in Section 3.1.We start by showing how to obtain SG values of small games, namely for LCTR games of Durfee length at most three.We postpone the analysis of computational complexity until Section 6.
Lemma 11 (one-row game).Let A = L(λ) with λ = λ 1 .Then Clearly one may obtain SG(A[2, 1]) and SG(A[1, 2]) by using Lemma 11 together with input partition a , or λ 2 − 2 , respectively.In the former case we used the fact that SG(L( a )) = SG(L( 1 a )), due to Lemma 5. We now resolve the remaining SG values as announced in Item 2. One may now use Equation (3) to express those SG values as
Proof.We resolve the above-mentioned five cases separately, relying heavily on Lemma 12.
Recall from Lemma 12 that the SG values of positions A[1, j] with 0 ≤ j < λ 3 alternate between 0 and 2 whenever λ 2 = λ 3 , or between 1 and 2 otherwise.Also observe that the value SG(A[0, λ 3 ]) can be obtained from either Lemma 11 or Lemma 12.

LCTR games of Durfee length at least four
We now give a bit more complicated version of the propagation from Lemma 9, which holds for LCTR normal play.
Lemma 14.Let λ be a partition, let A = L(λ) be a game of LCTR, and let i, j ≥ 1 be such that λ[i, j] = .
Proof.We have that λ[i ′ , j ′ ] = for any choice of 0 ≤ i ′ < d(λ) and 0 ≤ j ′ < d(λ).In particular, for any corresponding subgame A[i ′ , j ′ ] we may use the first case of recursion in Equation (3).We consider three cases depending on the value of SG(A[i, j]).

Suppose
is empty.First notice that by Corollary 1 we have

Suppose
In addition, Items 1 and 2 imply that The following corollary will be used in Section 6, for efficient computation of SG values.
Corollary 15.Let λ be a partition, let ℓ = d(λ) − 3 ≥ 0, and let A = L(λ).Then Since ℓ ≥ 0 it follows that the position Ā is properly defined and we have d( Ā) = 3.By Lemma 14 and Observation 4, regardless of the value of SG( Ā) we infer In view of this corollary we restrict ourselves to the study of games with Durfee length at most 3.As an application of this corollary we now compute SG( c r ).
Lemma 16.For positive integers c and r, we have

The complexity of LCTR and Downright
In this section we discuss computational aspects of both LCTR and Downright.Let n = r i=1 λ i , where λ = λ 1 , . . ., λ r is the input partition for either game.Complexity results will be expressed in terms of λ 1 , r, and n.In Section 6.1, we discuss the time complexity required to compute SG-values of LCTR and Downright.In Section 6.2, we study the number of nodes and leaves in their game trees.In Section 6.3, we examine the state-space complexity of these games.

Time complexity of computing SG values
The results of this section will be expressed in terms of the number of time units needed.We consider the time unit to be any of the following: 1. Reading an integer.Note that our input partition λ = λ 1 , . . ., λ r consists of a sequence of r integers, so reading the input takes r time units.
2. Basic arithmetic operations.Here we mean integer multiplication or division by 2, addition or subtraction of the given integers, or computing the parity.

Minimum excluded value:
We consider computing a minimal excluded value to be a basic operation which takes one time unit.Note that mex computations will only be performed with integers from the set {0, 1, 2}.
For a given partition λ = λ 1 , λ 2 , . . ., λ r we show that the SG value of both LCTR and Downright, played on λ, can be determined O(log(r)) ≤ O(log(n)) time units.For comparison, the dynamic programming approach by [5] required Θ(n) time units for the same task.
Proof.Recall that the Durfee length is the largest i ∈ {1, . . ., r} such that λ i ≥ i.We can find such a value in log(r) time units by using binary search.
Proof.For every i ∈ {1, . . ., λ 1 } we find λ ′ i via a binary search on the list λ 1 , . . ., λ r which takes O(log(r)) time units each.Hence, in total we need O(λ 1 log(r)) time units.time units.We distinguish three cases, depending on the Durfee length of λ: Notice that λ is of gamma shape, and the corresponding SG value can be computed in O(1) time units due to Lemma 3.
• Case d(λ) = 2. Denote the lengths of the first two columns by r and j, i.e. j is the maximal integer such that λ j ≥ 2. We need O(log(r)) time units to compute j via binary search.
We express SG(A) as a function of α 02 , α 20 , α 12 , α 21 , where α ij = SG(A[i, j]).We calculate those four values as a function of λ 1 , λ 2 , r and j, by using Equation (10) where The computation of α 02 , α 20 , α 12 , α 21 can be done in O(1) time units; see Lemmas 11 and 12. Afterwards the application of Equation ( 9) can be performed in constantly many time units, so the overall computation time is O(log(r)) time units.
Let r, j and i be the (possibly zero) lengths of the first three columns of λ, respectively.Formally, let r, j and i be maximum integers such that λr ≥ 1, and λj ≥ 2, and λi ≥ 3, respectively.We need O(log(r)) time units to compute r, j and i.The value of SG(A) can now be computed in O(1) time units by using Equation (13), where

The game tree of LCTR and Downright
In this section we describe the number of nodes and leaves that the game tree of LCTR, or Downright, might have.
The number of nodes in the game tree Recall that (A), and (A), denote the number of nodes, and leaves, in the game tree of the game A, respectively.The following corollary connects those notions, and follows immediately from Definition 7.
Given a game A of either type, recall that a position may occur several times within the game tree of A. More precisely, if A[i, j] = then the pair (i, j) gives rise to exactly i+j i nodes within the game tree of A. Proof.First observe that if r = 1 or c = 1, then r,c = r,c , thus the claim holds (also see Table 1).The proof is by induction on r + c.Since the base case was already covered, assume that the claim holds for all partitions r ′ ,c ′ with r ′ + c ′ < ℓ and let r + c = ℓ.By the principle of inclusion-exclusion first observe the following recurrence of (D( r,c )), whenever min(r, c) > 1: By applying the induction hypothesis to Equation (14) we obtain

Number of leaves in the game tree
The number of leaves in the game tree of a given position corresponds to the number of different games that can be played on that position.As expected, for both games this number can be exponential in n, for example for staircase partitions (see Table 1).Depending on the input partition, the number of leaves may be much smaller.
Lemma 23.Let n be an integer and let λ ⊢ n.The number of leaves in the game tree of D(λ) is at least 1.The number of leaves in the game tree of L(λ) is at least n + 1.Both lower bounds are tight.
Proof.Regarding the case of Downright, it is enough to inspect the second row of Table 1, where one may observe that this bound is achieved by n .We now consider the case of LCTR.
We prove the claim by showing that among all of the partitions of n > 0, the partition n has the smallest number of leaves, in particular (L( n )) = n + 1.Consider now any partition λ = λ 1 , . . ., λ r ⊢ n.Let λ = λ 1 , . . ., λ r − 1 and let λ = λ 1 + 1, . . ., λ r − 1 be a partition obtained from λ by adding one box to the first row.Now observe that since λ = it follows that λ[r − 1, λ r − 1] = 1 .The leaves of L( λ) are the same as those of L(λ) except we remove both children (which are both leaves) of all the occurrences of L(λ)[r −1, λ r −1] in the game tree, and all occurrences of L(λ)[r − 1, λ r − 1] become leaves.Hence the number of leaves decreases by the number of occurrences of L(λ)[r −1, λ r −1], in particular, the number of leaves decreases by at least one.On the other hand notice that L( λ) admits exactly one more leaf than L( λ) since in the game tree of L( λ) we replace the single occurrence of the leaf λ[0, λ 1 ] = with a node with two leaf children to get the game tree of L( λ).It follows that the number of leaves did not increase from λ to λ while λ, λ ⊢ n.Any partition λ ⊢ n minimizing the number of leaves can therefore be gradually transformed to n , without increasing the number of leaves.It remains to observe, e.g. by Table 1 and Corollary 21, that n indeed admits exactly n + 1 leaves, as stated by the claim.
The next lemma describes the number of leaves in the game tree of LCTR, when played on a rectangular partition.
Lemma 24.For positive integers r, c we have that (L( r,c )) = r+c r .Proof.Similarly as above, min(r, c) = 1 implies r,c = r,c , so in those cases the claim can be easily verified (see also Table 1).For the remaining cases, by the principle of inclusionexclusion we get For some simple families we present the corresponding values in Table 1.The first two rows of Table 1 show the tightness of Lemma 23, i.e. they describe the asymptotically smallest number of nodes and leaves that the game tree of LCTR, or Downright, may have.We believe that the number of leaves attained by the above lemma attains the maximal value whenever r = c, which leads to the following conjecture.
Conjecture 25.The number of nodes in the game tree of any game of Downright and LCTR on a partition of size n 2 is maximized in the partition n,n , i.e. the square partition.
If we assume exponential or corner representation of input partition, the computational difficulty of the problem may change nontrivially, as converting between the mentioned representations may take as much as O(n) time units.
On one hand, doing this can speed up certain parts of computation of SG values, while other difficulties may appear.For instance, it is not clear to us whether one can always determine the Durfee length in O(log n) time units using exponential notation.It would be interesting to see if the overall time complexity can be improved by assuming that the input partition is encoded using exponential notation.
Multidimensional LCTR: Let us denote the tuples v = (v 1 , ..., v d ) with v i ≥ 1 for all i as points.For two such points v, v ′ , we say that v ≤ v ′ if v i ≤ v ′ i for all i.The position of d-dimensional LCTR is simply a finite set S of non-comparable points, also called corners.In d-dimensional LCTR on their turn a player chooses i ∈ {1, ..., d}, and modifies every s ∈ S by decreasing s i by one if s i − 1 is positive, and removing s from S otherwise.The game ends when S is empty.
In such setting it is easy to see that the Sprague-Grundy values may not exceed d, however zero values do not propagate, hence there is no hope for the similar algorithm to work.Is there a fast algorithm like in the case d = 2? Impartial chess on an arbitrary partition Impartial chess is an impartial game played on a rectangular partition r,c with a single chess-piece starting on the top-left most position r,c [0, 0].The move from a position r,c [i, j] to a position r,c [i ′ , j ′ ] is allowed if (i) it respects the movement rules of the regular game of chess, and (ii) i ≤ i ′ < r, as well as j ≤ j ′ < c.
The game of Downright presented in this paper is very similar to Impartial chess with a king.The two differences are: (i) the king cannot move diagonally, and (ii) the initial partition in Downright need not be of rectangular shape.Despite the similarity, the Impartial chess with a king seems to be much harder to understand when played on an arbitrary partition.On the other hand, Impartial chess with a rook is equivalent to two-pile Nim, while Impartial chess with a queen is equivalent to the Wythoff game [12].
Due to the above connections of Impartial chess with other impartial games, it would be interesting to study this game in the generalized setting where the starting position can be any partition.
Non-repetitive variant: The majority of the winning strategy of both LCTR and Downright consist of mirroring the opponent's moves.Suppose that we require that within every four consecutive moves, the number of L moves is distinct from the number of T moves.Does the game becomes significantly harder?

0
and c is odd, or c = 1 and r is odd 2 otherwise if both c and r are odd 2 if they are of different parity and c > 1 and r > 1 1 otherwise .

r and c are odd 1 if r and c are even 2 otherwise . Observation 4 .
Let A be a position in any impartial game under normal play.Then SG(A) does not exceed the number of allowable moves from position A.

Lemma 9 .
Let λ be a partition and let i, j > 1 be integers such that A = D(λ) and A[i, j] are positions in Downright.Then SG(A[i − 1, j − 1]) = SG(A[i, j]).Proof.Due to Observation 4 it is enough to consider three cases depending on the value of SG(A[i − 1, j − 1]).

Figure 5 :
Figure 5: Cases from Lemmas 11 to 13.The symbol • • • denotes alternating values from the two boxes right from it.
and c + r is odd 1 otherwise .Proof.By Lemma 5 we can assume c ≥ r, otherwise we can take its conjugate which has this property.If r = 1, then the formula holds by Lemma 11.If r = 2, then the result holds by Item 1 of Lemma 12.If r ≥ 3 then by Corollary 15 the game SG(L( c−r+3,3 )) = SG(L( c,r )) and this game can be solved with Item 1 of Lemma 13.

Theorem 19 .
Let λ = λ 1 , λ 2 , . . ., λ r be a partition of n.The SG value of D(λ) can be computed in O(log(r)) ≤ O(log(n)) time units.Proof.We can compute the Durfee length d(λ) in O(log(r)) time units due to Lemma 17.Let λ = λ1 , λ2 , . . ., λr be a partition corresponding to the smallest "diagonal subgame," i.e.A[d(λ) − 1, d(λ) − 1] = D( λ1 , λ2 , . . ., λr ).Due to Theorem 10 it is enough to compute SG value of D( λ), as it corresponds of that of K(λ).To this end observe that, by construction, λ is of shape a,b .Here a = λ d(λ) − d(λ) + 1, while integer b can be computed via binary search in O(log r) time units. 2It remains to verify, by Lemma 3, that the SG value of a,b can be computed in O(1) time units.Summarizing the time complexity, the computation of SG value of the game of Downright requires O(log(r)) time units.Theorem 20.Let λ = λ 1 , λ 2 , . . ., λ r be a partition of n.The Sprague-Grundy value of L(λ) can be computed in O(log(r)) ≤ O(log(n)) time units.Proof.Let A = L(λ).Due to Lemma 17, we can compute the Durfee length d(λ) in O(log(r))
Let A ∈ P G .Then we have B ⊆ N G by the definition of P and N positions (Section 2.2).By induction hypothesis we have for all B ⊆ N H . Since A can only move to positions B in H, we have that A ∈ P H . • Let A ∈ N G .Then there exists B ∈ B s.t.B ∈ P G by the definition of P and N .By induction hypothesis we have that B ∈ P H . Since position A can move to position B in H, we have that A ∈ N H .