Cyclic Partisan Nim Variant

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite
2












This game is played with a sequence of heaps and a position marker, where each heap is owned by exactly one player. The game ends when a player has removed all objects from their own heaps, and this player wins with score equal to the number of remaining objects. Other players lose with score equal to minus the number of objects they still own. Play consists of players cyclically taking turns, where (for the 2-player version) they choose to either:



  • Move the position marker forward to any non-empty heap they own, and remove exactly one object from that heap.

  • Reset the position marker back to the beginning, before any heaps. (Only valid if the previous player did not reset - this ensures the game is finite.)

What is the optimal strategy for each player in the 2-player version, given an arbitrary initial state?



A state can be specified by:



  • A sequence of (size, owner) integer pairs representing the heaps

  • A non-negative integer representing the position marker (with the sequence indexed starting from one)

  • An integer representing the player about to move

  • A Boolean representing whether the previous player chose to reset


So far I have noticed the maximal score seems to eventually follow an arithmetic progression under consistent patterns of adding to the heaps. However, there is a certain region of states with more unstable behaviour. The main problem is the position marker, since without it the game would become trivial.




Update: I have generated the maximum scores for player $0$ with the initial state



$$
left( beginarrayc
!!!& 3 & & x & & 5 & & y & !\
!!!& & 6 & & 9 & & 2 & & 4 !
endarray right)_textP0, top
$$



as $x$ and $y$ range from $1$ to $11$.
contour plot of maximum scores
Solid contours represent positive score and dashed contours represent negative score. Interestingly, it can be seen that the behaviour changes only near when two heaps have the same size.



Further, I am fairly confident this maximum score formula



$$
left( beginarrayc
!!!& h_1 & & h_3 !\
!!!& & h_2 & !
endarray right)_textP0, top
,to,
left{ beginarraylrrcr
h_2 - h_1 & textif & h_2 - h_1 < 0 & textand & h_3 - h_2 + 1 ge 0 \
h_2 - h_1 + 1 & textif & h_3 - h_1 + 1 ge 0 & textand & h_2 - h_1 ge 0 \
h_3 - h_1 + 1 & textif & h_3 - h_1 + 1 < 0 & textand & h_3 - h_2 + 1 < 0
endarray right.
$$



works for all values of $h_i > 0$, and also including when $h_3 = 0$ or $h_2 = h_3 = 0$. In general I think the function would have to be piecewise linear with coefficients in $ -1, 0, +1 $ and satisfy a heap merge invariance property, meaning for example that $M(h_1, 0, h_3) = M(h_1 + h_3, 0, 0) = M(0, 0, h_1 + h_3)$.







share|cite|improve this question





















  • what is the meaning of "optimal strategy" when there are more than two players ?
    – mercio
    Aug 3 at 10:52










  • @mercio Sorry, I meant optimal strategy for two players. What are the options for more than two players? For a given player, it could be to maximise their score if a win is guaranteed, otherwise minimise the variance among the players' scores.
    – D. G.
    Aug 3 at 11:11










  • By the way, the final Boolean in your state seems a bit redundant, since during play the position marker is before any heaps iff the previous player reset it. Or do you want to allow your arbitrary starting position to be inconsistent in this respect, so that a starting position may or may not allow a reset move regardless of the starting location of the marker?
    – Jaap Scherphuis
    Aug 3 at 13:24










  • @JaapScherphuis Yes it annoys me, but here is why I have left it there: 1) the special case exists either way, so may as well make it explicit; 2) it is only a Boolean in the 2-player case, in the n-player generalisation it can take on n values; and...
    – D. G.
    Aug 3 at 15:22










  • @JaapScherphuis 3) Whenever there is an empty heap, I delete it and merge the adjacent heaps to reduce complexity if possible (for 2 players this makes the heap ownership alternate). Thus if the first player deletes the first heap, then the second player will not know if they can reset the position marker, unless they have the Boolean. Then there are three options: leave empty heaps and no Boolean, remove empty heaps and add Boolean, or remove empty heaps and add a phantom empty heap at the beginning. The middle option seems to be the most convenient.
    – D. G.
    Aug 3 at 15:45














up vote
1
down vote

favorite
2












This game is played with a sequence of heaps and a position marker, where each heap is owned by exactly one player. The game ends when a player has removed all objects from their own heaps, and this player wins with score equal to the number of remaining objects. Other players lose with score equal to minus the number of objects they still own. Play consists of players cyclically taking turns, where (for the 2-player version) they choose to either:



  • Move the position marker forward to any non-empty heap they own, and remove exactly one object from that heap.

  • Reset the position marker back to the beginning, before any heaps. (Only valid if the previous player did not reset - this ensures the game is finite.)

What is the optimal strategy for each player in the 2-player version, given an arbitrary initial state?



A state can be specified by:



  • A sequence of (size, owner) integer pairs representing the heaps

  • A non-negative integer representing the position marker (with the sequence indexed starting from one)

  • An integer representing the player about to move

  • A Boolean representing whether the previous player chose to reset


So far I have noticed the maximal score seems to eventually follow an arithmetic progression under consistent patterns of adding to the heaps. However, there is a certain region of states with more unstable behaviour. The main problem is the position marker, since without it the game would become trivial.




Update: I have generated the maximum scores for player $0$ with the initial state



$$
left( beginarrayc
!!!& 3 & & x & & 5 & & y & !\
!!!& & 6 & & 9 & & 2 & & 4 !
endarray right)_textP0, top
$$



as $x$ and $y$ range from $1$ to $11$.
contour plot of maximum scores
Solid contours represent positive score and dashed contours represent negative score. Interestingly, it can be seen that the behaviour changes only near when two heaps have the same size.



Further, I am fairly confident this maximum score formula



$$
left( beginarrayc
!!!& h_1 & & h_3 !\
!!!& & h_2 & !
endarray right)_textP0, top
,to,
left{ beginarraylrrcr
h_2 - h_1 & textif & h_2 - h_1 < 0 & textand & h_3 - h_2 + 1 ge 0 \
h_2 - h_1 + 1 & textif & h_3 - h_1 + 1 ge 0 & textand & h_2 - h_1 ge 0 \
h_3 - h_1 + 1 & textif & h_3 - h_1 + 1 < 0 & textand & h_3 - h_2 + 1 < 0
endarray right.
$$



works for all values of $h_i > 0$, and also including when $h_3 = 0$ or $h_2 = h_3 = 0$. In general I think the function would have to be piecewise linear with coefficients in $ -1, 0, +1 $ and satisfy a heap merge invariance property, meaning for example that $M(h_1, 0, h_3) = M(h_1 + h_3, 0, 0) = M(0, 0, h_1 + h_3)$.







share|cite|improve this question





















  • what is the meaning of "optimal strategy" when there are more than two players ?
    – mercio
    Aug 3 at 10:52










  • @mercio Sorry, I meant optimal strategy for two players. What are the options for more than two players? For a given player, it could be to maximise their score if a win is guaranteed, otherwise minimise the variance among the players' scores.
    – D. G.
    Aug 3 at 11:11










  • By the way, the final Boolean in your state seems a bit redundant, since during play the position marker is before any heaps iff the previous player reset it. Or do you want to allow your arbitrary starting position to be inconsistent in this respect, so that a starting position may or may not allow a reset move regardless of the starting location of the marker?
    – Jaap Scherphuis
    Aug 3 at 13:24










  • @JaapScherphuis Yes it annoys me, but here is why I have left it there: 1) the special case exists either way, so may as well make it explicit; 2) it is only a Boolean in the 2-player case, in the n-player generalisation it can take on n values; and...
    – D. G.
    Aug 3 at 15:22










  • @JaapScherphuis 3) Whenever there is an empty heap, I delete it and merge the adjacent heaps to reduce complexity if possible (for 2 players this makes the heap ownership alternate). Thus if the first player deletes the first heap, then the second player will not know if they can reset the position marker, unless they have the Boolean. Then there are three options: leave empty heaps and no Boolean, remove empty heaps and add Boolean, or remove empty heaps and add a phantom empty heap at the beginning. The middle option seems to be the most convenient.
    – D. G.
    Aug 3 at 15:45












