Esempio n. 1
0
  public void statusReport(PrintWriter writer) {

    // Game has ended and graph shut down
    if (gameOverRequest != null) {
      if (gameStartRequest != null) {
        writer.print("[GAME START]: " + gameStartRequest + "\n");
      }

      for (GameRequest request : turnRequests) {
        writer.print("[TURN " + request.getCurrentTurn() + "]: " + request.getStates() + "\n");
      }
      writer.print("[GAME OVER]: " + gameOverRequest.getStates() + "\n");
    } else {
      for (Node node : gameState.getNodesSortedById()) {
        writer.print("Node " + node.getNodeId() + "\n");
        writer.print("  type: " + node.getNodeType() + "\n");
        writer.print("  vp worth: " + node.getVictoryPointWorth() + "\n");
        writer.print("  solders per turn: " + node.getSoldiersGrantedPerTurn() + "\n");
        writer.print("  owner: " + node.getOwner() + "\n");
        writer.print("  soldiers present: " + node.getNumberOfSolders() + "\n");
        writer.print("  inbound neighbouring nodes:  ");
        for (Node neighbour : node.getInboundNeighbours()) {
          writer.print(neighbour.getNodeId() + " ");
        }
        writer.print("\n");
        writer.print("  outbound neighbouring nodes: ");
        for (Node neighbour : node.getOutboundNeighbours()) {
          writer.print(neighbour.getNodeId() + " ");
        }
        writer.print("\n");
      }
    }
  }
Esempio n. 2
0
  public GameResponse turn(GameRequest gameRequest) {
    logger.info("Turn {} of {}", gameRequest.getCurrentTurn(), gameRequest.getMaximumTurns());
    turnRequests.add(gameRequest);

    gameState.updateState(gameRequest.getStates());
    strategy.move();

    return gameState.getMoves();
  }
Esempio n. 3
0
 public void gameOver(GameRequest gameRequest) {
   gameOverRequest = gameRequest;
   gameState.gameOver(gameRequest.getStates());
   logger.info("Game over");
 }