}
// same-typed positional parameters… a disaster waiting to happen
- void gameInit(int roadLength, int initialStones, long seed) {
- sendInputLine(String.format("%d %d %d %d 0",
+ void gameInit(int roadLength, int initialStones, long seed, long salt) {
+ sendInputLine(String.format("%d %d %d %d %d",
roadLength, initialStones, seed,
- model.getMultiplier()));
+ model.getMultiplier(), salt));
}
void sendGameTurn() {
catch (NoSuchElementException e) { type = Action.Invalid; return; }
s.useDelimiter(eol);
- if (s.hasNext(rest)) messageString = s.next(rest);
+ if (s.hasNext(rest)) messageString = s.next(rest).trim();
else messageString = "";
type = Action.Throw;
}
import com.codingame.gameengine.core.AbstractReferee;
import com.codingame.gameengine.core.GameManager;
import com.codingame.gameengine.core.MultiplayerGameManager;
-import com.codingame.gameengine.module.entities.GraphicEntityModule;
-import com.codingame.gameengine.module.entities.Rectangle;
-import com.codingame.gameengine.module.entities.Sprite;
-import com.codingame.gameengine.module.entities.Text;
-import com.codingame.gameengine.module.entities.Curve;
+import com.codingame.game.GodModeManager;
import com.google.inject.Inject;
import com.google.inject.Provider;
public class Referee extends AbstractReferee {
@Inject private MultiplayerGameManager<Player> gameManager;
- @Inject private GraphicEntityModule graphicEntityModule;
+ @Inject private GodModeManager gm;
@Inject private View view;
@Inject private Model model;
@Override
public void init() {
+ gm.init();
model.init(gameManager.getSeed());
gameManager.getPlayer(0).model = model.p0;
gameManager.getPlayer(1).model = model.p1;
for (Player p: gameManager.getPlayers()) {
p.gameInit(model.roadLength, model.initialStones,
- gameManager.getSeed());
+ gameManager.getSeed(), gm.getSalt());
}
view.init(model);
* least.
*/
for (Player player : gameManager.getActivePlayers()) {
- player.receiveGameTurn();
+ player.receiveGameTurn(); gm.transcend(player);
switch (player.type) {
case Timeout:
disqualify(player, "T/O", "timed out!");
* exhaustion).
*/
int delta = 0;
+ gm.update(gameManager.getPlayers());
for (Player player : gameManager.getActivePlayers()) {
player.view.throwStones(player.stoneThrow);
delta += player.model.getMultiplier() * player.stoneThrow;