Commit 366ba91e authored by Terence Martin's avatar Terence Martin

Clean up pushed ball marking

Now that we know the dropping of balls works for removing balls from
the two player arrays, remove the debug logging.

This was particulary annoying in that it would warn about pushing a
ball not in one of those arrays when the final ball drops were going
on.
parent c3da8655
......@@ -571,21 +571,18 @@ var nurdz;
* @param {Ball} ball the ball to remove
*/
MazeContents.prototype.markBallPlayed = function (ball) {
// Try it first as a player ball.
var index = this._playerBalls.indexOf(ball);
if (index != -1) {
console.log("Marking a player ball as played");
if (index != -1)
this._playerBalls[index] = null;
return;
}
index = this._computerBalls.indexOf(ball);
if (index != -1) {
console.log("Marking a computer ball as played");
this._computerBalls[index] = null;
return;
else {
index = this._computerBalls.indexOf(ball);
if (index != -1)
this._computerBalls[index] = null;
}
// Theoretically this can only happen when the debug code inserts a
// ball into the top row that the generator did not insert there.
console.log("Played a ball that is not in either of the two ball arrays");
// The code can get here if the debug code starts a ball moving or
// during the final ball drop, where this method gets called but
// the ball pushed is not contained in either of the arrays.
};
/**
* Replace the top row contents of the maze with the list of balls that
......
......@@ -478,25 +478,20 @@ module nurdz.game
*/
markBallPlayed (ball : Ball) : void
{
// Try it first as a player ball.
let index = this._playerBalls.indexOf (ball);
if (index != -1)
{
console.log("Marking a player ball as played");
this._playerBalls[index] = null;
return;
}
index = this._computerBalls.indexOf (ball)
if (index != -1)
else
{
console.log("Marking a computer ball as played");
this._computerBalls[index] = null;
return;
index = this._computerBalls.indexOf (ball)
if (index != -1)
this._computerBalls[index] = null;
}
// Theoretically this can only happen when the debug code inserts a
// ball into the top row that the generator did not insert there.
console.log("Played a ball that is not in either of the two ball arrays");
// The code can get here if the debug code starts a ball moving or
// during the final ball drop, where this method gets called but
// the ball pushed is not contained in either of the arrays.
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment