• 🎮 Optional Hacks (ONLY 1 is REQUIRED TO BE COMPLETED!)
    • Hack 1: Random Color Generator
    • Hack 2: Random Password Maker
    • Hack 3: Coin Flip Streak Tracker
    • Hack 4: Random Compliment Generator
    • Hack 5: Number Guessing Game
    • Hack 6: Random Team Maker

🎮 Optional Hacks (ONLY 1 is REQUIRED TO BE COMPLETED!)

Hack 1: Random Color Generator

Generate random RGB colors with one click.
Format: rgb(random, random, random) (0–255).
Change a box’s background & show the color code.

Hack 2: Random Password Maker

Create passwords with random letters & numbers.
User picks length (6–20).
One button = new password each time.

Hack 3: Coin Flip Streak Tracker

Flip a coin (50/50 chance).
Track the longest streak of same results.
Example: "Heads, Heads, Heads = 3 streak!"

Hack 4: Random Compliment Generator

Pick random compliments from a list of 10–15.
Button = new compliment.
Simple mood booster 💚.

Hack 5: Number Guessing Game

Computer picks random number (1–50).
User guesses → show “Too high!” or “Too low!”.
Count guesses until win.

Hack 6: Random Team Maker

Enter 6–10 names in a box.
Randomly split into 2 teams.
Display Team A and Team B lists.

All hacks use Math.random(), Math.floor(), arrays, and simple HTML buttons/displays!

%%javascript
// Coin Flip Streak Tracker
// Flips a coin 20 times and finds the longest streak of Heads or Tails

let flips = 20;
let longestStreak = 0;
let currentStreak = 1;
let lastFlip = "";
let resultList = [];

for (let i = 0; i < flips; i++) {
  let flip = Math.random() < 0.5 ? "Heads" : "Tails";
  resultList.push(flip);

  if (flip === lastFlip) {
    currentStreak++;
  } else {
    currentStreak = 1;
  }

  if (currentStreak > longestStreak) {
    longestStreak = currentStreak;
  }

  lastFlip = flip;
}

console.log("Coin Flips:", resultList.join(", "));
console.log("Longest streak:", longestStreak);

<IPython.core.display.Javascript object>