/// <summary> /// 恢复某一走法恢复棋盘 /// </summary> /// <param name="move">走法</param> /// <param name="nChessID">棋子类型</param> protected void UnMakeMove(GlobalConst._chessMove move, byte nChessID) { //将目标位置的棋子移回原位 CurPosition[move.From.x, move.From.z] = CurPosition[move.To.x, move.To.z]; //恢复目标位置的原有棋子 CurPosition[move.To.x, move.To.z] = nChessID; }
/// <summary> /// 取给定走法的历史得分 /// </summary> /// <param name="move">走法</param> /// <returns>历史得分</returns> public int GetHistoryScore(GlobalConst._chessMove move) { int nFrom, nTo; nFrom = move.From.z * 9 + move.From.x; //原始位置 nTo = move.From.z * 9 + move.To.x; //目标位置 return(m_HistoryTable[nFrom, nTo]); //返回历史得分 }
/// <summary> /// 将最佳走法汇入历史记录 /// </summary> /// <param name="move">走法</param> /// <param name="depth">深度</param> public void EnterHistoryScore(GlobalConst._chessMove move, int depth) { int nFrom, nTo; nFrom = move.From.z * 9 + move.From.x; //原始位置 nTo = move.From.z * 9 + move.To.x; //目标位置 m_HistoryTable[nFrom, nTo] += 2 << depth; //增量为2的depth次方 }
/// <summary> /// 根据走法产生走之后的棋盘 /// </summary> /// <param name="move">走法</param> /// <returns>棋子ID</returns> protected byte MakeMove(GlobalConst._chessMove move) { byte nChessID; nChessID = CurPosition[move.To.x, move.To.z];//取目标位置的棋子 //把棋子移动到目标位置 CurPosition[move.To.x, move.To.z] = CurPosition[move.From.x, move.From.z]; //将原来的位置置空 CurPosition[move.From.x, move.From.z] = GlobalConst.NOCHESS; //返回被吃掉的棋子 return(nChessID); }
public static GlobalConst._chessMove[] GetChildMoveList(int depth) { GlobalConst._chessMove[] m_childMoveList = new GlobalConst._chessMove[80]; if (m_nMoveCount > 0) { for (int i = 0; i < 80; i++) { m_childMoveList[i] = m_MoveList[depth, i]; } } return(m_childMoveList); }