Create a dedicated draw
method
This commit is contained in:
parent
6faeae8b66
commit
63bfb5375e
|
@ -53,6 +53,14 @@ export class Game
|
|||
* Initializes the game.
|
||||
*/
|
||||
initialize()
|
||||
{
|
||||
this.draw();
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces the content of the board with the current state.
|
||||
*/
|
||||
draw()
|
||||
{
|
||||
let board = document.getElementById(this.id);
|
||||
board.innerHTML = "";
|
||||
|
@ -86,7 +94,7 @@ export class Game
|
|||
{
|
||||
this.board[i][j] = this.state.currentPlayer;
|
||||
this.state.turnCount++;
|
||||
this.initialize();
|
||||
this.draw();
|
||||
};
|
||||
|
||||
board.appendChild(field);
|
||||
|
|
Loading…
Reference in a new issue