- Test-Driven Java Development(Second Edition)
- Alex Garcia Viktor Farcic
- 74字
- 2021-06-24 18:31:55
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.
推薦閱讀
- 機器學習系統:設計和實現
- Learning Chef
- Java高并發核心編程(卷2):多線程、鎖、JMM、JUC、高并發設計模式
- MySQL數據庫基礎實例教程(微課版)
- Android Native Development Kit Cookbook
- Spring Boot進階:原理、實戰與面試題分析
- 0 bug:C/C++商用工程之道
- Unity 3D/2D移動開發實戰教程
- C#程序設計(項目教學版)
- Visual Basic 6.0程序設計實驗教程
- 計算機應用技能實訓教程
- 零基礎輕松學C++:青少年趣味編程(全彩版)
- 精通Spring:Java Web開發與Spring Boot高級功能
- 3ds Max 2018從入門到精通
- jQuery Mobile Web Development Essentials(Second Edition)