/* * @topic W120141 Java <a href="http://www.c-jump.com/bcc/c123c/c123sample/Java/Week11/tic_tac_toe_class_violet.html" target="_blank">Tic-Tac-Toe Game</a> * @brief class PlayerAI extends Player */ package tictactoeapp; public class PlayerAI extends Player { // constants public static final int STRATEGY_RANDOM = 1; public static final int STRATEGY_DEFENCE = 2; public static final int STRATEGY_WINNING = 3; // data attributes Strategy strategy = null; // constructors public PlayerAI( String nickname, int piece, int strat, Board board ) { super( nickname, piece ); switch ( strat ) { case STRATEGY_RANDOM: strategy = new StrategyRandom( board ); break; case STRATEGY_DEFENCE: case STRATEGY_WINNING: default: System.out.println( "Sorry, this strategy is not implented! Exiting!"); System.exit(1); break; } } // operations @Override public void move() { strategy.nextMove(getPiece()); } }//class PlayerAI