Ça trolle…
/
troll.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
FIX: IT belongs in a MODEL!
[troll.git]
/
src
/
main
/
java
/
com
/
codingame
/
game
/
Model.java
diff --git
a/src/main/java/com/codingame/game/Model.java
b/src/main/java/com/codingame/game/Model.java
index
217388a
..
beff100
100644
(file)
--- a/
src/main/java/com/codingame/game/Model.java
+++ b/
src/main/java/com/codingame/game/Model.java
@@
-9,6
+9,7
@@
import com.google.inject.Inject;
class Model {
@Inject private MultiplayerGameManager<com.codingame.game.Player> gameManager;
class Model {
@Inject private MultiplayerGameManager<com.codingame.game.Player> gameManager;
+ @Inject private LeagueManager league;
long seed;
Random random;
int roadLength;
long seed;
Random random;
int roadLength;
@@
-89,22
+90,36
@@
class Model {
void init() {
seed = gameManager.getSeed();
random = new Random(seed);
void init() {
seed = gameManager.getSeed();
random = new Random(seed);
- switch (random.nextInt(4)) {
- case 0:
+
+ switch(league.mapLevel) {
+ case SINGLE:
roadLength = 6;
initialStones = 15;
break;
roadLength = 6;
initialStones = 15;
break;
- case 1:
- roadLength = 6;
- initialStones = 30;
- break;
- case 2:
- roadLength = 14;
- initialStones = 30;
+ case DISCRETE:
+ int i = random.nextInt(4);
+ switch (i) {
+ case 0:
+ roadLength = 6;
+ initialStones = 15;
+ break;
+ case 1:
+ roadLength = 6;
+ initialStones = 30;
+ break;
+ case 2:
+ roadLength = 14;
+ initialStones = 30;
+ break;
+ case 3:
+ roadLength = 14;
+ initialStones = 50;
+ break;
+ }
break;
break;
- case
3
:
- roadLength =
14
;
- initialStones =
50
;
+ case
CONTINUOUS
:
+ roadLength =
2 * (3 + random.nextInt(7-3+1))
;
+ initialStones =
15 + random.nextInt(50-15+1)
;
break;
}
break;
}
@@
-177,6
+192,14
@@
class Model {
p1.adjustScore(trollPosition);
}
p1.adjustScore(trollPosition);
}
+ boolean FIX_IT() {
+ switch (league.fixLevel) {
+ case SOMETIMES: return random.nextInt(10) > 0;
+ case NEVER: return false;
+ default: throw new JavaLimitationError();
+ }
+ }
+
private Integer winner;
boolean haveWinner() {
return winner != null;
private Integer winner;
boolean haveWinner() {
return winner != null;