spaghetti-code-3/README.md
2024-11-26 18:53:06 +01:00

188 lines
3.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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.
<details>
<summary>Maze example</summary>
```
⬛⬛⬛⬛⬛⬛⬛
⬛🍝⬜⬛⬜⬜⬛
⬛⬜⬛⬛⬛⬜⬛
⬛⬜⬜⬜⬛⬜⬛
⬛⬛⬛⬜⬜⬜⬛
⬛⬜⬜⬜⬛😮⬛
⬛⬛⬛⬛⬛⬛⬛
```
</details>
### 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 youll receive your score.
There's no need to manually check if you've completed the maze!
### Example
A very short example
<details>
<summary>stdin</summary>
```
⬛⬛⬛⬛⬛
⬛🍝⬜⬜⬛
⬛⬛⬛⬜⬛
⬛⬜⬜😮⬛
⬛⬛⬛⬛⬛
```
</details>
<details>
<summary>stdout</summary>
`➡️`
</details>
<details>
<summary>stdin</summary>
```
⬛⬛⬛⬛⬛
⬛🟥🍝⬜⬛
⬛⬛⬛⬜⬛
⬛⬜⬜😮⬛
⬛⬛⬛⬛⬛
```
</details>
<details>
<summary>stdout</summary>
`➡️`
</details>
<details>
<summary>stdin</summary>
```
⬛⬛⬛⬛⬛
⬛🟥🟥🍝⬛
⬛⬛⬛⬜⬛
⬛⬜⬜😮⬛
⬛⬛⬛⬛⬛
```
</details>
<details>
<summary>stdout</summary>
`⬇️`
</details>
<details>
<summary>stdin</summary>
```
⬛⬛⬛⬛⬛
⬛🟥🟥🟥⬛
⬛⬛⬛🍝⬛
⬛⬜⬜😮⬛
⬛⬛⬛⬛⬛
```
</details>
<details>
<summary>stdout</summary>
`⬇️`
</details>
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, youll see a GIF showing the result (heads-up, it can take a while)!
## Start
The file [maze.py](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](maze.py) (or suffer some strange 👻 bugs)!
**Good Luck and if you need any help, don't hesitate to ask!**