See Grace-H/antcode
A graphical extension to the game Antcode that uses text-based console commands with Pygame.
With Antcode-UI, students can:
- visualize their ant strategies in a simulated game environment
- analyze how their ants interact with the map and the rest of the team
- coordinate and strategize with their teams better
And of course, Antcode-UI is beneficial to teachers:
- record full tournaments or single games
- help students debug their ants
... and more!
- Experiment with curses for streamlined console interactions
- Run, view, and control a minimalistic Pygame window, all from your console
- Intuitive text commands to play and configure the simulation
- Generate test maps and games
- Easily deployable to CodeHS Sandbox
Antcode UI requires Python 3 or above to run. (Tested versions: 3.10.12, 3.13.0, 3.14.0a3)
pip is the recommended package manager to use.
Clone the GitHub repository.
git clone https://github.com/a1silver/antcode-ui
cd antcode-ui
Install project dependencies.
pip install -r requirements.txt
Initialize and update Git submodules.
git submodule update --init
Run main.py
.
python main.py
(The proper executable might vary on different systems.)
Command | Description |
---|---|
load | Load a new game |
[enter] | Toggle playback state |
pause | Pause playback |
play | Continue playback |
aa | Skip to the start |
a | Step once backward |
s | Step once forward |
se | Skip to the end |
steps | View current steps out of the total |
score | View the current score for each team |
winner | View the game's winner |
generate | Generate a new test map |
config | Modify simulation settings |
quit | Quit the simulation |
For more detailed information, run help
in the simulation.
Option | Details |
---|---|
pauseOnStep | (bool) Pause the simulation instantly if the user manually steps forward or backward |
stepsPerSecond | (int) How many times the simulation's map will advance to the next step per second |
cellSize | (int) How many pixels tall and wide each map cell will be |
autoSave | (bool) Auto-save the simulation configuration when modifying options (RECOMMENDED TO BE ON) |
stopOnLastStep | (bool) Instantly pause the simulation when the last step is reached |
fancyGraphics | (bool) Whether plain colors or detailed graphics are used to render certain cells |
showTopBar | (bool) Show or hide the panel containing key game details such as step number and team scores |
For more detailed information, run config
in the simulation.
Want to contribute? Great!
Fork the repository, push your changes, and open a pull request.
Found a bug? Let's squash it together.
Open an issue and describe the bug in as much detail as possible.
MIT