From 90aab4dfe9590c5cb83fd0b80a3424f0cd5072e7 Mon Sep 17 00:00:00 2001 From: Justiniscoding Date: Sun, 28 Dec 2025 13:21:15 -0500 Subject: [PATCH 1/6] Add new sPoNgECaSe mode and modify raNDOMcASe --- .../src/ts/test/funbox/funbox-functions.ts | 34 +++++++++++++------ frontend/static/challenges/_list.json | 8 ++--- frontend/static/challenges/sourcecode.txt | 14 ++++---- packages/funbox/src/list.ts | 14 ++++++-- packages/schemas/src/configs.ts | 3 +- 5 files changed, 48 insertions(+), 25 deletions(-) diff --git a/frontend/src/ts/test/funbox/funbox-functions.ts b/frontend/src/ts/test/funbox/funbox-functions.ts index 4810b36fbc74..4aadacec7cc2 100644 --- a/frontend/src/ts/test/funbox/funbox-functions.ts +++ b/frontend/src/ts/test/funbox/funbox-functions.ts @@ -316,20 +316,34 @@ const list: Partial> = { return retval; }, }, - rAnDoMcAsE: { + raNDOmcASe: { alterText(word: string): string { - let randomcaseword = word[0] as string; - for (let i = 1; i < word.length; i++) { - if ( - randomcaseword[i - 1] === - (randomcaseword[i - 1] as string).toUpperCase() - ) { - randomcaseword += (word[i] as string).toLowerCase(); + let randomCaseWord = ""; + + for (let letter of word) { + if (Math.random() > 0.5) { + randomCaseWord += letter.toUpperCase(); + } else { + randomCaseWord += letter.toLowerCase(); + } + } + + return randomCaseWord; + }, + }, + sPoNgEcAsE: { + alterText(word: string): string { + let spongeCaseWord = ""; + + for (let i = 0; i < word.length; i++) { + if (i % 2 === 0) { + spongeCaseWord += word[i]?.toLowerCase(); } else { - randomcaseword += (word[i] as string).toUpperCase(); + spongeCaseWord += word[i]?.toUpperCase(); } } - return randomcaseword; + + return spongeCaseWord; }, }, rot13: { diff --git a/frontend/static/challenges/_list.json b/frontend/static/challenges/_list.json index 73564f3036f9..4215e8ee1fc6 100644 --- a/frontend/static/challenges/_list.json +++ b/frontend/static/challenges/_list.json @@ -613,11 +613,11 @@ } }, { - "name": "iKiNdAlIkEhOwInEfFiCiEnTqWeRtYiS", - "display": "I kInDa LiKe HoW iNeFfIcIeNt QwErTy Is", + "name": "iKINdaLikEHoWinEFFICIeNtQwErtYIs.", + "display": "i KINda LikE HoW inEFFICIeNt QwErtY Is.", "autoRole": true, "type": "funbox", - "parameters": [["rAnDoMcAsE"], "time", 3600], + "parameters": [["raNDOmcASe"], "time", 3600], "requirements": { "wpm": { "min": 100 @@ -626,7 +626,7 @@ "min": 60 }, "funbox": { - "exact": ["rAnDoMcAsE"] + "exact": ["raNDOmcASe"] } } }, diff --git a/frontend/static/challenges/sourcecode.txt b/frontend/static/challenges/sourcecode.txt index 02e1bff1d65c..56d400e7d4b6 100644 --- a/frontend/static/challenges/sourcecode.txt +++ b/frontend/static/challenges/sourcecode.txt @@ -23222,16 +23222,16 @@ async function getNextWord(wordset, language, wordsBound) { randomWord = randomWord.replace(/ +/gm, " "); randomWord = randomWord.replace(/^ | $/gm, ""); - if (Config.funbox === "rAnDoMcAsE") { - let randomcaseword = ""; - for (let i = 0; i < randomWord.length; i++) { - if (i % 2 != 0) { - randomcaseword += randomWord[i].toUpperCase(); + if (Config.funbox === "raNDOmcASe") { + let randomCaseWord = ""; + for (let letter of randomWord) { + if (Math.random() > 0.5) { + randomCaseWord += letter.toUpperCase(); } else { - randomcaseword += randomWord[i]; + randomCaseWord += letter; } } - randomWord = randomcaseword; + randomWord = randomCaseWord; } else if (Config.funbox === "capitals") { randomWord = Misc.capitalizeFirstLetter(randomWord); } else if (Config.funbox === "gibberish") { diff --git a/packages/funbox/src/list.ts b/packages/funbox/src/list.ts index bae05e7f6f77..5709eceeabbb 100644 --- a/packages/funbox/src/list.ts +++ b/packages/funbox/src/list.ts @@ -113,13 +113,21 @@ const list: Record = { ], name: "arrows", }, - rAnDoMcAsE: { - description: "I kInDa LiKe HoW iNeFfIcIeNt QwErTy Is.", + raNDOmcASe: { + description: "i KINda LikE HoW inEFFICIeNt QwErtY Is.", canGetPb: false, difficultyLevel: 2, properties: ["changesCapitalisation"], frontendFunctions: ["alterText"], - name: "rAnDoMcAsE", + name: "raNDOmcASe", + }, + sPoNgEcAsE: { + description: "aLtErNaTe ThE cApItAlIzAtIoN oF eVeRy LeTtEr.", + canGetPb: false, + difficultyLevel: 2, + properties: ["changesCapitalisation"], + frontendFunctions: ["alterText"], + name: "sPoNgEcAsE", }, capitals: { description: "Capitalize Every Word.", diff --git a/packages/schemas/src/configs.ts b/packages/schemas/src/configs.ts index edfd6af29355..57a672912fef 100644 --- a/packages/schemas/src/configs.ts +++ b/packages/schemas/src/configs.ts @@ -278,7 +278,8 @@ export const FunboxNameSchema = z.enum([ "tts", "choo_choo", "arrows", - "rAnDoMcAsE", + "raNDOmcASe", + "sPoNgEcAsE", "capitals", "layout_mirror", "layoutfluid", From 16400922ef1585aadbeebd70903440ac9766b9ad Mon Sep 17 00:00:00 2001 From: Justiniscoding Date: Sun, 28 Dec 2025 13:54:50 -0500 Subject: [PATCH 2/6] Revert unnecessary change to sourcecode.txt --- frontend/static/challenges/sourcecode.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/frontend/static/challenges/sourcecode.txt b/frontend/static/challenges/sourcecode.txt index 56d400e7d4b6..02e1bff1d65c 100644 --- a/frontend/static/challenges/sourcecode.txt +++ b/frontend/static/challenges/sourcecode.txt @@ -23222,16 +23222,16 @@ async function getNextWord(wordset, language, wordsBound) { randomWord = randomWord.replace(/ +/gm, " "); randomWord = randomWord.replace(/^ | $/gm, ""); - if (Config.funbox === "raNDOmcASe") { - let randomCaseWord = ""; - for (let letter of randomWord) { - if (Math.random() > 0.5) { - randomCaseWord += letter.toUpperCase(); + if (Config.funbox === "rAnDoMcAsE") { + let randomcaseword = ""; + for (let i = 0; i < randomWord.length; i++) { + if (i % 2 != 0) { + randomcaseword += randomWord[i].toUpperCase(); } else { - randomCaseWord += letter; + randomcaseword += randomWord[i]; } } - randomWord = randomCaseWord; + randomWord = randomcaseword; } else if (Config.funbox === "capitals") { randomWord = Misc.capitalizeFirstLetter(randomWord); } else if (Config.funbox === "gibberish") { From 6023932f83f00ec4b15dd9fd2c139eb5881387ab Mon Sep 17 00:00:00 2001 From: Justiniscoding Date: Sun, 28 Dec 2025 14:08:15 -0500 Subject: [PATCH 3/6] Revert raNDOmcASe to previous name (rAnDoMcAsE) --- frontend/src/ts/test/funbox/funbox-functions.ts | 2 +- frontend/static/challenges/_list.json | 4 ++-- packages/funbox/src/list.ts | 4 ++-- packages/schemas/src/configs.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend/src/ts/test/funbox/funbox-functions.ts b/frontend/src/ts/test/funbox/funbox-functions.ts index 4aadacec7cc2..79f0878d701c 100644 --- a/frontend/src/ts/test/funbox/funbox-functions.ts +++ b/frontend/src/ts/test/funbox/funbox-functions.ts @@ -316,7 +316,7 @@ const list: Partial> = { return retval; }, }, - raNDOmcASe: { + rAnDoMcAsE: { alterText(word: string): string { let randomCaseWord = ""; diff --git a/frontend/static/challenges/_list.json b/frontend/static/challenges/_list.json index 4215e8ee1fc6..0027c784e7a4 100644 --- a/frontend/static/challenges/_list.json +++ b/frontend/static/challenges/_list.json @@ -617,7 +617,7 @@ "display": "i KINda LikE HoW inEFFICIeNt QwErtY Is.", "autoRole": true, "type": "funbox", - "parameters": [["raNDOmcASe"], "time", 3600], + "parameters": [["rAnDoMcAsE"], "time", 3600], "requirements": { "wpm": { "min": 100 @@ -626,7 +626,7 @@ "min": 60 }, "funbox": { - "exact": ["raNDOmcASe"] + "exact": ["rAnDoMcAsE"] } } }, diff --git a/packages/funbox/src/list.ts b/packages/funbox/src/list.ts index 5709eceeabbb..65e2da798afa 100644 --- a/packages/funbox/src/list.ts +++ b/packages/funbox/src/list.ts @@ -113,13 +113,13 @@ const list: Record = { ], name: "arrows", }, - raNDOmcASe: { + rAnDoMcAsE: { description: "i KINda LikE HoW inEFFICIeNt QwErtY Is.", canGetPb: false, difficultyLevel: 2, properties: ["changesCapitalisation"], frontendFunctions: ["alterText"], - name: "raNDOmcASe", + name: "rAnDoMcAsE", }, sPoNgEcAsE: { description: "aLtErNaTe ThE cApItAlIzAtIoN oF eVeRy LeTtEr.", diff --git a/packages/schemas/src/configs.ts b/packages/schemas/src/configs.ts index 57a672912fef..8cb6325887cc 100644 --- a/packages/schemas/src/configs.ts +++ b/packages/schemas/src/configs.ts @@ -278,7 +278,7 @@ export const FunboxNameSchema = z.enum([ "tts", "choo_choo", "arrows", - "raNDOmcASe", + "rAnDoMcAsE", "sPoNgEcAsE", "capitals", "layout_mirror", From ac53a6ae7b663269a2a76b0f1844e3754c2e647e Mon Sep 17 00:00:00 2001 From: Justiniscoding Date: Tue, 30 Dec 2025 11:09:08 -0500 Subject: [PATCH 4/6] fix: modify rAnDoMcAsE to avoid slight bias towards lowercase letters --- frontend/src/ts/test/funbox/funbox-functions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/ts/test/funbox/funbox-functions.ts b/frontend/src/ts/test/funbox/funbox-functions.ts index 79f0878d701c..200720604cc0 100644 --- a/frontend/src/ts/test/funbox/funbox-functions.ts +++ b/frontend/src/ts/test/funbox/funbox-functions.ts @@ -321,7 +321,7 @@ const list: Partial> = { let randomCaseWord = ""; for (let letter of word) { - if (Math.random() > 0.5) { + if (Math.random() < 0.5) { randomCaseWord += letter.toUpperCase(); } else { randomCaseWord += letter.toLowerCase(); From 16260f5f45c24cede518af1bab889e63eeb33a8b Mon Sep 17 00:00:00 2001 From: Justiniscoding Date: Mon, 5 Jan 2026 14:28:15 -0500 Subject: [PATCH 5/6] fix: change randomcase and spongecase descriptions to be more accurate --- packages/funbox/src/list.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/funbox/src/list.ts b/packages/funbox/src/list.ts index 65e2da798afa..f43ab93e8c80 100644 --- a/packages/funbox/src/list.ts +++ b/packages/funbox/src/list.ts @@ -114,7 +114,7 @@ const list: Record = { name: "arrows", }, rAnDoMcAsE: { - description: "i KINda LikE HoW inEFFICIeNt QwErtY Is.", + description: "raNdomIze ThE CApitaLizatIon Of EveRY LeTtEr.", canGetPb: false, difficultyLevel: 2, properties: ["changesCapitalisation"], @@ -122,7 +122,7 @@ const list: Record = { name: "rAnDoMcAsE", }, sPoNgEcAsE: { - description: "aLtErNaTe ThE cApItAlIzAtIoN oF eVeRy LeTtEr.", + description: "I kInDa LiKe HoW iNeFfIcIeNt QwErTy Is.", canGetPb: false, difficultyLevel: 2, properties: ["changesCapitalisation"], From 33b4ec52217c13a9f650217fd5f8e137872cefed Mon Sep 17 00:00:00 2001 From: Miodec Date: Tue, 6 Jan 2026 16:38:59 +0100 Subject: [PATCH 6/6] update challenge --- frontend/static/challenges/_list.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/static/challenges/_list.json b/frontend/static/challenges/_list.json index 0027c784e7a4..69d487158ea0 100644 --- a/frontend/static/challenges/_list.json +++ b/frontend/static/challenges/_list.json @@ -617,7 +617,7 @@ "display": "i KINda LikE HoW inEFFICIeNt QwErtY Is.", "autoRole": true, "type": "funbox", - "parameters": [["rAnDoMcAsE"], "time", 3600], + "parameters": [["sPoNgEcAsE"], "time", 3600], "requirements": { "wpm": { "min": 100 @@ -626,7 +626,7 @@ "min": 60 }, "funbox": { - "exact": ["rAnDoMcAsE"] + "exact": ["sPoNgEcAsE"] } } },