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

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.
主站蜘蛛池模板: 绥阳县| 城步| 黄梅县| 鹤峰县| 奎屯市| 正镶白旗| 绥棱县| 成武县| 正镶白旗| 四川省| 大埔县| 彝良县| 同心县| 贵德县| 松溪县| 汾西县| 长宁县| 津南区| 承德市| 泗阳县| 安顺市| 宁强县| 行唐县| 常山县| 通城县| 宁河县| 虎林市| 永和县| 平定县| 望江县| 阜平县| 读书| 柯坪县| 札达县| 南汇区| 东辽县| 剑河县| 梁平县| 赞皇县| 渑池县| 十堰市|