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

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.
主站蜘蛛池模板: 阜阳市| 双牌县| 淳安县| 资溪县| 高邑县| 彭山县| 长乐市| 仪陇县| 分宜县| 裕民县| 望江县| 宁明县| 历史| 瑞金市| 洛川县| 鹤岗市| 德昌县| 澎湖县| 闸北区| 明水县| 祁阳县| 德化县| 吉水县| 屯门区| 鄱阳县| 清徐县| 上杭县| 封丘县| 靖州| 正安县| 沁水县| 长岛县| 东辽县| 惠来县| 文昌市| 昌都县| 安福县| 新泰市| 法库县| 自治县| 含山县|