Last active
October 26, 2023 12:18
-
-
Save Sinthorion/e637f35d06f337fc2516be6497d4c829 to your computer and use it in GitHub Desktop.
Game written in Makefile. Run with `make -s start`. Run subsequent command with `make -s your.command`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| clean: clean.room clean.object clean.item | |
| clean.room: | |
| rm -f *.room | |
| clean.object: | |
| rm -f *.object | |
| clean.item: | |
| rm -f *.item | |
| start: clean room1 | |
| room1: | |
| echo "You are standing in a small room. There is a locked door to another room. There is a table." | |
| echo "You can:" | |
| echo " - open.door" | |
| echo " - examine.table" | |
| touch door.object | |
| touch table.object | |
| examine.table: table.object | |
| if [ ! -e key.item ]; then \ | |
| echo "There is a key on the table. You can take it (take.key)."; \ | |
| touch key.object; \ | |
| else \ | |
| echo "The table is empty"; \ | |
| fi | |
| take.key: key.object | |
| echo "You take the key." | |
| rm key.object | |
| touch key.item | |
| open.door: door.object | |
| if [ ! -e key.item ]; then \ | |
| echo "The door is locked. Maybe you need a key?"; \ | |
| else \ | |
| echo "You open the door with the key. You can now leave the room (leave.room)."; \ | |
| rm door.object; \ | |
| touch room2.room; \ | |
| fi | |
| leave.room: room2 | |
| room2: room2.room clean.room clean.object | |
| echo "Congratulations! You have escaped the room" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment