🔨 WHACK-A-MOLE

Nine holes, one mole, forty-five seconds — how fast are you really?

← Back to Fun Time
Score
0
Hits
0
Time
45
Level
1
Best
0

⌨️ Controls

  • aim the hammer
  • Space or Enter swing
  • Clicking or tapping a hole works too — much faster!
  • P pause  •  R new game
  • 🎮 Xbox controller? Just plug it in or pair it — the stick and D-pad are the arrow keys, A is SPACE, Menu pauses and View starts again

🎯 How to play

  • A mole pops out of one hole at a time. Hit it before it ducks back down.
  • You have 45 seconds.
  • Every 5 hits you go up a level — and the moles get quicker.
  • A miss does not move the mole, so hitting every hole in turn will not help you.

🏆 Scoring

  • Each mole is worth 10 × your level.
  • Level 1 moles wait 1100 ms; level 10 moles wait only 350.
  • So the points really pile up once you get going — the last ten seconds are worth more than the first thirty.

🧑‍💻 For young coders: build this game yourself

This game is split into small library files inside funtime/lib/, and every function has a comment saying exactly what goes in, what comes out, and the algorithm in plain English. Empty any function out, read its comment, and write it yourself.

File What it does Good functions to try re-writing
lib/whack-rules.js The rules: the mole, the clock, the scoring randomHole, moleInterval, whack, updateGame
lib/whack-draw.js Painting the holes and the mole drawHole, drawMole, holeAtPixel
lib/whack-main.js The glue: clicks, keyboard, the loop doAction, connectBoard, gameLoop

💡 The big idea: a timer is all that separates a board game from an arcade game. updateGame counts milliseconds and moves the mole when enough have passed — the same idea makes Tetris fall and the racing road scroll.

🛠️ Want to be walked through it? Build Whack-a-Mole Yourself takes you through the key functions one step at a time and tests each one you write. There is a Python version too.