up vote
1
down vote

favorite
2









up vote
1
down vote

favorite
2






2





This game is played with a sequence of heaps and a position marker, where each heap is owned by exactly one player. The game ends when a player has removed all objects from their own heaps, and this player wins with score equal to the number of remaining objects. Other players lose with score equal to minus the number of objects they still own. Play consists of players cyclically taking turns, where (for the 2-player version) they choose to either:



  • Move the position marker forward to any non-empty heap they own, and remove exactly one object from that heap.

  • Reset the position marker back to the beginning, before any heaps. (Only valid if the previous player did not reset - this ensures the game is finite.)

What is the optimal strategy for each player in the 2-player version, given an arbitrary initial state?



A state can be specified by:



  • A sequence of (size, owner) integer pairs representing the heaps

  • A non-negative integer representing the position marker (with the sequence indexed starting from one)

  • An integer representing the player about to move

  • A Boolean representing whether the previous player chose to reset


So far I have noticed the maximal score seems to eventually follow an arithmetic progression under consistent patterns of adding to the heaps. However, there is a certain region of states with more unstable behaviour. The main problem is the position marker, since without it the game would become trivial.




Update: I have generated the maximum scores for player $0$ with the initial state



$$
left( beginarrayc
!!!& 3 & & x & & 5 & & y & !\
!!!& & 6 & & 9 & & 2 & & 4 !
endarray right)_textP0, top
$$



as $x$ and $y$ range from $1$ to $11$.
contour plot of maximum scores
Solid contours represent positive score and dashed contours represent negative score. Interestingly, it can be seen that the behaviour changes only near when two heaps have the same size.



Further, I am fairly confident this maximum score formula



