X-Git-Url: https://troll.desast.re/troll.git/blobdiff_plain/21357ae2173926ec1eb908517ab7b1b3e9175ee5..2018da9d1e712501823609f2b0d932aa364d11d3:/src/main/java/com/codingame/game/LeagueManager.java diff --git a/src/main/java/com/codingame/game/LeagueManager.java b/src/main/java/com/codingame/game/LeagueManager.java index ed7d455..fe2187c 100644 --- a/src/main/java/com/codingame/game/LeagueManager.java +++ b/src/main/java/com/codingame/game/LeagueManager.java @@ -12,12 +12,30 @@ class LeagueManager { TOLERATED, FORBIDDEN } - CheatLevel cheatLevel; + enum MapLevel { + SINGLE, + DISCRETE, + CONTINUOUS + } + MapLevel mapLevel; + @Inject LeagueManager(MultiplayerGameManager gameManager) { - cheatLevel = CheatLevel.FORBIDDEN; + int level = gameManager.getLeagueLevel(); + if (level < 1 || level > 3) { + throw new InternalError("This game does not implement level " + level); + } + + cheatLevel = level <= 1 ? CheatLevel.ALLOWED + : level <= 2 ? CheatLevel.TOLERATED + : CheatLevel.FORBIDDEN; + + mapLevel = level <= 1 ? MapLevel.SINGLE + : level <= 2 ? MapLevel.DISCRETE + : MapLevel.CONTINUOUS; + } }