diff --git a/pyproject.toml b/pyproject.toml index 14190d8..8cc4c25 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,3 +6,5 @@ requires-python = ">=3.10" [tool.unittest] # No special configuration needed, unittest is standard library +[tool.vercel] +entrypoint = "math.Happy-Number.Happy-Number:app" diff --git a/utilities/Caesar-cipher/caesar_ciphar.py b/utilities/Caesar-cipher/caesar_ciphar.py new file mode 100644 index 0000000..d09ab6c --- /dev/null +++ b/utilities/Caesar-cipher/caesar_ciphar.py @@ -0,0 +1,63 @@ +print("šŸ” Caesar Cipher Encoder & Decoder šŸ”") +print("Encrypt and decrypt messages using Caesar Cipher\n") + + +def encrypt(text, shift): + + result = "" + + for char in text: + + if char.isupper(): + result += chr((ord(char) - 65 + shift) % 26 + 65) + + elif char.islower(): + result += chr((ord(char) - 97 + shift) % 26 + 97) + + else: + result += char + + return result + + +def decrypt(text, shift): + + return encrypt(text, -shift) + + +while True: + + print("=" * 50) + print("šŸŽÆ Choose an option:") + print("1ļøāƒ£ Encrypt Text") + print("2ļøāƒ£ Decrypt Text") + print("3ļøāƒ£ Exit") + print("=" * 50) + + choice = input("\nāž”ļø Enter your choice (1-3): ") + + if choice == '1': + + text = input("\nšŸ“ Enter text to encrypt: ") + shift = int(input("šŸ”‘ Enter shift value: ")) + + encrypted = encrypt(text, shift) + + print(f"\nšŸ” Encrypted Text: {encrypted}\n") + + elif choice == '2': + + text = input("\nšŸ“Ø Enter text to decrypt: ") + shift = int(input("šŸ”‘ Enter shift value: ")) + + decrypted = decrypt(text, shift) + + print(f"\nšŸ“ Decrypted Text: {decrypted}\n") + + elif choice == '3': + + print("\nšŸ‘‹ Thanks for using Caesar Cipher! Goodbye!\n") + break + + else: + print("\nāŒ Invalid choice! Please select 1-3.\n") \ No newline at end of file diff --git a/web-app/assets/banners/caesar-cipher.jpg b/web-app/assets/banners/caesar-cipher.jpg new file mode 100644 index 0000000..e1d9124 Binary files /dev/null and b/web-app/assets/banners/caesar-cipher.jpg differ diff --git a/web-app/index.html b/web-app/index.html index f3a0a9a..07813e5 100644 --- a/web-app/index.html +++ b/web-app/index.html @@ -72,6 +72,219 @@ + + + + +
+
+
+
+ 2048 Game +
+

2048 Game

+

Combine tiles and reach 2048!

+
+
+ AP/GP/AGP/HP Recognizer +
+

AP/GP/AGP/HP Recognizer

+

Identify progression types from any sequence.

+
+
+ Armstrong Numbers +
+

Armstrong Numbers

+

Check special number properties!

+
+
+ BlackJack21 +
+

BlackJack21

+

Beat the dealer!

+
+
+ Calculator +
+

Calculator

+

Your mathematical companion!

+
+
+ Caesar Cipher +
+

Caesar Cipher

+

Encrypt & decrypt with a shift!

+
+
+ Coin Flip +
+

Coin Flip

+

Heads or tails with spinning animation!

+
+
+ Collatz Conjecture +
+

Collatz Conjecture

+

Explore the 3n+1 problem!

+
+
+ Color Palette Suggestor +
+

Color Palette Suggestor

+

Generate palettes + CSS snippets for any website type and mood!

+
+
+ Coordinate to Polar +
+

Coordinate to Polar

+

Transform Cartesian (x, y) into polar (r, theta).

+
+
+ Derivative Calculator +
+

Derivative Calculator

+

Compute 1st/nth polynomial derivatives and evaluate them.

+
+
+ Dice Rolling +
+

Dice Rolling

+

Roll the dice with 3D animation!

+
+
+ Dots & Boxes AI +
+

Dots & Boxes AI

+

Challenge friends or AI in this strategy game!

+
+
+ Emoji Memory Game +
+

Emoji Memory Game

+

Test your memory with matching emojis!

