(board: ATreeTicTacToeSign[][])
| 116 | } |
| 117 | |
| 118 | private playTicTacToe_evaluateBoard(board: ATreeTicTacToeSign[][]): number{ |
| 119 | // The score |
| 120 | var score: number = 0; |
| 121 | |
| 122 | // Evaluate all the lines |
| 123 | score += this.playTicTacToe_evaluateLine(board, 1, 1, 2, 1, 3, 1); // First column |
| 124 | score += this.playTicTacToe_evaluateLine(board, 1, 2, 2, 2, 3, 2); // Second column |
| 125 | score += this.playTicTacToe_evaluateLine(board, 1, 3, 2, 3, 3, 3); // Third column |
| 126 | score += this.playTicTacToe_evaluateLine(board, 1, 1, 1, 2, 1, 3); // First row |
| 127 | score += this.playTicTacToe_evaluateLine(board, 2, 1, 2, 2, 2, 3); // Second row |
| 128 | score += this.playTicTacToe_evaluateLine(board, 3, 1, 3, 2, 3, 3); // Third row |
| 129 | score += this.playTicTacToe_evaluateLine(board, 1, 1, 2, 2, 3, 3); // Diagonal |
| 130 | score += this.playTicTacToe_evaluateLine(board, 1, 3, 2, 2, 3, 1); // The other diagonal |
| 131 | |
| 132 | // Return the score |
| 133 | return score; |
| 134 | } |
| 135 | |
| 136 | private playTicTacToe_evaluateLine(board: ATreeTicTacToeSign[][], row1: number, col1: number, row2: number, col2: number, row3: number, col3: number): number{ |
| 137 | // The score |
no test coverage detected