The Hangman Game

Schoolbook-style hangman, nine themes and four difficulties, dependency-free PHP

Year
2024
Role
Design & development
Category
Game
Stack
PHP, JavaScript, CSS, SVG
Preview of the The Hangman Game project

Context

Build a hangman game that doesn't feel like a generic school exercise, with a real visual identity (ruled schoolbook paper by day, blackboard by night), while keeping the secret word strictly server-side so it can never be read from the page source.

Solution

Clean separation between the server (an object-oriented PHP 8 class owning the game state in session) and the browser, which talks to a JSON API (start / guess / hint / state / reset) via fetch, never reloading the page. The 'hand-drawn' look comes from an SVG filter and deliberately irregular borders, with zero JavaScript dependencies. Careful handling of accents and compound words (guessing 'E' also reveals 'É'), resuming a game after a page reload, and respect for prefers-reduced-motion.

Technical architecture

  • BackendObject-oriented PHP 8: an isolated, testable Hangman class, game state serialized in session, words that never leave the server
  • API & FrontendFramework-free JSON API (start/guess/hint/state/reset), vanilla JavaScript for the keyboard, fetch calls and staging
  • Art DirectionHand-drawn look via SVG filter, two themes (light paper / blackboard) following the system with a remembered toggle