Skip to content

Instantly share code, notes, and snippets.

@patrickgh3
Created February 9, 2023 00:11
Show Gist options
  • Save patrickgh3/0951dbc87bee0e1fbf764fb4f436ce09 to your computer and use it in GitHub Desktop.
Save patrickgh3/0951dbc87bee0e1fbf764fb4f436ce09 to your computer and use it in GitHub Desktop.
An exploration of "edge cases" in "Sokoban" (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
title An exploration of "edge cases" in "Sokoban"
author Patrick Traynor 2023-02-08
noaction
========
OBJECTS
========
Background
lightgreen green
11111
01111
11101
11111
10111
Target
darkblue
.....
.000.
.0.0.
.000.
.....
Wall
brown darkbrown
00010
11111
01000
11111
00010
WalkPlayer
black orange white blue
.000.
.111.
22222
.333.
.3.3.
CrawlPlayer
black orange white blue lightgreen green
.000.
41002
.224.
.333.
34..3
Crate
orange
00000
0...0
0...0
0...0
00000
Magic
orange white
.....
..0..
.010.
..0..
.....
Exp1
red orange yellow
0.0.0
.010.
01210
.010.
0.0.0
CrateRemains
transparent
.....
...0.
.0...
..0..
.....
CrateSpawnPoint
transparent
KillBorder
black
=======
LEGEND
=======
. = Background
# = Wall
P = WalkPlayer
Q = CrawlPlayer
* = Crate
@ = Crate and Target
$ = WalkPlayer and Target
% = Wall and Target
! = WalkPlayer and CrawlPlayer
O = Target
M = Magic
S = CrateSpawnPoint
X = KillBorder
Player = WalkPlayer or CrawlPlayer
=======
SOUNDS
=======
Crate move 36772507
Target move 72403107
EndLevel 89451303
sfx1 37636909
sfx2 20778702
sfx3 48410502
================
COLLISIONLAYERS
================
Background
KillBorder, Magic, CrateSpawnPoint
Target, CrawlPlayer
CrateRemains
WalkPlayer, Wall, Crate
Exp1
======
RULES
======
( Original sole sokoban rule)
[ > WalkPlayer | Crate ] -> [ > WalkPlayer | > Crate ]
( Crawl player )
[ > CrawlPlayer | Target ] -> [ > CrawlPlayer | > Target ]
([ > Target | Wall ] -> [ Target | Wall ])
([ > CrawlPlayer | Wall ] -> [ CrawlPlayer | Wall ])
( Crates explode each other )
[ Exp1 ] -> [ ]
[ > Player | > Crate | Crate ] -> [ Player | Exp1 CrateRemains | Exp1 CrateRemains ] again sfx3
( Kill border )
[ > Player | KillBorder ] -> [ | KillBorder ] sfx2
[ > Crate | KillBorder ] -> [ | KillBorder ] sfx2
[ > Target | KillBorder ] -> [ | KillBorder ] sfx2
( Magic )
late [ WalkPlayer Magic ] [ CrateSpawnPoint ] -> [ WalkPlayer ] [ Crate ] sfx1
==============
WINCONDITIONS
==============
all Target on Crate
=======
LEVELS
=======
(
####..
#.O#..
#..###
#@P..#
#..*.#
#..###
####..
)
message First, these are the basic rules. Walk around, push the crate, walls are solid for both you and the crate, put the crate on the target to win the level.
####..
#o.#..
#..###
#.p..#
#..*.#
#..###
####..
message Edge case! What if the crate is on the edge of the level? (Ok, this isn't REALLY an edge case, but still)
#######
#.....#
#....o#
#.p..*#
#...#.#
#..#..#
#..#..#
#..#..#
#######
message Edge case! What if there are multiple crates and multiple targets? Do you think you win after placing just one, or does it require all of them to be placed?
########
#o.*..o#
###....#
#...p.*#
#......#
#.*...##
####o###
########
message Edge case! What if there are more crates than targets? Do you think the game lets you win this level, or not?
########
#..*...#
###....#
#...p.*#
#......#
#.*...##
####o###
########
message Edge case! What if there are more targets than crates? Do you think the game lets you win this level, or not?
#########...........
#.o.*.o.############
#.......#...#...#.m#
#..sp...#.#.#.#.#.##
#.........#...#...#.
#..o.*..###########.
#########...........
message Edge case: What if the crate starts on top of the target? What happens then?
#####
#...#
#.p.#
#...#
#.@.#
#...#
#####
message Further exploration of that edge case:
#########
##.##.###
#.......#
##..@...#
#..@p@.##
##..@..##
#.......#
#..##.###
#########
message Edge case! What if there is more than 1 player? How do they behave?
#########
#.......#
#.p.o.p.#
#.......#
#.....*.#
####.####
####..###
#########
message Edge case! What if the level is almost entirely filled with players? How the heck does the game handle that?
########
#pppppp#
#pppppp#
#ppp*pp#
#pppppp#
#pppppo#
#p##p###
#pppp###
########
message Edge case! What if you could reach the boundary of the level, past the outer walls? What would happen?
xxxxxxxxxxxxx
x###########x
x#...#######x
x#..........x
x#...#####.#x
x#.p.#####.#x
x#...##....#x
x#####o**###x
xxxxxxxxxxxxx
message Edge case! What if level boundaries could be arbitrarily shaped instead of just a rectangle?
###########
#ppppppppp#
#.........#
#.........#
#.........#
#....x....#
#.........#
#.........#
#.........#
#@@@@@@*@@#
xxxxxxx.xxx
xxxxxxx.xxx
xxxxxxxxxxx
message Edge case! What about a 1-wide level? Could the game handle that?
x#x
x@x
x.x
x#x
x.x
xox
x.x
x*x
x.x
xpx
x.x
x.x
x*x
x.x
x.x
xox
x.x
x@x
x.x
x#x
x#x
message Edge case! What happens if you push a crate into another crate? Could you push multiple in a row? Or...
##########
####o*.###
######.###
#.....*..#
#..#######
##.#p....#
##*#####.#
##.......#
##########
message Edge case! The player is normally standing up and resting on top of the ground, and interacts with other objects resting on top of the ground. What if instead, the player was on the "ground layer", crawling around in the grass, and interacts with other objects on the ground layer?
xxxxxxxxxxxxxx
x............x
x............x
x............x
x...####.o...x
x...#..#.....x
x...#*.###...x
x...#.q..#...x
x...#o.*.#...x
x...#..###...x
x...####.....x
x............x
x............x
x............x
xxxxxxxxxxxxxx
message Edge case! What if the crawling player and standing players are on the same level?
xxxxxxxxxxx
x.........x
x..o......x
x.........x
x.........x
x.#######.x
x.#.p*!.#.x
x.#######.x
x.........x
xxxxxxxxxxx
message Edge case! Hey, where's my target? How am I supposed to win?
xxxxxxxxxxxxxxxxx
x...............x
x...............x
x...............x
x...............x
x...............x
x.....#####.....x
x.....#..*#.....x
x.....#.q.#.....x
x.....#...#.....x
x.....#%###.....x
x...............x
x...............x
x...............x
x...............x
x...............x
xxxxxxxxxxxxxxxxx
message Edge case! Hey, where's my crate? How am I supposed to win?
xxxxxxxxxxx
x.........x
x.........x
x.........x
x...q.....x
x....o....x
x.........x
x.........x
x.........x
x.........x
xxxxxxxxxxx
message Edge case! What if there is no player? Now that would be a weird situation... What do you think would happen?
####..
#.@#..
#..###
#@...#
#....#
#..###
####..
message Edge case! What if there are also no targets or crates?
####..
#..#..
#..###
#....#
#....#
#..###
####..
message Edge case! What if there is a 1x1 level?
.
message Edge case! What if there is no level data? What happens then?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment