Commit 05aa3058 authored by Joseph Walton-Rivers's avatar Joseph Walton-Rivers 🐦

add gameover callback

parent 216bd4c6
Pipeline #2275 passed with stages
in 5 minutes and 24 seconds
......@@ -238,6 +238,12 @@ public class GameRunner {
}
}
}
// tell players about the end of the game
for (Player player : players) {
player.onGameOver();
}
return new GameStats(gameID, players.length, state.getScore(), state.getLives(), moves, state.getInfomation(), strikes);
} catch (Exception ex) {
logger.error("the game went bang", ex);
......
......@@ -36,6 +36,7 @@ public interface Agent {
default void receiveID(int agentID, String[] names) {
receiveID(agentID);
}
default void onGameOver(int agentID, GameState state){ }
@Deprecated
default void receiveID(int agentID) {
......
......@@ -88,6 +88,11 @@ public class AgentPlayer implements Player {
policy.receiveID(id, names);
}
@Override
public void onGameOver() {
policy.onGameOver(playerID, state.getCopy());
}
@Override
public String getName() {
return name;
......
package com.fossgalaxy.games.fireworks.players;
import com.fossgalaxy.games.fireworks.state.GameState;
import com.fossgalaxy.games.fireworks.state.GameType;
import com.fossgalaxy.games.fireworks.state.actions.Action;
import com.fossgalaxy.games.fireworks.state.events.GameEvent;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment