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

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.
主站蜘蛛池模板: 交城县| 朝阳县| 宜昌市| 绍兴县| 梓潼县| 福鼎市| 两当县| 泰宁县| 南雄市| 平武县| 维西| 乌拉特后旗| 宣威市| 山东省| 拜泉县| 灌南县| 罗江县| 大埔县| 平远县| 汉川市| 宣城市| 永定县| 霍邱县| 南丹县| 和田市| 吉安市| 铅山县| 昌平区| 华蓥市| 定襄县| 三明市| 达州市| 从江县| 横山县| 施甸县| 临泽县| 道真| 莲花县| 清苑县| 陵川县| 巴马|