public void runGame() { SwingUtilities.invokeLater(a); try { sleep(delay); } catch (InterruptedException e) { System.out.println("interrupted."); } while (!world.endGame()) { // System.out.println("Game playing. Making move."); int action1 = -1; int action2 = -1; action1 = policy1.getBestAction(world.getState1()); action2 = policy2.getBestAction(world.getState2()); System.out.println("action2 " + action2); SwingUtilities.invokeLater(a); try { sleep(delay); } catch (InterruptedException e) { System.out.println("interrupted."); } } a.agentsScore += world.agent1Score; a.catScore += world.fail; // turn off gameOn flag if only single game if (single) gameOn = false; }
public void runGame() { while (!world.endGame()) { // System.out.println("Game playing. Making move."); int action = -1; if (mousetype == GREEDY) { action = world.mouseAction(); } else if (mousetype == SMART) { action = policy.getBestAction(world.getState()); } else { System.err.println("Invalid mouse type:" + mousetype); } world.getNextState(action); // a.updateBoard(); try { sleep(delay); } catch (InterruptedException e) { System.out.println("interrupted."); } } // turn off gameOn flag if only single game if (single) gameOn = false; }