-
-
Save videlais/4dfb650c82972e5eef18e33c1c01cd8e to your computer and use it in GitHub Desktop.
This file contains 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
VAR x = 20 | |
VAR y = 20 | |
VAR water = 20 | |
The desert was vast. My steps were erased soon after I placed them, but I had to continue. I knew that with every movement on the map, I would drink water -- and I was quickly running out. | |
-> Choices | |
=== Choices === | |
{ water < 1: -> Out_Of_Water } | |
+ Move north? | |
{ setY(y - 1) } | |
{ drinkWater() } | |
-> Choices | |
+ Move south? | |
{ setY(y + 1) } | |
{ drinkWater() } | |
-> Choices | |
+ Move west? | |
{ setX(x - 1) } | |
{ drinkWater() } | |
-> Choices | |
+ Move east? | |
{ setX(x + 1) } | |
{ drinkWater() } | |
-> Choices | |
=== Out_Of_Water === | |
I shook my canteen, but could tell it was empty. This... this was the last step in my journey. | |
-> DONE | |
=== function setX(newX) === | |
{ | |
- newX > 100: | |
~ x = 100 | |
- newX < 0: | |
~ x = 0 | |
- else: | |
~ x = newX | |
} | |
=== function setY(newY) === | |
{ | |
- newY > 100: | |
~ y = 100 | |
- newY < 0: | |
~ y = 0 | |
- else: | |
~ y = newY | |
} | |
=== function currentPosition() === | |
(Currently at {x} and {y}.) | |
=== function drinkWater() === | |
~ water = water - 1 | |
=== function currentWater() === | |
(Remaining water {water}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment