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

Test – winning condition I

Now that we have declared what the default response is (No winner), it's time to start working on different winning conditions:

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

The player wins when the whole horizontal line is occupied by his pieces.
主站蜘蛛池模板: 怀宁县| 岳阳市| 双柏县| 留坝县| 吉首市| 无棣县| 石家庄市| 屏东县| 伊通| 鹤壁市| 房产| 津市市| 宜君县| 慈溪市| 永登县| 柏乡县| 大厂| 喀喇沁旗| 西林县| 高陵县| 长顺县| 阿巴嘎旗| 衡阳县| 天等县| 仪陇县| 镇平县| 旺苍县| 达孜县| 奇台县| 定西市| 蓬溪县| 正定县| 武安市| 榆中县| 黎平县| 石屏县| 汕头市| 南乐县| 庄河市| 托里县| 永泰县|