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

Test – winning condition II

We should also check whether there is a win by filling the vertical line:

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

The player wins when the whole vertical line is occupied by his pieces.
主站蜘蛛池模板: 保德县| 竹溪县| 卓资县| 玛纳斯县| 东港市| 萝北县| 菏泽市| 都昌县| 获嘉县| 定襄县| 湟源县| 左贡县| 炉霍县| 尼玛县| 岳池县| 鲁甸县| 永城市| 敖汉旗| 武安市| 铁岭市| 中超| 拉萨市| 涪陵区| 饶河县| 思茅市| 宁都县| 奇台县| 玉林市| 靖州| 株洲县| 浦东新区| 拉萨市| 五峰| 九江县| 望都县| 北流市| 克拉玛依市| 托里县| 金湖县| 台前县| 永福县|