public override AIDecision RequestMove(AiGameInformation gameInformation) { var moves = gameInformation.GameTree.PrimaryMoveTimeline.ToList(); if (moves.Any() && moves.Last().Kind == MoveKind.Pass) { return(AIDecision.MakeMove(Move.Pass(gameInformation.AIColor), "You passed, too!")); } JokerGame currentGame = new JokerGame(gameInformation.GameInfo.BoardSize.Height, gameInformation.GameInfo.BoardSize.Width, null, null); foreach (Move move in gameInformation.GameTree.PrimaryMoveTimeline) { currentGame.moves.AddLast(new JokerMove(move.WhoMoves == StoneColor.Black ? 'B' : 'W', new JokerPoint(move.Coordinates.X, move.Coordinates.Y))); } currentGame.board = JokerExtensionMethods.OurBoardToJokerBoard(GetLastNodeOrEmptyBoard(gameInformation.GameTree).BoardState, gameInformation.GameInfo.BoardSize); JokerPoint point = new AlphaBetaPlayer(gameInformation.AIColor == StoneColor.Black ? 'B' : 'W').betterPlanMove(currentGame, this.TreeDepth); return(AIDecision.MakeMove(Move.PlaceStone(gameInformation.AIColor, new Position(point.x, point.y)), "I chose using the minimax algorithm and heuristics.")); }
public override AIDecision RequestMove(AiGameInformation gameInformation) { RandomPlayer internalPlayer = new RandomPlayer(gameInformation.AIColor == StoneColor.Black ? 'B' : 'W'); char[,] board = JokerExtensionMethods.OurBoardToJokerBoard(GetLastNodeOrEmptyBoard(gameInformation.GameTree).BoardState, gameInformation.GameInfo.BoardSize); JokerPoint point = internalPlayer.makeMove(board, gameInformation.GameInfo.BoardSize.Width, gameInformation.GameInfo.BoardSize.Height); return(AIDecision.MakeMove(Move.PlaceStone(gameInformation.AIColor, new Position(point.x, point.y)), "I chose at random.")); }