Clean up testing
[troll.git] / src / main / java / com / codingame / game / LeagueManager.java
1 package com.codingame.game;
2
3 import com.codingame.gameengine.core.MultiplayerGameManager;
4 import com.codingame.gameengine.core.AbstractMultiplayerPlayer;
5 import com.google.inject.Inject;
6 import com.google.inject.Singleton;
7
8 @Singleton
9 class LeagueManager {
10     enum CheatLevel {
11         ALLOWED,
12         TOLERATED,
13         FORBIDDEN
14     }
15     CheatLevel cheatLevel;
16
17     enum MapLevel {
18         SINGLE,
19         DISCRETE,
20         CONTINUOUS
21     }
22     MapLevel mapLevel;
23
24     @Inject
25     LeagueManager(MultiplayerGameManager<AbstractMultiplayerPlayer> gameManager)
26     {
27         int level = gameManager.getLeagueLevel();
28         if (level < 1 || level > 3) {
29             throw new InternalError("This game does not implement level " + level);
30         }
31
32         cheatLevel = level <= 1 ? CheatLevel.ALLOWED
33                    : level <= 2 ? CheatLevel.TOLERATED
34                    : CheatLevel.FORBIDDEN;
35
36         mapLevel = level <= 1 ? MapLevel.SINGLE
37                  : level <= 2 ? MapLevel.DISCRETE
38                  : MapLevel.CONTINUOUS;
39
40     }    
41 }