Note that there are some explanatory texts on larger screens.

plurals
  1. POFind an algorithm to balance this game
    text
    copied!<p>I've tried to extract just the part of the problem where I'm having trouble, this is part of a bigger project that I'm doing (not homework). I think it's easiest to describe it as a game (since I need it to finish a game I'm working on). This is a one player game the way I'm describing it.</p> <p><strong>START</strong> You start with one of two positions:</p> <ul> <li>weight <code>(2,0,-1)</code> and one <code>red</code> play</li> <li>weight <code>(3,1,-1)</code> and two <code>red</code> plays</li> </ul> <p><strong>END</strong> The game ends when you have no more plays. The goal is to end the game with weight <code>(0,0,0)</code>.</p> <p>There are two types of plays <code>red</code> and <code>blue</code>. Given a play, you choose one of four pieces: <code>A,B,C,D</code> that give you additional weight and possibly additional plays. Here are the rules:</p> <ul> <li><p>On a <code>red</code> play:</p> <ul> <li>A adds weight <code>(0,-2,-1)</code></li> <li>B adds weight <code>(1,-1,-1)</code> and adds one <code>red</code> play</li> <li>C adds weight <code>(2,0,-1)</code> and two <code>red</code> plays</li> <li>D adds weight <code>(0,2,1)</code> and two <code>blue</code> plays</li> </ul></li> </ul> <p>The rules for <code>blue</code> plays are similar but the first two columns for weights are swapped and the last column is reverse and the types of plays are reversed, so you get this instead:</p> <ul> <li><p>On a <code>blue</code> play:</p> <ul> <li>A adds weight <code>(-2,0,1)</code></li> <li>B adds weight <code>(-1,1,1)</code> and adds one <code>blue</code> play</li> <li>C adds weight <code>(0,2,1)</code> and two <code>blue</code> plays</li> <li>D adds weight <code>(2,0,-1)</code> and two <code>red</code> plays</li> </ul></li> </ul> <p><strong>QUESTION</strong> Can this game be won?</p> <p>I'm trying to write a program that wins the game by choosing plays so that the final balance is <code>(0,0,0)</code> when you have no more plays. Only I can't seem to do it. So now I think that maybe there is no algorithm to win the game. I'd really like to know why that is. If anyone has any ideas how I can prove that, then please let me know!! Or, if you try it and find a way to win, then please tell me that, too. Thanks!!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload