- 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.
推薦閱讀
- AngularJS入門與進階
- Python for Secret Agents:Volume II
- 實用防銹油配方與制備200例
- 程序員考試案例梳理、真題透解與強化訓練
- Flux Architecture
- Microsoft System Center Orchestrator 2012 R2 Essentials
- Elasticsearch Server(Third Edition)
- Bootstrap 4 Cookbook
- 圖數據庫實戰
- C語言程序設計習題與實驗指導
- Oracle Data Guard 11gR2 Administration Beginner's Guide
- C++程序設計
- Learning Image Processing with OpenCV
- SEO教程:搜索引擎優化入門與進階(第3版)
- 從零開始構建深度前饋神經網絡:Python+TensorFlow 2.x