$$
left( beginarrayc
!!!& h_1 & & h_3 !\
!!!& & h_2 & !
endarray right)_textP0, top
,to,
left{ beginarraylrrcr
h_2 - h_1 & textif & h_2 - h_1 < 0 & textand & h_3 - h_2 + 1 ge 0 \
h_2 - h_1 + 1 & textif & h_3 - h_1 + 1 ge 0 & textand & h_2 - h_1 ge 0 \
h_3 - h_1 + 1 & textif & h_3 - h_1 + 1 < 0 & textand & h_3 - h_2 + 1 < 0
endarray right.
$$



works for all values of $h_i > 0$, and also including when $h_3 = 0$ or $h_2 = h_3 = 0$. In general I think the function would have to be piecewise linear with coefficients in $ -1, 0, +1 $ and satisfy a heap merge invariance property, meaning for example that $M(h_1, 0, h_3) = M(h_1 + h_3, 0, 0) = M(0, 0, h_1 + h_3)$.







share|cite|improve this question













This game is played with a sequence of heaps and a position marker, where each heap is owned by exactly one player. The game ends when a player has removed all objects from their own heaps, and this player wins with score equal to the number of remaining objects. Other players lose with score equal to minus the number of objects they still own. Play consists of players cyclically taking turns, where (for the 2-player version) they choose to either:



  • Move the position marker forward to any non-empty heap they own, and remove exactly one object from that heap.

  • Reset the position marker back to the beginning, before any heaps. (Only valid if the previous player did not reset - this ensures the game is finite.)

What is the optimal strategy for each player in the 2-player version, given an arbitrary initial state?



A state can be specified by:



  • A sequence of (size, owner) integer pairs representing the heaps

  • A non-negative integer representing the position marker (with the sequence indexed starting from one)

  • An integer representing the player about to move

  • A Boolean representing whether the previous player chose to reset


So far I have noticed the maximal score seems to eventually follow an arithmetic progression under consistent patterns of adding to the heaps. However, there is a certain region of states with more unstable behaviour. The main problem is the position marker, since without it the game would become trivial.




Update: I have generated the maximum scores for player $0$ with the initial state



$$
left( beginarrayc
!!!& 3 & & x & & 5 & & y & !\
!!!& & 6 & & 9 & & 2 & & 4 !
endarray right)_textP0, top
$$



as $x$ and $y$ range from $1$ to $11$.
contour plot of maximum scores
Solid contours represent positive score and dashed contours represent negative score. Interestingly, it can be seen that the behaviour changes only near when two heaps have the same size.



Further, I am fairly confident this maximum score formula



$$
left( beginarrayc
!!!& h_1 & & h_3 !\
!!!& & h_2 & !
endarray right)_textP0, top
,to,
left{ beginarraylrrcr
h_2 - h_1 & textif & h_2 - h_1 < 0 & textand & h_3 - h_2 + 1 ge 0 \
h_2 - h_1 + 1 & textif & h_3 - h_1 + 1 ge 0 & textand & h_2 - h_1 ge 0 \
h_3 - h_1 + 1 & textif & h_3 - h_1 + 1 < 0 & textand & h_3 - h_2 + 1 < 0
endarray right.
$$



works for all values of $h_i > 0$, and also including when $h_3 = 0$ or $h_2 = h_3 = 0$. In general I think the function would have to be piecewise linear with coefficients in $ -1, 0, +1 $ and satisfy a heap merge invariance property, meaning for example that $M(h_1, 0, h_3) = M(h_1 + h_3, 0, 0) = M(0, 0, h_1 + h_3)$.









share|cite|improve this question












share|cite|improve this question




share|cite|improve this question








edited yesterday
























asked Aug 3 at 9:28









D. G.

484




484











  • what is the meaning of "optimal strategy" when there are more than two players ?
    – mercio
    Aug 3 at 10:52










  • @mercio Sorry, I meant optimal strategy for two players. What are the options for more than two players? For a given player, it could be to maximise their score if a win is guaranteed, otherwise minimise the variance among the players' scores.
    – D. G.
    Aug 3 at 11:11










  • By the way, the final Boolean in your state seems a bit redundant, since during play the position marker is before any heaps iff the previous player reset it. Or do you want to allow your arbitrary starting position to be inconsistent in this respect, so that a starting position may or may not allow a reset move regardless of the starting location of the marker?
    – Jaap Scherphuis
    Aug 3 at 13:24










  • @JaapScherphuis Yes it annoys me, but here is why I have left it there: 1) the special case exists either way, so may as well make it explicit; 2) it is only a Boolean in the 2-player case, in the n-player generalisation it can take on n values; and...
    – D. G.
    Aug 3 at 15:22










  • @JaapScherphuis 3) Whenever there is an empty heap, I delete it and merge the adjacent heaps to reduce complexity if possible (for 2 players this makes the heap ownership alternate). Thus if the first player deletes the first heap, then the second player will not know if they can reset the position marker, unless they have the Boolean. Then there are three options: leave empty heaps and no Boolean, remove empty heaps and add Boolean, or remove empty heaps and add a phantom empty heap at the beginning. The middle option seems to be the most convenient.
    – D. G.
    Aug 3 at 15:45
















  • what is the meaning of "optimal strategy" when there are more than two players ?
    – mercio
    Aug 3 at 10:52










  • @mercio Sorry, I meant optimal strategy for two players. What are the options for more than two players? For a given player, it could be to maximise their score if a win is guaranteed, otherwise minimise the variance among the players' scores.
    – D. G.
    Aug 3 at 11:11










  • By the way, the final Boolean in your state seems a bit redundant, since during play the position marker is before any heaps iff the previous player reset it. Or do you want to allow your arbitrary starting position to be inconsistent in this respect, so that a starting position may or may not allow a reset move regardless of the starting location of the marker?
    – Jaap Scherphuis
    Aug 3 at 13:24










  • @JaapScherphuis Yes it annoys me, but here is why I have left it there: 1) the special case exists either way, so may as well make it explicit; 2) it is only a Boolean in the 2-player case, in the n-player generalisation it can take on n values; and...
    – D. G.
    Aug 3 at 15:22










  • @JaapScherphuis 3) Whenever there is an empty heap, I delete it and merge the adjacent heaps to reduce complexity if possible (for 2 players this makes the heap ownership alternate). Thus if the first player deletes the first heap, then the second player will not know if they can reset the position marker, unless they have the Boolean. Then there are three options: leave empty heaps and no Boolean, remove empty heaps and add Boolean, or remove empty heaps and add a phantom empty heap at the beginning. The middle option seems to be the most convenient.
    – D. G.
    Aug 3 at 15:45















