jcplayerai.java

来自「这是自己在学习编写下象棋时参考过的很好的程序。」· Java 代码 · 共 50 行

JAVA
50
字号
/************************************************************************** * * jcPlayerAI.java - Interface to a computer player * by Fran鏾is Dominic Laram閑 * * Purpose: This object allows a computer player to play JavaChess.  Its only * real job is to query an AI Search Agent for his move. * * History: * 11.06.00 Creation * 07.08.00 Association with the search agent * **************************************************************************/package javachess;import javachess.jcAISearchAgent;public class jcPlayerAI extends jcPlayer{  /************************************************************************   * DATA MEMBERS   ***********************************************************************/  // The search agent in charge of the moves  jcAISearchAgent Agent;  /***********************************************************************   * PUBLIC METHODS   **********************************************************************/  // Constructor  public jcPlayerAI( int whichPlayer, int whichType, jcOpeningBook ref )  {    this.SetSide( whichPlayer );    Agent = jcAISearchAgent.MakeNewAgent( whichType, ref );  }  // Attach a search agent to the AI player  public boolean AttachSearchAgent( jcAISearchAgent theAgent )  {    Agent = theAgent;    return true;  }  // Getting a move from the machine  public jcMove GetMove( jcBoard theBoard )  {    return( Agent.PickBestMove( theBoard ) );  }}

⌨️ 快捷键说明

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