Browse Source

Add hard ramped

Kirk Trombley 3 years ago
parent
commit
9cf4a94efd

+ 3 - 2
client/src/components/screens/Lobby/Lobby.jsx

@@ -16,6 +16,7 @@ import {
   HARD,
   NIGHTMARE,
   RAMP,
+  RAMP_HARD,
 } from "../../../domain/constants";
 
 export const GameInfo = () => {
@@ -60,7 +61,7 @@ export const GameInfo = () => {
           you will get 0 points for the wrong country!
         </span>
       )}
-      {scoreMethod === HARD && (
+      {(scoreMethod === HARD || scoreMethod === RAMP_HARD) && (
         <span className={styles.label}>
           This is hard mode - scoring is very punishing!
         </span>
@@ -70,7 +71,7 @@ export const GameInfo = () => {
           You&apos;re playing on nightmare mode what is wrong with you
         </span>
       )}
-      {scoreMethod === RAMP && (
+      {(scoreMethod === RAMP || scoreMethod === RAMP_HARD) && (
         <span className={styles.label}>
           Each round will have a score multiplier, 0.5 higher than the previous
           (1x, 1.5x, 2x, ...)

+ 4 - 0
client/src/components/util/GameCreationForm/GameCreationForm.jsx

@@ -13,6 +13,7 @@ import {
   URBAN,
   NIGHTMARE,
   RAMP,
+  RAMP_HARD,
 } from "../../../domain/constants";
 import useCountryLookup from "../../../hooks/useCountryLookup";
 import Loading from "../Loading";
@@ -276,6 +277,9 @@ const GameCreationForm = ({ afterCreate, lastSettings = null }) => {
             <Item value={HARD} display="😬">
               Hard Mode
             </Item>
+            <Item value={RAMP_HARD} display="🧀">
+              Ramping Hard Mode
+            </Item>
             <Item value={NIGHTMARE} display="💀">
               Nightmare Mode
             </Item>

+ 1 - 0
client/src/domain/constants.js

@@ -20,3 +20,4 @@ export const DISTANCE = "DISTANCE";
 export const HARD = "HARD";
 export const NIGHTMARE = "NIGHTMARE";
 export const RAMP = "RAMP";
+export const RAMP_HARD = "RAMP_HARD";

+ 3 - 0
server/app/api/game.py

@@ -159,6 +159,9 @@ async def submit_guess(round_number: conint(gt=0),
         case ScoreMethodEnum.ramp:
             score, distance = scoring.score((target.latitude, target.longitude), (guess.lat, guess.lng))
             score *= 1 + ((round_number - 1) * 0.5)
+        case ScoreMethodEnum.ramp_hard:
+            score, distance = scoring.score_hard((target.latitude, target.longitude), (guess.lat, guess.lng))
+            score *= 1 + ((round_number - 1) * 0.5)
         case _:
             score, distance = scoring.score((target.latitude, target.longitude), (guess.lat, guess.lng))
     

+ 1 - 0
server/app/schemas.py

@@ -30,6 +30,7 @@ class ScoreMethodEnum(str, Enum):
     hard = "HARD"
     nightmare = "NIGHTMARE"
     ramp = "RAMP"
+    ramp_hard = "RAMP_HARD"
 
 
 class GameConfig(CamelModel):