what is the meaning of "optimal strategy" when there are more than two players ?
– mercio
Aug 3 at 10:52




what is the meaning of "optimal strategy" when there are more than two players ?
– mercio
Aug 3 at 10:52












@mercio Sorry, I meant optimal strategy for two players. What are the options for more than two players? For a given player, it could be to maximise their score if a win is guaranteed, otherwise minimise the variance among the players' scores.
– D. G.
Aug 3 at 11:11




@mercio Sorry, I meant optimal strategy for two players. What are the options for more than two players? For a given player, it could be to maximise their score if a win is guaranteed, otherwise minimise the variance among the players' scores.
– D. G.
Aug 3 at 11:11












By the way, the final Boolean in your state seems a bit redundant, since during play the position marker is before any heaps iff the previous player reset it. Or do you want to allow your arbitrary starting position to be inconsistent in this respect, so that a starting position may or may not allow a reset move regardless of the starting location of the marker?
– Jaap Scherphuis
Aug 3 at 13:24




By the way, the final Boolean in your state seems a bit redundant, since during play the position marker is before any heaps iff the previous player reset it. Or do you want to allow your arbitrary starting position to be inconsistent in this respect, so that a starting position may or may not allow a reset move regardless of the starting location of the marker?
– Jaap Scherphuis
Aug 3 at 13:24












@JaapScherphuis Yes it annoys me, but here is why I have left it there: 1) the special case exists either way, so may as well make it explicit; 2) it is only a Boolean in the 2-player case, in the n-player generalisation it can take on n values; and...
– D. G.
Aug 3 at 15:22




@JaapScherphuis Yes it annoys me, but here is why I have left it there: 1) the special case exists either way, so may as well make it explicit; 2) it is only a Boolean in the 2-player case, in the n-player generalisation it can take on n values; and...
– D. G.
Aug 3 at 15:22












@JaapScherphuis 3) Whenever there is an empty heap, I delete it and merge the adjacent heaps to reduce complexity if possible (for 2 players this makes the heap ownership alternate). Thus if the first player deletes the first heap, then the second player will not know if they can reset the position marker, unless they have the Boolean. Then there are three options: leave empty heaps and no Boolean, remove empty heaps and add Boolean, or remove empty heaps and add a phantom empty heap at the beginning. The middle option seems to be the most convenient.
– D. G.
Aug 3 at 15:45




@JaapScherphuis 3) Whenever there is an empty heap, I delete it and merge the adjacent heaps to reduce complexity if possible (for 2 players this makes the heap ownership alternate). Thus if the first player deletes the first heap, then the second player will not know if they can reset the position marker, unless they have the Boolean. Then there are three options: leave empty heaps and no Boolean, remove empty heaps and add Boolean, or remove empty heaps and add a phantom empty heap at the beginning. The middle option seems to be the most convenient.
– D. G.
Aug 3 at 15:45















active

oldest

votes











Your Answer




StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
);
);
, "mathjax-editing");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "69"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2870904%2fcyclic-partisan-nim-variant%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2870904%2fcyclic-partisan-nim-variant%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

What is the equation of a 3D cone with generalised tilt?

Color the edges and diagonals of a regular polygon

Relationship between determinant of matrix and determinant of adjoint?