Example #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");
        }
Example #2
0
 public static bool ClosestDistance(PaperSoccerState state, int depth, bool playerNorth, out double util)
 {
     throw new System.NotImplementedException();
 }
Example #3
0
 public static bool RandomHeuristic(PaperSoccerState state, int depth, bool playerNorth, out double util)
 {
     util = new Random().NextDouble();
     return(depth == 2);
 }
Example #4
0
 public static bool NoHeuristic(PaperSoccerState state, int depth, bool playerNorth, out double util)
 {
     util = 0;
     return(false);
 }