• Terence Martin's avatar
    Replace ball swapping with direct dropping · 1fffad2a
    Terence Martin authored
    Originally, the MazeContent class would store an array that contained
    the balls left to be played for both the human and computer player
    along with a variable that indicated which of the two were currently
    visible in the maze. We would then save the balls from the maze into
    one array and restore from the other.
    
    This actually causes a problem in that this gets the balls in the
    array out of sync with reality if you don't swap right away.
    
    For example, if the computer pushes a ball, then we check to see if
    the human can play a ball and cannot (all blocked), then we check to
    see if the computer can play to see if they can take another turn,
    since we did not save the ball state and the check happens from the
    array, it thinks it can play the ball it just played.
    
    If that ball is the only ball that can be played, this gets us into
    a situation where there is actually no move to be made.
    
    Now we instead just restore from an array to the maze, and every time
    a ball drops we check to see if it was in one of the arrays and remove
    it from there, thus always keeping everything in sync.
    1fffad2a
Name
Last commit
Last update
bootstrap Loading commit data...
css Loading commit data...
images Loading commit data...
js Loading commit data...
tools Loading commit data...
ts Loading commit data...
.gitignore Loading commit data...
LICENSE Loading commit data...
README.md Loading commit data...
devember-2016.sublime-project Loading commit data...
index.html Loading commit data...