Requirement 3 – adding winning conditions
It's time to work on winning according to the rules of the game. This is the part where, when compared with the previous code, work becomes a bit more tedious. We should check all the possible winning combinations and, if one of them is fulfilled, declare a winner.
A player wins by being the first to connect a line of friendly pieces from one side or corner of the board to the other.
To check whether a line of friendly pieces is connected, we should verify horizontal, vertical, and diagonal lines.
推薦閱讀
- DBA攻堅指南:左手Oracle,右手MySQL
- JavaScript 網頁編程從入門到精通 (清華社"視頻大講堂"大系·網絡開發視頻大講堂)
- Koa開發:入門、進階與實戰
- Python王者歸來
- Python機器學習實戰
- HTML5+CSS3+JavaScript Web開發案例教程(在線實訓版)
- Java程序員面試筆試寶典(第2版)
- Mastering Akka
- Hands-On GUI Programming with C++ and Qt5
- Visual Basic程序設計基礎
- 深入理解Java虛擬機:JVM高級特性與最佳實踐
- Puppet 5 Beginner's Guide(Third Edition)
- 算法超簡單:趣味游戲帶你輕松入門與實踐
- Learning Redux
- Spring Boot 2+Thymeleaf企業應用實戰