官术网_书友最值得收藏!

Test – winning condition III

Now that horizontal and vertical lines are covered, we should move our attention to diagonal combinations:

@Test 
public void whenPlayAndTopBottomDiagonalLineThenWinner() {
  ticTacToe.play(1, 1); // X
  ticTacToe.play(1, 2); // O
  ticTacToe.play(2, 2); // X
  ticTacToe.play(1, 3); // O
  String actual = ticTacToe.play(3, 3); // X
  assertEquals("X is the winner", actual);
}

The player wins when the whole diagonal line from the top-left to bottom-right is occupied by his pieces.
主站蜘蛛池模板: 类乌齐县| 溆浦县| 南汇区| 凌云县| 宜君县| 岳池县| 沭阳县| 隆化县| 陆河县| 哈巴河县| 和田县| 旌德县| 云龙县| 云浮市| 洪雅县| 巴林右旗| 宜阳县| 元氏县| 蒙自县| 宜章县| 盖州市| 双牌县| 邵阳市| 台南县| 红安县| 洛南县| 朝阳县| 自治县| 黄冈市| 贵溪市| 象山县| 谷城县| 略阳县| 育儿| 嘉定区| 中阳县| 分宜县| 汶川县| 曲松县| 合水县| 交城县|