Only allow moves if there is no winner
This commit is contained in:
parent
de2884c16d
commit
05c935d3fa
|
@ -257,12 +257,15 @@ export class Game
|
||||||
*/
|
*/
|
||||||
addChip(x, y)
|
addChip(x, y)
|
||||||
{
|
{
|
||||||
for (let i = Game.#height - 1; i >= 0; i--)
|
if (!this.winner)
|
||||||
{
|
{
|
||||||
if (this.board[i][x] === "")
|
for (let i = Game.#height - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
this.board[i][x] = this.state.currentPlayer;
|
if (this.board[i][x] === "")
|
||||||
return true;
|
{
|
||||||
|
this.board[i][x] = this.state.currentPlayer;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue