A desktop reimagining of Human Resource Machine powered by C++17, SFML 3, and ImGui-SFML. Write assembly‑style commands in a comfy GUI, watch your little office worker execute them, and progress through handcrafted (or user-defined) levels.
- Human Resource Machine (SFML/ImGui Edition)
- Polished UI with warm ImGui styling, animated conveyors, and a lively robot.
- Command pad:
- Real-time warnings for unavailable commands (after you press Enter on a line).
Clear,Upload
- Execution controls for
Parse,Run,Step,Reset,Menu,Quit— each with custom icons. - Mission briefing card showing steps executed and allowed commands.
- Persistent progress across sessions with a one-click Restart Progress.
- Custom level loader so players can add levels from data files without touching source.
HumanResourceMachine/
├── report.pdf # Project report
├── video/
│ └── demo1.mp4 # Gameplay demo video
├── code/
│ ├── main.cpp # Online Judge Version
│ ├── CMakeLists.txt # Top-level CMake config
│ ├── CLI/ # CLI edition code
│ │ ├── CMakeLists.txt # CMake config for CLI edition
│ │ ├── src/ # CLI edition source files
│ │ │ ├── Display.cpp
│ │ │ ├── GameData.h
│ │ │ ├── GameEngine.{h,cpp}
│ │ │ ├── GameManager.{h,cpp}
│ │ │ └── main.cpp
│ │ ├── scripts/
│ │ │ ├── level1.txt
│ │ │ ├── level2.txt
│ │ │ ├── level3.txt
│ │ │ └── level4.txt
│ ├── GUI/ # GUI edition code
│ │ ├── CMakeLists.txt # CMake config for GUI edition
│ │ ├── src/ # GUI edition source files
│ │ │ ├── main.cpp
│ │ │ ├── GameData.h
│ │ │ ├── GameEngine.{h,cpp}
│ │ │ └── GameManager.{h,cpp}
│ │ ├── scripts/
│ │ │ ├── level1.txt
│ │ │ ├── level2.txt
│ │ │ ├── level3.txt
│ │ │ ├── level4.txt
│ │ │ └── custom1.txt
│ │ └── vendor/ # GUI edition dependencies
│ ├── figures/ # Screenshots used in this README
│ └── README.md # This README
└── tex / # LaTeX source for the report
- CMake ≥ 3.10
- C++17-capable compiler
- macOS: Apple Clang (Command Line Tools) or
brew install llvm - Linux:
sudo apt install build-essential - Windows: Visual Studio 2019/2022, MSYS2, or WSL with GCC/Clang
- macOS: Apple Clang (Command Line Tools) or
- SFML 3.0.2 (or newer) with its CMake configs (
SFML_DIR) - OpenGL runtime (present by default on most platforms)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
xcode-select --install
brew install cmake ninja llvmmacOS (Homebrew)
brew install sfmlMake sure SFML_DIR in CMakeLists.txt matches Homebrew’s path, e.g.
set(SFML_DIR "/opt/homebrew/Cellar/sfml/3.0.2/lib/cmake/SFML")Linux (APT)
sudo apt install libsfml-devCustom build (any platform)
git clone https://github.com/SFML/SFML.git
cd SFML
cmake -S . -B build
cmake --build build --target install
export SFML_DIR=/usr/local/lib/cmake/SFML # adjust as neededcmake -S . -B build
cmake --build buildCLion users can simply open the folder; it defaults to cmake-build-debug/.
./cmake-build-debug/bin/cli/CLI # for CLI edition
./cmake-build-debug/bin/gui/GUI # for GUI editionClick on the "Run/Debug Configurations" dropdown in the top-right, then select either CLI or GUI and press the green play button.

If you run the executable from somewhere else, remember that uploads, custom levels, and progress files resolve relative to the current working directory.
- Main Menu
- Level tiles show pass/lock state. Custom levels display a
[Custom]badge. - Bottom-right buttons let you Add Custom Level or Restart Progress.
2Mission Briefing - Displays description, steps executed, and allowed commands for the current level.
3Command Pad - Type instructions (
inbox,outbox,copyto, etc.). - After you press Enter on a line, the pad warns if that command isn’t available in the current level.
4Execution Controls - Parse validates syntax and available commands.
- Run animates the entire program.
- Step executes one instruction at a time.
- Reset clears state, Menu returns to level select, Quit closes the app.
5World Renderer - Inbox/outbox belts scroll with subtle motion, and the worker bobs/sways to keep the scene alive.
- Level tiles show pass/lock state. Custom levels display a
- Upload (next to
Clear) opens a popup:
The main menu now features Add Custom Level, letting players append new levels without editing source code.
- Click Add Custom Level (bottom-right).
- Enter the path to a data file and press Load.
- On success, the level appears in the list with a
[Custom]badge (always unlocked).

The loader accepts simple key=value lines (comments starting with # are ignored):
level_id=10
description=Sum positives and stop at zero
inputs=5, 3, -2, 0
outputs=6
floor_size=3
commands=inbox,outbox,copyto,copyfrom,add,sub,jump,jumpifzero
Required keys
| Key | Description |
|---|---|
level_id |
(Optional) Integer ID. If omitted, one is auto-assigned. |
description |
Text shown in the mission briefing. |
inputs |
Comma-separated integers for the inbox sequence. |
outputs |
Expected outbox sequence for success. |
floor_size |
Number of floor tiles available. |
commands |
Allowed instruction names separated by commas. |
Invalid lines (missing = or malformed numbers) will produce an error in the popup so you can fix the file quickly.
enum class GameStatusmodels states such asRUNNING,FINISHED,SUCCESS,FAIL, andERROR_STATE.struct Instructionstores the opcode, optional operand, and original line number.struct Levelbundles narrative text, inputs, expected outputs, floor size, available commands, and completion flags.struct GameStatesnapshots inbox/outbox contents, floor tiles, the worker's hand, and the program counter.
loadLevel(const Level&)resetsGameState, seeds the inbox, and clears prior programs.parseProgram(const std::vector<std::string>&)tokenizes each line, validates syntax, and enforces each level's command whitelist.run()advances throughstep()on a timer, renders intermediate state, and compares the outbox against expectations when finished.step()emulates the virtual CPU with strict runtime checks before executing each instruction.handleError(const std::string&)records descriptive failures with line numbers and moves the engine intoERROR_STATE.
run()drives the level-select menu, routes user choices, and enforces unlock conditions.playLevel(int)orchestrates the full attempt lifecycle: load level, show details, collect input mode, gather program text, parse, execute, update progress, and persist results.getProgramFromKeyboard()andgetProgramFromFile()wrap the two input paths, including path checks and comment/blank-line filtering.saveProgress()andloadProgress()keep progress inprogress.txtso unlocks survive restarts.
The display layer stays decoupled from logic. printGameState(...) clears the terminal, aligns columns with stringstream/setw(), and marks the active instruction with arrow highlighting to keep the CLI readable.
To provide a richer experience, the GUI edition uses SFML 3.0.2 and ImGui-SFML so players can edit programs and watch the simulation in a single window.
GameEngineandGameManagerare reused unchanged, guaranteeing identical instruction semantics and save formats.- The new
src/main.cppdrives the SFML window loop, wires ImGui panels to engine calls (loadLevel,parseProgram,step,run), and tracks UI state. - Rendering helpers such as
renderProgramView()andRenderGameWorld()handle code highlighting, conveyor animations, and worker motion.
- Level Menu: Tile-based layout shows lock status, tags custom levels with
[Custom], and exposes a one-click progress reset (figures/menu.png). - Mission Briefing: Displays objectives, allowed commands, and execution counters to guide planning (
figures/briefing.png). - Command Editor: Adds line numbers, highlights the currently executing line, and surfaces invalid instructions alongside the
Parsebutton (figures/ExecutionControls.pngandfigures/CommandPad.png). - Animations: Conveyor belts scroll gently, the worker idles with subtle motions, and the overall view reinforces feedback (
figures/WholeView.png).
Licensed under the MIT License. See the snippet below.
MIT License
Copyright (c) 2024
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Enjoy automating the office! 🧾🤖 Contributions, new level packs, and feature ideas are always welcome.


