Directory structure
.
├── Makefile
├── game.h
├── main.c
├── load.c
├── display.c
├── game.c
├── music.c
├── music.h
├── questions.txt
├── music/
│ ├── tier1.wav
│ ├── tier2.wav
│ └── tier3.wav
└── libtci/Build and run
make re
./game questions.txtPlay a full game. The music should change when you cross Q5 and Q10, and stop cleanly on every exit path.
Check that no orphaned aplay processes remain after the game exits:
pgrep aplayNo output means clean. If aplay processes linger, check that every
exit path in game_loop calls stop_music before returning.
Run the tester
Clone the companion repo and copy test.sh into your working directory:
git clone https://github.com/thecodingidiot-com/g01c-the-developer-acoustic.git
cp g01c-the-developer-acoustic/test.sh .
bash test.shThe tester checks:
Process lifecycle — start_music returns a valid PID, the aplay
process is alive immediately after, stop_music kills it cleanly, and
no zombie is left behind.
Tier transitions — a headless build of game.c with stubbed music
functions drives the game through scripted answers and verifies that
start_music is called with the correct WAV path at each tier
boundary.
Exit paths — win, loss, and walk-away all call stop_music.
All tests must print PASS before the chapter is complete.
What comes next
This is the last chapter in the WWTBAD series.
g01a built a terminal quiz game in C. g01b replaced the display layer
with SDL2. g01c added background music using fork and exec. The
game is as complete as a terminal quiz game needs to be.
The WWTBAD format is a borrowed structure — useful as scaffolding, unsuitable for further extension. The chapters that follow build something original.
c06 returns to the systems track: sorting algorithms, benchmarking, and a real-time sprite depth visualiser. After c06, the curriculum builds Dimitrio — a game where position, movement, and collision determine the outcome.