oxogame.java
来自「This the OXO example code plus the prese」· Java 代码 · 共 52 行
JAVA
52 行
/** * Contains the key elements for playing a game of noughts and crosses . * * @author Ian Bradley * @version 1.0 March 2008 */public class OXOGame{ // instance variables - replace the example below with your own private Board board; private String turn; private User user; private ComputerPlayer computer; /** * Constructor for objects of class OXOGame * */ public OXOGame() { board = new Board(); computer = new ComputerPlayer(board, "X"); user = new User(board, "O"); } public void userUpdate(int square) { user.move(square); } public Coord computerUpdate() { return computer.move(); } public boolean checkForWin() { return board.checkWin(); } public boolean checkForSpace() { return board.stillSpace(); } }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?