2026Live
Hangman
- JavaScript
- HTML
- CSS
- Fetch API
- JSON
- Node.js Test Runner
- Vercel
Overview
A hangman game that runs in the browser, with about 1,000 Turkish and 1,000 English words in 21 narrow categories across 7 groups (birds, capital cities, kitchen items, chemical elements…), so the player always knows what they are guessing. Every word starts with some letters revealed. Play with the on-screen keyboard or your own, with correct handling of Turkish letters (ı/i, ç, ğ, ö, ş, ü). It has a hint button, win streaks, a dark and light theme and screen reader support.
01 · Problem
Most hangman examples come with a short English word list. Words repeat quickly and the game cannot be played in Turkish. JavaScript's default case conversion is wrong for Turkish (it turns "I" into "i"). In broad categories like "Sports" the player does not know whether to guess a sport or a piece of equipment, and short words are too hard with six lives.
02 · Solution
I split about 2,000 words in two languages into 21 narrow categories across 7 groups; every word is checked automatically for alphabet, length and duplicates. The lists are loaded with fetch only for the selected language. Words are drawn from a bag shuffled with Fisher–Yates, so nothing repeats until the category is used up. Case conversion follows the language (toLocaleLowerCase('tr')). Every word starts with 1 to 3 letters revealed depending on its length, and a hint button reveals another letter for a life. Each category has its own address, and old addresses redirect permanently to the new ones. The game rules are separate from the UI and verified with unit tests; the site is served with security headers (CSP).
03 · Outcome
A game live at hangman.miracdeprem.com that works on phones and desktops. 33 unit tests cover the rules, every word, the category addresses and storage. Even 14-letter words fit on one line on a small phone. The game uses the same theme as my portfolio site.