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 } | |
+ [Keep going] | |
-> 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 goNorth() === | |
{ setY(y - 1) } | |
{ drinkWater() } | |
=== function goSouth() === | |
{ setY(y + 1) } | |
{ drinkWater() } | |
=== function goWest() === | |
{ setX(x - 1) } | |
{ drinkWater() } | |
=== function goEast() === | |
{ setX(x + 1) } | |
{ drinkWater() } | |
=== 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