- Test-Driven Java Development(Second Edition)
- Alex Garcia Viktor Farcic
- 71字
- 2021-06-24 18:31:55
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.
推薦閱讀
- Qt 5 and OpenCV 4 Computer Vision Projects
- 自制編譯器
- Hands-On Data Structures and Algorithms with JavaScript
- Mastering Scientific Computing with R
- 飛槳PaddlePaddle深度學習實戰
- Python時間序列預測
- Python編程:從入門到實踐
- Test-Driven JavaScript Development
- Arduino Wearable Projects
- Magento 2 Beginners Guide
- 算法超簡單:趣味游戲帶你輕松入門與實踐
- Visual C++程序設計全程指南
- 高質量程序設計指南:C++/C語言
- Analytics for the Internet of Things(IoT)
- Django 2.0 入門與實踐