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

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.
主站蜘蛛池模板: 余庆县| 丰宁| 尼玛县| 康乐县| 治多县| 荥阳市| 抚州市| 于都县| 宁城县| 碌曲县| 龙口市| 旅游| 淳化县| 克东县| 将乐县| 新平| 巨野县| 澜沧| 舒城县| 勐海县| 聂荣县| 稷山县| 青州市| 拉孜县| 明水县| 大新县| 建平县| 东源县| 肥乡县| 余干县| 德格县| 温宿县| 丰原市| 泰州市| 济源市| 鞍山市| 德庆县| 尉氏县| 大丰市| 湖南省| 新兴县|