Hole03 - #1
Conversation
|
Remplacer les nombres de "TileAt" par des constantes nommées "NUMBER_ROW" ou "NUMBER_COLUMN" (ex : FIRST_ROW ou FIRST_COLUMN) |
|
Créer une constante EMPTY_SYMBOL pour stocker le char ' ' |
|
Créer la constante PLAYER_O pour stocker le char 'O' |
| if (this._lastSymbol == ' ') { | ||
| //if player is X | ||
| if (symbol == 'O') { | ||
| if (player == 'O') { |
There was a problem hiding this comment.
Passer le 'O' dans une constante nommée PLAYER_O
| } | ||
|
|
||
| private validateFirstMove(player: string) { | ||
| if (this._lastSymbol == ' ') { |
There was a problem hiding this comment.
Passer le ' ' dans une constante nommée EMPTY_SYMBOL
| } | ||
|
|
||
| private validatePositionIsEmpty(x: number, y: number) { | ||
| if (this._board.TileAt(x, y).Symbol != ' ') { |
There was a problem hiding this comment.
Passer le ' ' dans une constante nommée emptySymbol
| return this._toto.TileAt(0, 0)!.Symbol; | ||
| } | ||
| if (this.isFirstRowFull() && this.isFirstRowFullWithSameSymbol()) { | ||
| return this._board.TileAt(0, 0)!.Symbol; |
There was a problem hiding this comment.
return this._board.TileAt(FIRST_ROW, FIRST_COLUMN)!.Symbol;
| return this._toto.TileAt(1, 0)!.Symbol; | ||
| } | ||
| if (this.isSecondRowFull() && this.isSecondRowFullWithSameSymbol()) { | ||
| return this._board.TileAt(1, 0)!.Symbol; |
There was a problem hiding this comment.
return this._board.TileAt(SECOND_ROW, FIRST_COLUMN)!.Symbol;
| return this._toto.TileAt(2, 0)!.Symbol; | ||
| } | ||
| if (this.isThirdRowFull() && this.isThirdRowFullWithSameSymbol()) { | ||
| return this._board.TileAt(2, 0)!.Symbol; |
There was a problem hiding this comment.
return this._board.TileAt(THIRD_ROW, FIRST_COLUMN)!.Symbol;
| return ( | ||
| this._board.TileAt(0, 0)!.Symbol != ' ' && | ||
| this._board.TileAt(0, 1)!.Symbol != ' ' && | ||
| this._board.TileAt(0, 2)!.Symbol != ' ' |
There was a problem hiding this comment.
this._board.TileAt(FIRST_ROW, FIRST_COLUMN)!.Symbol != EMPTY_SYMBOL &&
this._board.TileAt(FIRST_ROW, SECOND_COLUMN)!.Symbol != EMPTY_SYMBOL &&
this._board.TileAt(FIRST_ROW, THIRD_COLUMN)!.Symbol != EMPTY_SYMBOL
| } | ||
|
|
||
| private validatePositionIsEmpty(x: number, y: number) { | ||
| if (this._board.TileAt(x, y).Symbol != ' ') { |
There was a problem hiding this comment.
Remplacer ' ' par la constante emptySymbol créé précédemment
No description provided.