Created
August 5, 2020 18:31
-
-
Save parzibyte/8125eacb537b60c49bc5e1238240fb3d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async makeMove(columnNumber) { | |
const columnIndex = columnNumber - 1; | |
const firstEmptyRow = this.getFirstEmptyRow(columnIndex, this.board); | |
if (firstEmptyRow === -1) { | |
Swal.fire('Cannot put here, it is full'); | |
return; | |
} | |
Vue.set(this.board[firstEmptyRow], columnIndex, this.currentPlayer); | |
const status = await this.checkGameStatus(); | |
if (!status) { | |
this.togglePlayer(); | |
this.makeCpuMove(); | |
} else { | |
this.askUserForAnotherMatch(); | |
} | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment