@@ -1148,7 +1148,7 @@ below 100 has different behavior
11481148<%-- CTUtil --%>
11491149<%!
11501150public static class CTUtil {
1151-
1151+ public static long DAY = 24 * 3600 * 1000l ;
11521152 public static JSONObject newCTRoom (int level , int cityID , JSONObject payload ) {
11531153 String roomID = " " + ThreadLocalRandom . current(). nextLong();
11541154 var newRoom = new JSONObject (8 ). put(" contestedTerritory" ,
@@ -1172,11 +1172,11 @@ public static class CTUtil {
11721172 }
11731173
11741174 private static int week (long millis ) {
1175- return (int ) ((millis / (1000 * 60 * 60 * 24 ) - 4 ) / 7 );
1175+ return (int ) ((millis / (DAY ) - 4 ) / 7 );
11761176 }
11771177
11781178 private static long endOfWeek (long roomStartTime ) {
1179- return ((week(roomStartTime) + 1L ) * 7 + 4 ) * 24 * 3600 * 1000 ;
1179+ return ((week(roomStartTime) + 1L ) * 7 + 4 ) * DAY ;
11801180 }
11811181 // for cases where bloons retook while someone was leader
11821182 // problem - what if they submitted bad scores during that time???
@@ -1189,7 +1189,7 @@ public static class CTUtil {
11891189 return time > 0 ;
11901190 }). filter(x - > ! x. equals(" " + leader)). forEach(id - > {
11911191 JSONObject score = scores. getJSONObject(" " + id);
1192- long durationWithoutCurrent = Math . min(24 * 3600 * 1000 ,
1192+ long durationWithoutCurrent = Math . min(DAY ,
11931193 Math . min(endOfWeek, now) - score. getLong(" time" )) + score. optLong(" durationWithoutCurrent" );
11941194 score. put(" durationWithoutCurrent" , durationWithoutCurrent). put(" current" , 0 ). put(" time" , 0 );
11951195 });
@@ -1232,7 +1232,7 @@ public static class CTUtil {
12321232 long durationTime = score. optLong(" durationTime" );
12331233 long duration = score. optLong(" durationWithoutCurrent" ) +
12341234 // if time > 0, you were the last leader(even though you would no longer be)
1235- (time > 0 ? (Math . min(endOfWeek, now) - Math . max( time, durationTime )) : 0 );
1235+ (time > 0 ? (Math . min(DAY , Math . min( endOfWeek, now) - time)) : 0 );
12361236 score. put(" time" , time). put(" durationTime" , durationTime). put(" duration" , duration);
12371237 }
12381238 }
@@ -1242,7 +1242,7 @@ public static class CTUtil {
12421242 long now = System . currentTimeMillis();
12431243 return scores. keySet(). stream(). filter(x - > {
12441244 long time = scores. getJSONObject(x). optLong(" time" );
1245- return time > 0 && (now - time) < 24 * 3600 * 1000 ;
1245+ return time > 0 && (now - time) < DAY ;
12461246 }). filter(x - > {
12471247 int round = scores. getJSONObject(x). optInt(" current" );
12481248 return round >= minRounds;
@@ -1255,7 +1255,7 @@ public static class CTUtil {
12551255 int score = newScore. optInt(" score" );
12561256 long time = newScore. optLong(" time" );
12571257 long now = System . currentTimeMillis();
1258- if (score < minRounds || (now - time) >= 24 * 3600 * 1000 || week(now) != week(time))
1258+ if (score < minRounds || (now - time) >= DAY || week(now) != week(time))
12591259 return false ;
12601260 int leader = findLeader(scores, minRounds);
12611261 return leader < 0 || scores. getJSONObject(" " + leader). optInt(" current" ) < score;
@@ -1264,7 +1264,7 @@ public static class CTUtil {
12641264 public static int ctMinRound (int level ) {
12651265 int tier = ctTier(level);
12661266 return
1267- // 0 == 0 ? 1 :
1267+ // 0 == 0 ? 1 :
12681268 switch (tier) {
12691269 case 1 , 2 , 3 , 4 - > 2 + tier * 4 ;
12701270 case 5 - > 22 ;
0 commit comments