Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions frontend/src/ts/test/funbox/funbox-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,18 +318,32 @@ const list: Partial<Record<FunboxName, FunboxFunctions>> = {
},
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 += (word[i] as string).toUpperCase();
randomCaseWord += letter.toLowerCase();
}
}
return randomcaseword;

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 {
spongeCaseWord += word[i]?.toUpperCase();
}
}

return spongeCaseWord;
},
},
rot13: {
Expand Down
4 changes: 2 additions & 2 deletions frontend/static/challenges/_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -613,8 +613,8 @@
}
},
{
"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],
Expand Down
10 changes: 9 additions & 1 deletion packages/funbox/src/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,21 @@ const list: Record<FunboxName, FunboxMetadata> = {
name: "arrows",
},
rAnDoMcAsE: {
description: "I kInDa LiKe HoW iNeFfIcIeNt QwErTy Is.",
description: "i KINda LikE HoW inEFFICIeNt QwErtY Is.",
canGetPb: false,
difficultyLevel: 2,
properties: ["changesCapitalisation"],
frontendFunctions: ["alterText"],
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.",
canGetPb: false,
Expand Down
1 change: 1 addition & 0 deletions packages/schemas/src/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ export const FunboxNameSchema = z.enum([
"choo_choo",
"arrows",
"rAnDoMcAsE",
"sPoNgEcAsE",
"capitals",
"layout_mirror",
"layoutfluid",
Expand Down