maze.py | ||
README.md |
Spaghetti Codenight
Introduction
Welcome to Spaghetti Codenight! The goal tonight is simple: solve a maze with the worst 💩 code possible!
However, there are a few restrictions and minimum requirements your code must meet. While it may look bad, it still needs to be functional!
Maze
Everything is done through stdout
and stdin
, but don't panic!
We've provided a file that handles all the hard work for you (more about this later).
Layout
Your program will receive the maze through stdin
.
The maze will be random each time in both layout and size!
A maze is represented using emojis. A tab character (\t)
represents a new line in the maze, and the maze ends with a newline character (\n)
.
The maze uses five emojis:
5 different emojis are used
⬛
A wall.⬜
A tile. You can move onto these tiles.🟥
A visited tile. These are tiles you've already walked on.🍝
You, the player.😮
The end of the maze.
Think of it like this: You're a delicious plate of spaghetti, moving toward a hungry person. As you move, you spill bolognese sauce, marking the ground red.
Maze example
⬛⬛⬛⬛⬛⬛⬛
⬛🍝⬜⬛⬜⬜⬛
⬛⬜⬛⬛⬛⬜⬛
⬛⬜⬜⬜⬛⬜⬛
⬛⬛⬛⬜⬜⬜⬛
⬛⬜⬜⬜⬛😮⬛
⬛⬛⬛⬛⬛⬛⬛
Movement
You indicate your desired movement by printing a direction to stdout
.
Use the following emojis to move:
⬆️
Up➡️
Right⬇️
Down⬅️
Left
End
When you reach the end, your program will be automatically terminated, and you’ll receive your score. There's no need to manually check if you've completed the maze!
Example
A very short example
stdin
⬛⬛⬛⬛⬛
⬛🍝⬜⬜⬛
⬛⬛⬛⬜⬛
⬛⬜⬜😮⬛
⬛⬛⬛⬛⬛
stdout
➡️
stdin
⬛⬛⬛⬛⬛
⬛🟥🍝⬜⬛
⬛⬛⬛⬜⬛
⬛⬜⬜😮⬛
⬛⬛⬛⬛⬛
stdout
➡️
stdin
⬛⬛⬛⬛⬛
⬛🟥🟥🍝⬛
⬛⬛⬛⬜⬛
⬛⬜⬜😮⬛
⬛⬛⬛⬛⬛
stdout
⬇️
stdin
⬛⬛⬛⬛⬛
⬛🟥🟥🟥⬛
⬛⬛⬛🍝⬛
⬛⬜⬜😮⬛
⬛⬛⬛⬛⬛
stdout
⬇️
You solved the puzzle! Your program gets killed and your receive your score.
Minimum requirements
Your submission must meet these minimum requirements:
- The code must be written in Python 🐍.
- It must solve the maze.
- It must complete the maze within 10 seconds.
Failure to meet these requirements will result in your submission being denied.
Restrictions
There are a few restrictions:
- All your code must be contained in a single file.
- The following Python packages are not allowed:
sys
time
os
eval
exec
We perform basic checks, so please do not attempt to circumvent these restrictions. Submissions that break the rules will be rejected.
Submitting your code
Go to https://spaghetti.zeus.gent
.
Enter your name and select your code file.
If your submission is accepted, you’ll see a GIF showing the result (heads-up, it can take a while)!
Start
The file maze.py is a starting point for your application.
It contains all the required code for handling stdin
and stdout
, so you can focus on solving the maze.
The code file has comments (🤯) and is self-explanatory. We recommend using the classes and enums defined in maze.py (or suffer some strange 👻 bugs)!
Good Luck and if you need any help, don't hesitate to ask!