public Move[] ComputerMove(Board board) { Move[] moves = new Move[Globals.numMoves]; ArrayList possible = board.GetPossibleMoves(this); int currentBestVal = int.MaxValue; Move currentBestMove = (Move)possible[0]; int value; foreach (Move n in possible) { if (n.shoot) { continue; } Coord transform = board.MoveToTransform(n); value = ControlPointEvalFunction(Coord.Add(transform, location), board.controlLocations); if (value < currentBestVal) { currentBestMove = n; currentBestVal = value; } } //only works for one move! moves[0] = currentBestMove.Clone(); moves[0].player = this; program = moves; return(moves); }
public Node MakeMoveWithRandomRound(Move m) { Move[] round = GetRandomMoves(); round[playerNumber] = m.Clone(); Board nextBoard = board.Clone(); nextBoard.ExecuteMoves(round); Node nextNode = new Node(nextBoard, this); return(nextNode); }