Add resign button
This commit is contained in:
parent
10a4bd64d2
commit
3093754bd4
6 changed files with 79 additions and 28 deletions
|
|
@ -76,6 +76,12 @@ export class GomokuGame {
|
|||
return { success: true };
|
||||
}
|
||||
|
||||
public resign(resigningPlayerColor: PlayerColor) {
|
||||
this.winnerColor = resigningPlayerColor === 'white' ? 'black' : 'white';
|
||||
this.status = 'finished';
|
||||
this.currentPlayerColor = null;
|
||||
}
|
||||
|
||||
private checkWin(row: number, col: number, color: PlayerColor): boolean {
|
||||
const directions = [
|
||||
[1, 0], // vertical
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue