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

Test – winning condition III

Now that horizontal and vertical lines are covered, we should move our attention to diagonal combinations:

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

The player wins when the whole diagonal line from the top-left to bottom-right is occupied by his pieces.
主站蜘蛛池模板: 邳州市| 大新县| 施甸县| 绥阳县| 文成县| 济源市| 巧家县| 乡城县| 鄂伦春自治旗| 子洲县| 南汇区| 汉沽区| 珠海市| 云龙县| 镇巴县| 新晃| 孟州市| 苏尼特右旗| 揭西县| 深圳市| 南澳县| 桃园市| 新河县| 杨浦区| 房山区| 宜良县| 五家渠市| 四平市| 博野县| 廊坊市| 云和县| 古交市| 中牟县| 水城县| 介休市| 安宁市| 喀什市| 潞西市| 河西区| 芜湖市| 楚雄市|