예제 #1
0
        public static void RunGame(int width, int height, int goalWidth, Heuristic <PaperSoccerState> playerA, Heuristic <PaperSoccerState> playerB)
        {
            var  state        = new PaperSoccerState(width, height, goalWidth);
            var  searchA      = new AlphaBetaSearch <PaperSoccerState, PaperSoccerAction>(playerA, true);
            var  searchB      = new AlphaBetaSearch <PaperSoccerState, PaperSoccerAction>(playerB, false);
            bool currentMoveA = true;

            while (!state.IsFinished(out double playerAUtility, true))
            {
                var action = currentMoveA ? searchA.GetMove(state) : searchB.GetMove(state);
                state.ApplyMove(action);
                currentMoveA = !currentMoveA;
            }
            state.SaveBoardImage("Plansza.png");
        }
예제 #2
0
 public static bool ClosestDistance(PaperSoccerState state, int depth, bool playerNorth, out double util)
 {
     throw new System.NotImplementedException();
 }
예제 #3
0
 public static bool RandomHeuristic(PaperSoccerState state, int depth, bool playerNorth, out double util)
 {
     util = new Random().NextDouble();
     return(depth == 2);
 }
예제 #4
0
 public static bool NoHeuristic(PaperSoccerState state, int depth, bool playerNorth, out double util)
 {
     util = 0;
     return(false);
 }