Last active
July 10, 2019 06:34
-
-
Save sfiera/fb4dc9e8c2ee33a8aeabbf2d43646b4d to your computer and use it in GitHub Desktop.
Random Shortest Path (PuzzleScript Script) https://www.puzzlescript.net/play.html?p=fb4dc9e8c2ee33a8aeabbf2d43646b4d
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
title Random Shortest Path | |
author Dennis Au | |
background_color Green | |
run_rules_on_level_start | |
======== | |
OBJECTS | |
======== | |
Background . | |
White | |
Wall X | |
Grey | |
Player @ | |
Black | |
..... | |
.000. | |
.000. | |
.000. | |
..... | |
Fill0 0 | |
Black | |
..... | |
..... | |
..... | |
..... | |
..... | |
Fill1 1 | |
Black | |
..... | |
..... | |
..... | |
..... | |
..... | |
Fill2 2 | |
Black | |
..... | |
..... | |
..... | |
..... | |
..... | |
ToR | |
Blue | |
..... | |
....0 | |
....0 | |
....0 | |
..... | |
FromL | |
Blue | |
..... | |
..... | |
0.... | |
..... | |
..... | |
ToD | |
Blue | |
..... | |
..... | |
..... | |
..... | |
.000. | |
FromU | |
Blue | |
..0.. | |
..... | |
..... | |
..... | |
..... | |
ToL | |
Blue | |
..... | |
0.... | |
0.... | |
0.... | |
..... | |
FromR | |
Blue | |
..... | |
..... | |
....0 | |
..... | |
..... | |
ToU | |
Blue | |
.000. | |
..... | |
..... | |
..... | |
..... | |
FromD | |
Blue | |
..... | |
..... | |
..... | |
..... | |
..0.. | |
======= | |
LEGEND | |
======= | |
Fill = Fill0 or Fill1 or Fill2 | |
To = ToR or ToD or ToL or ToU | |
From = FromR or FromD or FromL or FromU | |
Arrow = To or From | |
======= | |
SOUNDS | |
======= | |
================ | |
COLLISIONLAYERS | |
================ | |
Background | |
Fill | |
Player, Wall | |
ToR, FromR | |
ToD, FromD | |
ToL, FromL | |
ToU, FromU | |
====== | |
RULES | |
====== | |
(use floodfill to mark distance to player alternating 0,1,2... | |
algorithm is: | |
1. Mark Player as 0 | |
2. Mark unfilled squares next to 0 as 1 | |
3. Mark unfilled squares next to 1 as 2 | |
4. Mark unfilled squares next to 2 as 0 | |
5. Loop 2-4. | |
Then, enemies can find the player by reducing their distance by one: | |
1. If enemy is on 2, mark to move to 1 | |
2. If enemy is on 1, mark to move to 0 | |
3. If enemy is on 0, mark to move to 2 | |
) | |
late [Player] -> [Player Fill0] | |
late [Fill0 | No Fill No Wall] -> [Fill0 | Fill1] | |
+late [Fill1 | No Fill No Wall] -> [Fill1 | Fill2] | |
+late [Fill2 | No Fill No Wall] -> [Fill2 | Fill0] | |
late [Arrow] -> [] | |
late right [Fill1 | Fill0] -> [ToR Fill1 | FromL Fill0] | |
late down [Fill1 | Fill0] -> [ToD Fill1 | FromU Fill0] | |
late left [Fill1 | Fill0] -> [ToL Fill1 | FromR Fill0] | |
late up [Fill1 | Fill0] -> [ToU Fill1 | FromD Fill0] | |
late right [Fill2 | Fill1] -> [ToR Fill2 | FromL Fill1] | |
late down [Fill2 | Fill1] -> [ToD Fill2 | FromU Fill1] | |
late left [Fill2 | Fill1] -> [ToL Fill2 | FromR Fill1] | |
late up [Fill2 | Fill1] -> [ToU Fill2 | FromD Fill1] | |
late right [Fill0 | Fill2] -> [ToR Fill0 | FromL Fill2] | |
late down [Fill0 | Fill2] -> [ToD Fill0 | FromU Fill2] | |
late left [Fill0 | Fill2] -> [ToL Fill0 | FromR Fill2] | |
late up [Fill0 | Fill2] -> [ToU Fill0 | FromD Fill2] | |
late [Fill] -> [] | |
============== | |
WINCONDITIONS | |
============== | |
======= | |
LEVELS | |
======= | |
.xxx.....@ | |
.x...x.... | |
.x.xxxxxx. | |
.x.x...@x. | |
xx.x....x. | |
...x....x. | |
.xxx....x. | |
........x. | |
x.xxxxxxx. | |
x......... | |
x..xx..... | |
x......... | |
xxxxxxxxxx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment