computerplayer.java

来自「This the OXO example code plus the prese」· Java 代码 · 共 35 行

JAVA
35
字号
/** * Represents the basic computer player. *  * @author Ian Braldey  * @version 1.0 March 2008 */public class ComputerPlayer{     Board board;     String playPiece;    /**     * Constructor for objects of class ComputerPlayer     */    public ComputerPlayer(Board board, String playPiece)    {        this.board = board;        this.playPiece = playPiece;    }    /**     * The player's move.     * Assumes there is still a space on the board.     *      * @return coord of cell used     */    public Coord move()    {        Coord coord = board.getFirstEmptyCell();        board.setCell( coord, playPiece);        return coord;    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?