+
+
+ Fibonacci Series +
+

Fibonacci Series

+

Generate Fibonacci sequences!

+
+
+ FLAMES Game +
+

FLAMES Game

+

Discover your relationship status!

+
+
+ Flappy Game +
+

Flappy Game

+

Dodge the incoming balls and survive!

+
+
+ Hangman +
+

Hangman

+

Classic word-guessing game!

+
+
+ Math Quiz +
+

Math Quiz

+

MCQ quiz with lives and difficulty levels!

+
+
+ Morse Code +
+

Morse Code

+

Translate with lights & sound!

+
+
+ Number Converter +
+

Number Converter

+

Convert Dec, Bin, Oct, and Hex!

+
+
+ Number Guessing +
+

Number Guessing

+

Guess the secret number!

+
+
+ Pascal's Triangle +
+

Pascal's Triangle

+

Beautiful hexagon visualization!

+
+
+ Password Forge +
+

Password Forge

+

Survive evolving firewall password rules!

+
+
+ Prime Analyzer +
+

Prime Analyzer

+

All-in-one prime number toolkit!

+
+
+ Projectile Motion +
+

Projectile Motion

+

Calculate TOF, Hmax, and Range with physics!

+
+
+ Rock Paper Scissors +
+

Rock Paper Scissors

+

Battle against the computer!

+
+
+ Simon Says +
+

Simon Says

+

Repeat the pattern and test your memory skills!

+
+
+ Snake Game +
+

Snake Game

+

Classic snake game!

+
+
+ Tower of Hanoi +
+

Tower of Hanoi

+

Solve the classic puzzle!

+
+
+ Typing Speed Tester +
+

Typing Speed Tester

+

Test your typing skills!

+
+
+ Whack-a-Mole +
+

Whack-a-Mole

+

Hit the moles before they disappear!

+
+
+ Word Scramble +
+

Word Scramble

+

Unscramble words before attempts run out!

+
+
+ + +
+
- -
- -
- -
- Game -

BlackJack 21

-

Beat the dealer with strategy!

-
šŸƒ 52 cardsšŸŽÆ 21
-
-
- -
- Game -

Rock Paper Scissors

-

Battle against the computer!

-
āš”ļø Best of 5
-
-
- -
- Game -

Dice Rolling

-

Roll the dice with 3D animation!

-
šŸŽ² 2 dice
-
-
- -
- Game -

Coin Flip

-

Heads or tails with spinning animation!

-
šŸŖ™ 50/50
-
-
- -
- Game -

Number Guessing

-

Guess the secret number!

-
šŸŽÆ 1–100
-
-
- -
- Game -

Hangman

-

Classic word-guessing game!

-
šŸ“ 6 lives
-
-
- -
- Game -

Word Scramble

-

Unscramble words before time runs out!

-
šŸ”¤ 3 rounds
-
-
- -
- Game -

FLAMES Game

-

Discover your relationship status!

-
šŸ’– 6 outcomes
-
-
- -
- Game -

Dots & Boxes AI

-

Challenge friends or AI in strategy!

-
🧠 AI mode
-
-
- -
- Game -

Password Forge

-

Survive evolving firewall password rules!

-
šŸ” 10 levels
-
-
- -
- Game -

Math Quiz

-

MCQ quiz with lives and difficulty levels!

-
🧮 4 levels
-
-
- -
- Game -

Snake Game

-

Classic snake — eat, grow, survive!

-
šŸ ClassicšŸ† High score
-
-
- -
- Game -

Emoji Memory Game

-

Test your memory with matching emojis!

-
🧩 16 tiles
-
-
- -
- Game -

Whack-a-Mole

-

Hit the moles before they disappear!

-
šŸ”Ø 30s
-
-
- -
- Game -

Flappy Game

-

Dodge the incoming balls and survive!

-
🐤 Endless
-
-
- -
- Game -

2048 Game

-

Combine tiles and reach 2048!

-
šŸ”¢ 4Ɨ4
-
-
- -
- Game -

Tic Tac Toe

-

Classic 3-in-a-row with AI!

-
āŒ 3Ɨ3
-
- - -
- -
- Math -

Fibonacci Series

-

Generate Fibonacci sequences!

-
šŸ”¢ Spiral viz
-
-
- -
- Math -

AP/GP/AGP/HP Recognizer

-

Identify progression types from any sequence.

-
šŸ“Š 4 types
-
-
- -
- Math -

Pascal's Triangle

-

Beautiful hexagon visualization!

-
šŸ”ŗ 12 rows
-
-
- -
- Math -

Armstrong Numbers

-

Check special number properties!

-
šŸ”¢ 3 digits
-
-
- -
- Math -

Calculator

-

Your mathematical companion!

-
🧮 Full-featured
-
-
- -
- Math -

Collatz Conjecture

-

Explore the 3n+1 problem!

-
šŸ”¢ Graph viz
-
-
- -
- Math -

Prime Analyzer

-

All-in-one prime number toolkit!

-
šŸ”¢ Factorizer
-
-
- -
- Math -

Projectile Motion

-

Calculate TOF, Hmax, Range!

-
šŸš€ Physics
-
-
- -
- Math -

Coordinate to Polar

-

Transform Cartesian (x, y) into polar (r, Īø).

-
šŸ“ Geometry
-
-
- -
- Math -

Derivative Calculator

-

Compute 1st/nth polynomial derivatives.

-
šŸ“ˆ Calculus
-
- - -
- -
- Utility -

Morse Code

-

Translate with lights & sound!

-
šŸ“” Audio
-
-
- -
- Utility -

Tower of Hanoi

-

Solve the classic puzzle!

-
šŸ—¼ 3 pegs
-
-
- -
- Utility -

Number Converter

-

Convert Dec, Bin, Oct, and Hex!

-
šŸ”¢ 4 bases
-
-
- -
- Utility -

Typing Speed Tester

-

Test your WPM and accuracy!

-
āŒØļø WPM
-
-
- -
- Utility -

Color Palette Suggestor

-

Generate palettes + CSS snippets for any mood!

-
šŸŽØ CSS ready
-
-
- -
- Utility -

Productivity Pet

-

A virtual pet that grows as you work!

-
🐾 Pomodoro
-
-
- - @@ -737,6 +673,8 @@

Legal

+ + diff --git a/web-app/js/projects.js b/web-app/js/projects.js index 05bdd56..3084f6b 100644 --- a/web-app/js/projects.js +++ b/web-app/js/projects.js @@ -39,6 +39,7 @@ function getProjectHTML(projectName) { '2048-game': () => get2048GameHTML(), 'productive-pet': () => getProductivePetHTML(), 'color-palette': () => getColorPaletteHTML(), + 'caesar-cipher': () => getCaesarCipherHTML(), }; try { @@ -3630,7 +3631,8 @@ function initializeProject(projectName) { 'simon-says': 'initSimonSays', '2048-game': 'init2048Game', 'color-palette': 'initColorPalette', - 'math-quiz': 'initMathQuiz' + 'math-quiz': 'initMathQuiz', + 'caesar-cipher': 'initCaesarCipher' }; const initializerName = initializers[projectName]; diff --git a/web-app/js/projects/ceasar-ciphar.js b/web-app/js/projects/ceasar-ciphar.js new file mode 100644 index 0000000..21e449a --- /dev/null +++ b/web-app/js/projects/ceasar-ciphar.js @@ -0,0 +1,412 @@ +function getCaesarCipherHTML() { + return ` +
+

šŸ” Caesar Cipher Encoder & Decoder

+

Encrypt and decrypt messages using Caesar Cipher

+ +
+
+ + + + +
+ +
+ + +
+ +
+ +
+ + +
+
+ +
+ + +
+ +
+

Output:

+
+

Your result will appear here...

+
+ +
+ +
+

šŸ”” How the shift works:

+
+
+
+
+ + + `; +} + + +function initCaesarCipher() { + const textBox = document.getElementById('cipherInput'); + const goBtn = document.getElementById('cipherBtn'); + const clearBtn = document.getElementById('clearBtn'); + const copyBtn = document.getElementById('copyBtn'); + const outputBox = document.getElementById('cipherOutput'); + const shiftNumber = document.getElementById('shiftInput'); + const shiftSlide = document.getElementById('shiftSlider'); + const encryptRadio = document.getElementById('modeEncrypt'); + const decryptRadio = document.getElementById('modeDecrypt'); + const theLabel = document.getElementById('inputLabel'); + const previewDiv = document.getElementById('shiftPreview'); + + const ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; + + function encryptText(text, shift) { + let result = ''; + + for (const ch of text) { + if (ch >= 'A' && ch <= 'Z') { + result += String.fromCharCode(((ch.charCodeAt(0) - 65 + shift) % 26 + 26) % 26 + 65); + } else if (ch >= 'a' && ch <= 'z') { + result += String.fromCharCode(((ch.charCodeAt(0) - 97 + shift) % 26 + 26) % 26 + 97); + } else { + result += ch; + } + } + + return result; + } + + function decryptText(text, shift) { + return encryptText(text, -shift); + } + + function buildAlphabetRow(label, getChar, className) { + const row = document.createElement('div'); + row.className = 'alphabet-row'; + + const labelEl = document.createElement('span'); + labelEl.className = 'row-label'; + labelEl.textContent = label; + row.appendChild(labelEl); + + for (let i = 0; i < 26; i++) { + const box = document.createElement('span'); + box.className = `letter-box ${className}`; + box.textContent = getChar(i); + row.appendChild(box); + } + + return row; + } + + function showPreview(shift) { + previewDiv.innerHTML = ''; + previewDiv.appendChild(buildAlphabetRow('Original:', i => ALPHABET[i], 'plain')); + previewDiv.appendChild(buildAlphabetRow(`Shift +${shift}:`, i => ALPHABET[(i + shift) % 26], 'cipher')); + } + + function setMode(isEncrypt) { + theLabel.textContent = isEncrypt ? 'šŸ“ Enter Text to Encrypt:' : 'šŸ“Ø Enter Text to Decrypt:'; + textBox.placeholder = isEncrypt ? 'Type your message here...' : 'Paste the encrypted text here...'; + textBox.value = ''; + outputBox.innerHTML = '

Your result will appear here...

'; + copyBtn.style.display = 'none'; + goBtn.textContent = isEncrypt ? 'šŸ” Encrypt Message' : 'šŸ“ Decrypt Message'; + } + + function syncSlider(val) { + const clamped = Math.min(25, Math.max(1, val)); + shiftNumber.value = clamped; + shiftSlide.value = clamped; + showPreview(clamped); + } + + function showError(msg) { + outputBox.innerHTML = `

āŒ ${msg}

`; + copyBtn.style.display = 'none'; + } + + function showResult(text) { + outputBox.innerHTML = ''; + const p = document.createElement('p'); + p.className = 'result-text'; + p.textContent = text; + outputBox.appendChild(p); + copyBtn.style.display = 'inline-block'; + copyBtn.dataset.result = text; + } + + encryptRadio.addEventListener('change', () => setMode(true)); + decryptRadio.addEventListener('change', () => setMode(false)); + + shiftSlide.addEventListener('input', () => syncSlider(parseInt(shiftSlide.value))); + shiftNumber.addEventListener('input', () => syncSlider(parseInt(shiftNumber.value))); + + goBtn.addEventListener('click', () => { + const text = textBox.value; + const shift = parseInt(shiftNumber.value); + + if (!text.trim()) return showError('Please enter some text first!'); + if (isNaN(shift) || shift < 1 || shift > 25) return showError('Please enter a shift value between 1 and 25!'); + + const result = encryptRadio.checked ? encryptText(text, shift) : decryptText(text, shift); + showResult(result); + }); + + clearBtn.addEventListener('click', () => { + textBox.value = ''; + outputBox.innerHTML = '

Your result will appear here...

'; + copyBtn.style.display = 'none'; + }); + + copyBtn.addEventListener('click', () => { + navigator.clipboard.writeText(copyBtn.dataset.result).then(() => { + const original = copyBtn.textContent; + copyBtn.textContent = 'āœ… Copied!'; + setTimeout(() => copyBtn.textContent = original, 1500); + }); + }); + + showPreview(3); +} \ No newline at end of file diff --git a/web-app/utilities.html b/web-app/utilities.html index c0b3ee5..7ab314d 100644 --- a/web-app/utilities.html +++ b/web-app/utilities.html @@ -200,6 +200,13 @@

+
Caesar Cipher
+ +

Caesar Cipher

+

Encrypt & decrypt with a shift!

+ +
+
Morse Code

Morse Code

@@ -284,6 +291,7 @@