Kitchen Game in C
A first-year C course design. I wrote a timed cooking game for Windows with the EasyX graphics library, with login and registration stored in a file, a linked-list leaderboard, three levels, chef selection and falling bonus items.
- Period
- Spring 2024
- Context
- Advanced Language Programming (C) course design
- Team
- Individual project
- My role
- Sole developer
- Status
- Completed and submitted (May 2024)
Demo & artifacts
- Open demoWeb adaptation
The game itself is a Windows program, and its full source and artwork are not on this site. The walkthrough re-runs two pieces of its logic printed in the report: the pickup test and the linked-list leaderboard.
My contribution
- Wrote the whole game in C on EasyX: a login and registration screen that stores players in
userData.txt, a start menu with recipe and game introductions, a choice of three chefs, and three timed levels with WASD movement and E to interact. - Designed the bonus items: a clock that falls every 20 seconds of the 120-second countdown and adds time when caught, a speed-up item every 30 seconds, and a bomb that ends the game.
- Built the leaderboard as a linked list read from the player file, sorted by best score and shown as the top ten.
- Removed flicker with EasyX batch drawing, and drew sprites with a PNG transparency routine from an EasyX tutorial (credited in the report's code) that copies only pixels with an alpha value above 100.
What the game does
A player registers or logs in, picks one of three chefs and plays three timed levels. The chef walks around the kitchen with WASD, picks up ingredients and takes them to the matching counters to score before the 120-second countdown ends. Bonus items drop in on a schedule tied to the countdown: a clock every 20 seconds adds time, a speed-up item every 30 seconds makes the chef faster, and a bomb ends the round. Afterwards the player’s best score goes into the leaderboard.
The walkthrough re-runs the two pieces of logic that the report prints in full: the test that decides whether the chef has caught an item, and the code that builds, sorts and shows the leaderboard.
Looking back
This was my first program longer than a few hundred lines, written in my first year. Re-running its code for this page showed the kind of bugs that testing by playing does not reveal: a collision test that works when you approach from the obvious direction, and a leaderboard that looks correct because three mistakes cancel out.
Results & validation
- Submitted with a full report on 24 May 2024: requirements, module design, flowcharts, data structures, key code and a user manual.
- For this page I re-ran the report's pickup test and leaderboard code in the browser; the findings are under limitations.
The report describes the finished game but contains no screenshots of it, and only the code excerpts in the report are available here. Those excerpts were translated and re-run for this website in November 2026.
Limitations & next steps
- The pickup test checks only the chef's top-left and bottom-right corners. About a third of the positions where the chef touches an item do not count, so items are easier to catch from some directions than others. The speed-up item is also checked with the clock's box size.
- The leaderboard sort has bugs that happen to cancel out:
while (!feof(...))reads the last player twice, the sort never reaches the last node, and the display stops before it. The visible board is right only because the file always ends with a newline. free(p3)sits inside the sort loop, so a second swap writes to freed memory and frees it again, which is undefined behaviour. The list is also never freed after display, because the function returns first.- Usernames are read into a 16-byte array while the input allows up to 50 characters, and passwords are stored in plain text.
