Package cs227b.teamIago.util

Examples of cs227b.teamIago.util.GameState


      exps[i] = new Predicate("true", new Expression[] {e});
    }
    // add to theory and extract the GameState
    Theory t = new Theory(true, false);
    t.setState(new ExpList(exps));
    GameState gs = t.getState();
    return gs;
  }
View Full Code Here


    moves = new ExpList();
  }
 
  public GameState getState() {
    if (memoTrans && storeTrans)
      return new GameState(trans,provenTrans,disprovenTrans);
    else return new GameState(trans);
  }
View Full Code Here

    int offset;
    String axiomFile, stateFile, movesFile;
    GameSimulator myGGP;
    boolean wantDebugPrintouts;
    ExpList movesList, roles, legalMoves, goalValues;
    GameState nextState;

    wantDebugPrintouts = false;
    offset = 0;
    if (args.length % 3 == 1)
    {
      wantDebugPrintouts = true;
      offset = 1;
    }

    if (args.length >= 3) maxIndex = args.length / 3;
    else {
      System.err.println("Expected arguments: [debug] axiom file, state file, move file");
      System.exit(-1);
      return;
    }


    for (int testfile = 1; testfile <=  maxIndex ; testfile++)
    {

        boolean useOptimization = true;
    myGGP = new GameSimulator(wantDebugPrintouts, useOptimization);

    System.out.println("**************** Game " + testfile + " *****************");

    if (args.length > 3*testfile - 1 + offset)
    {
      axiomFile = args[3*(testfile-1) + 0 + offset];
      stateFile = args[3*(testfile-1) + 1 + offset];
      movesFile = args[3*(testfile-1) + 2 + offset];
    }
    else return;

    myGGP.ParseFileIntoTheory(axiomFile);
    myGGP.ParseFileIntoTheory(stateFile);

    movesList = Parser.parseFile(movesFile);


    // Get all the available roles
    roles = myGGP.GetRoles();

    if (roles == null) {
        System.out.println("No playable roles found: aborting.");
      System.exit(-1);
    }

    int i;
    for (i = 0; i < roles.size(); i++)
    {

      Expression player = roles.get(i);

      System.out.println("Player " + player.toString());
      legalMoves =  myGGP.GetLegalMoves(player);
      if (legalMoves == null)
        System.out.println("No legal moves found.");
      else
        System.out.println("Legal moves: " + legalMoves.toString());

      goalValues = myGGP.GetGoalValues(player);
      if (goalValues == null)
        System.out.println("No goal values found.");
      else
        System.out.println("Goal values: " +
        goalValues.toString());
    }

    if (myGGP.IsTerminal()) {
      System.out.println("Game is in terminal state.");
      System.out.println("(Not calculating next state.)");
    }
    else
    {
      System.out.println("Game is in non-terminal state.");

      GameState oldState;
      oldState = myGGP.GetGameState();
      myGGP.SimulateStep(movesList);

      nextState = myGGP.GetGameState();
      if (nextState == null)
View Full Code Here

TOP

Related Classes of cs227b.teamIago.util.GameState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.