From f1a5a777abb681842c9a304c9419979122e9cd37 Mon Sep 17 00:00:00 2001 From: Jonas Date: Thu, 20 Mar 2025 14:05:16 +0100 Subject: [PATCH] added puzzlebox --- puzzlebox.html | 330 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 330 insertions(+) create mode 100644 puzzlebox.html diff --git a/puzzlebox.html b/puzzlebox.html new file mode 100644 index 0000000..d8e6e5b --- /dev/null +++ b/puzzlebox.html @@ -0,0 +1,330 @@ + + + + + + Code Puzzlebox + + + +
+

CODE PUZZLEBOX

+

Welcome to the Code Puzzlebox! Solve each puzzle to unlock the next level. Can you make it to the end?

+ +
+
+
+
+ +
+ +
+
+

Puzzle 1: Pattern Recognition

+ Level 1/5 +
+

Find the next number in this sequence:

+ 2, 4, 8, 16, 32, ? +
+ + +
+

+
Need a hint?
+
Think about what operation is being performed from one number to the next.
+
+ + +
+
+

Puzzle 2: Fix the Code

+ Level 2/5 +
+

This JavaScript function should return the factorial of a number, but it has a bug. Fix the code:

+ function factorial(n) { + if (n === 0) return 1; + return n - factorial(n - 1); +} +

What is the correct operator to replace the "-" in the return statement?

+
+ + +
+

+
Need a hint?
+
The factorial of a number is the product of all positive integers less than or equal to that number.
+
+ + +
+
+

Puzzle 3: Decode the Message

+ Level 3/5 +
+

This encoded message contains a password. Decode it by shifting each letter backward by 3 positions in the alphabet:

+ frgh_flskhu +
+ + +
+

+
Need a hint?
+
This is a Caesar cipher. For example, 'd' shifted backwards by 3 becomes 'a'.
+
+ + +
+
+

Puzzle 4: Logic Gate

+ Level 4/5 +
+

What is the output of this logic expression?

+ let a = true; +let b = false; +let c = true; +let result = (a && b) || (c && !b); +
+ + +
+

+
Need a hint?
+
Break it down step by step: First evaluate (a && b), then (c && !b), then combine with OR.
+
+ + +
+
+

Puzzle 5: Complete the Code

+ Level 5/5 +
+

This code should check if a string is a palindrome (reads the same forward and backward). What's the missing line?

+ function isPalindrome(str) { + // Normalize the string: lowercase and remove non-alphanumeric + str = str.toLowerCase().replace(/[^a-z0-9]/g, ''); + + // MISSING LINE HERE + + // Compare the original with its reverse + return str === reversed; +} +

What should the missing line be to create the reversed string?

+
+ + +
+

+
Need a hint?
+
You need to create a variable called 'reversed' that holds the string in reverse order. In JavaScript, one way to reverse a string is to split it into an array, reverse the array, then join it back.
+
+
+ +
+

🎉 Puzzlebox Solved! 🎉

+

Congratulations! You've solved all the puzzles and unlocked the code puzzlebox.

+

Secret Code: CODEMASTER2025

+

Feel free to inspect the source code to see how this puzzlebox was built!

+
+ + + + \ No newline at end of file