public boolean launchOneGame(boolean visualisation) {
    GameStateWritable state = new GameStateWritable(maze);
    Game game = new Game(state);

    ArrayList<Path> pacmans_paths = choosePaths();

    for (Path p : pacmans_paths) {
      System.out.println(p);
      game.addPacmanAgent(new Agent_FollowPath(p));
    }

    for (int i = 0; i < state.getNumberOfGhosts(); i++)
      game.addGhostAgent(new IntelligentGhost_Agent1());

    if (visualisation) {
      GamePanel panel = new GamePanel(state);
      game.addObserver(panel);
      JFrame frame = new JFrame("FrameDemo");
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setPreferredSize(new Dimension(640, 480));
      frame.add(panel);
      frame.pack();
      frame.setVisible(true);
      GameState fstate = game.runUntilEnd(100);

      return (!fstate.isLose());
    } else {
      GameState fstate = game.runUntilEnd(0);
      return (!fstate.isLose());
    }
  }
 public boolean isFinalState(GameState s) {
   Maze m = s.getMaze();
   for (int x = 0; x < m.getSizeX(); x++)
     for (int y = 0; y < m.getSizeY(); y++) {
       if (m.isFood(x, y)) return (false);
     }
   return (true);
 }