Skip to content

Commit

Permalink
Rename game modes to be shorter and more recognisable (closes #107)
Browse files Browse the repository at this point in the history
  • Loading branch information
SSoelvsten committed May 25, 2024
1 parent b4a133c commit 4b30315
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion game/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const App = () => {
if (ls_res) { return ls_res as Difficulty; }

// Otherwise, just leave it unchecked
return Difficulty.UNLIMITED_TIME;
return Difficulty.UNLIMITED;
}
);

Expand Down
38 changes: 19 additions & 19 deletions game/src/difficulty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import './language';
import { Language } from './language';

export enum Difficulty {
UNLIMITED_TIME = "UNLIMITED",
TIMED = "TIMED",
TIME_SPRINT = "TIME SPRINT"
UNLIMITED = "UNLIMITED",
TIMED = "TIMED",
BLITZ = "BLITZ"
}

export const Difficulties : Difficulty[] = [
Difficulty.UNLIMITED_TIME,
Difficulty.UNLIMITED,
Difficulty.TIMED,
Difficulty.TIME_SPRINT,
Difficulty.BLITZ,
];

export interface DifficultyLogic {
Expand All @@ -23,7 +23,7 @@ export const GetDifficultyLogic = (d: Difficulty, numberOfChars: number) : Diffi
const totalTime = Math.max(minimumTime, numberOfChars * 1000)

switch (d) {
case Difficulty.UNLIMITED_TIME:
case Difficulty.UNLIMITED:
return {
initialTime: Infinity,
addTime: (word_length: number) => 0
Expand All @@ -33,7 +33,7 @@ export const GetDifficultyLogic = (d: Difficulty, numberOfChars: number) : Diffi
initialTime: totalTime,
addTime: (word_length: number) => 0
};
case Difficulty.TIME_SPRINT:
case Difficulty.BLITZ:
const initialTime = Math.max(30 * 1000 /* 30s */,
totalTime / 7);
const timePerChar = (totalTime-initialTime) / numberOfChars;
Expand All @@ -51,30 +51,30 @@ export const DifficultyName = (d: Difficulty, l: Language | undefined) : string
switch(l) {
case Language.DK:
switch (d) {
case Difficulty.UNLIMITED_TIME: return "Uendelig Tid";
case Difficulty.TIMED: return "Tid";
case Difficulty.TIME_SPRINT: return "Tidsspurt";
case Difficulty.UNLIMITED: return "Ubegrænset";
case Difficulty.TIMED: return "Tid";
case Difficulty.BLITZ: return "Lyn";
}
break;
case Language.DE:
switch (d) {
case Difficulty.UNLIMITED_TIME: return "Unbeschränkte Zeit";
case Difficulty.TIMED: return "Zeit";
case Difficulty.TIME_SPRINT: return "Zeit-Sprint";
case Difficulty.UNLIMITED: return "Unbegrenzt";
case Difficulty.TIMED: return "Zeit";
case Difficulty.BLITZ: return "Blitz";
}
break;
case Language.EN:
switch (d) {
case Difficulty.UNLIMITED_TIME: return "Unlimited Time";
case Difficulty.TIMED: return "Timed";
case Difficulty.TIME_SPRINT: return "Time Sprint";
case Difficulty.UNLIMITED: return "Unlimited";
case Difficulty.TIMED: return "Timed";
case Difficulty.BLITZ: return "Blitz";
}
break;
case Language.ES:
switch (d) {
case Difficulty.UNLIMITED_TIME: return "Ilimitado";
case Difficulty.TIMED: return "Contrarreloj";
case Difficulty.TIME_SPRINT: return "Relámpago";
case Difficulty.UNLIMITED: return "Ilimitado";
case Difficulty.TIMED: return "Contrarreloj";
case Difficulty.BLITZ: return "Relámpago";
}
break;
default:
Expand Down

0 comments on commit 4b30315

Please sign in to comment.