Beispiel #1
0
        public static GameState nextState(ForwardModel forwardModel, GameState game,
            Input p1move, Input p2move, int nSteps = 1)
        {
            GameState lastState = game;

            int intermediateSteps = 1; // set to match a reasonable Gameloop#humanInputDelayFrames() value...
            for (int i = 0; i < intermediateSteps; i++) {
                lastState = forwardModel.nextState(lastState, p1move, p2move, nSteps);
            }

            return lastState;
        }
 public CombinedAi(GameState state)
 {
     this.heuristic = new CombinedHeuristic (state);
     this.forwardModel = new ForwardModel(state);
     this.allPaths = new TreeDictionary<double, StateNode> ();
 }
Beispiel #3
0
 public AI(GameState state, PlayerId pId, Heuristic heuristic)
 {
     this.pId = pId;
     this.forwardModel = new ForwardModel(state);
     this.heuristic = heuristic;
 }
Beispiel #4
0
        protected void Initialize(GameState level)
        {
            state = level;

            //            state = level.Clone(p1: new Player (1, new Vector2 (90, 36)),
            //                                p2: new Player (2, new Vector2 (90, 45)));

            forwardModel = new ForwardModel (state);

            history = new List<GameState> ();

            //            ai1 = new NullAI (state, PlayerId.P1);
            ai1 = new AStar (state, PlayerId.P1, new WaypointHeuristic (state, PlayerId.P1));
            ai2 = new AStar (state, PlayerId.P2, new WaypointHeuristic (state, PlayerId.P2));

            //            listInputMethod = new ListAiInput (ai1, ai2, state);
            //            inputMethod = new SynchronizedAiInput (ai1, ai2, state);
            //            inputMethod = new HalfHumanAiInput (ai2, state);
            combinedInputMethod = new CombinedAiInput (state);
            humanInputMethod = new HumanInput (state, combinedInputMethod);

            //            inputMethod = humanInputMethod;
            inputMethod = combinedInputMethod;

            CombinedPlatformAStar cpas = new CombinedPlatformAStar (level.Platforms);
            cpas.CombinedPlatformPath (level.P1, level.P2, level.Goal, level.Goal);
            //            Environment.Exit (1);
        }