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)