Skip to content

Instantly share code, notes, and snippets.

Created February 21, 2014 02:04
Show Gist options
  • Save anonymous/9127471 to your computer and use it in GitHub Desktop.
Save anonymous/9127471 to your computer and use it in GitHub Desktop.
title
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
title Minesweeper: The Demake
author Benjamin Davis
homepage bnhw.co.uk
key_repeat_interval 0.25
noundo
realtime_interval 1
run_rules_on_level_start
========
OBJECTS
========
1
Blue
...0.
...0.
...0.
...0.
...0.
2
Green
0000.
...0.
0000.
0....
0000.
3
Purple
0000.
...0.
.000.
...0.
0000.
4
Orange
0..0.
0..0.
0000.
...0.
...0.
5
Yellow
0000.
0....
0000.
...0.
0000.
6
Red
0....
0....
0000.
0..0.
0000.
7
Red
0000.
...0.
...0.
...0.
...0.
8
Red
0000.
0..0.
0000.
0..0.
0000.
9
Red
0000.
0..0.
0000.
...0.
...0.
0
Red
0000.
0..0.
0..0.
0..0.
0000.
Happy
Yellow Black
.000.
01010
10001
01110
.000.
Sad
Yellow Black
.000.
01010
00000
01110
.000.
BorderT
#FFFFFF #808080
00000
.....
.....
.....
.....
BorderB
#808080
.....
.....
.....
.....
00000
BorderL
#FFFFFF
0....
0....
0....
0....
0....
BorderR
#808080
....0
....0
....0
....0
....0
Background
#C0C0C0
Timer
Black
Count
Black
Player
Blue
0...0
.....
.....
.....
0...0
Hidden
#FFFFFF #808080 #C0C0C0
00002
02221
02221
02221
21111
Flag
Red Black
.....
.001.
.001.
...1.
.....
Mine
Black
.....
.000.
.000.
.000.
.....
MineL
White
.....
....0
...00
....0
.....
MineR
White
.....
0....
00...
0....
.....
MineT
White
.....
.....
.....
..0..
.000.
MineB
White
.000.
..0..
.....
.....
.....
Spawn
Red
Red
Red
=======
LEGEND
=======
Number = 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 0
Border = BorderL or BorderR or BorderT or BorderB
MineMarker = MineL or MineR or MineT or MineB
Smiley = Happy or Sad
. = Background
o = Happy and Spawn and Player
c = Count and 0
t = Timer and 0
# = Spawn
- = BorderT and BorderB
| = BorderL and BorderR
┌ = BorderL and BorderT
┐ = BorderR and BorderT
└ = BorderL and BorderB
┘ = BorderR and BorderB
=======
SOUNDS
=======
SFX0 26061102
================
COLLISIONLAYERS
================
Background
BorderL, MineL, Spawn, Timer, Count, Red
BorderR, Number, Mine
BorderT, MineR, Smiley, Hidden
BorderB, MineT, Flag
MineB, Player
======
RULES
======
( Clean up borders )
right [ BorderR | BorderT BorderB ] -> [ | BorderT BorderB ]
right [ BorderT BorderB | BorderL ] -> [ BorderT BorderB | ]
( Timer )
( Add to timer if player isn't moving [ i.e. realtime_interval is happening ] and player isn't on smiley )
right [ stationary Player no Smiley ] [ Timer | no Timer ] -> [ stationary Player ] [ action Timer | ]
( Increase timer )
startloop
[ action Timer 0 ] -> [ Timer 1 ]
[ action Timer 1 ] -> [ Timer 2 ]
[ action Timer 2 ] -> [ Timer 3 ]
[ action Timer 3 ] -> [ Timer 4 ]
[ action Timer 4 ] -> [ Timer 5 ]
[ action Timer 5 ] -> [ Timer 6 ]
[ action Timer 6 ] -> [ Timer 7 ]
[ action Timer 7 ] -> [ Timer 8 ]
[ action Timer 8 ] -> [ Timer 9 ]
right [ Timer | action Timer 9 ] -> [ action Timer | Timer 0 ]
endloop
( When resetting )
( Reset when player actions on smiley )
[ action Player Smiley ] -> restart
( When spawning )
( Reset timer )
[ Spawn Smiley ] [ Timer Number | Timer Number | Timer Number ] -> [ Spawn Smiley ] [ Timer 0 | Timer 0 | Timer 0 ]
( Spawn mines )
random [ Spawn no Smiley ] -> [ Mine ]
random [ Spawn no Smiley ] -> [ Mine ]
(random [ Spawn no Smiley ] -> [ Mine ]
random [ Spawn no Smiley ] -> [ Mine ]
random [ Spawn no Smiley ] -> [ Mine ]
random [ Spawn no Smiley ] -> [ Mine ]
random [ Spawn no Smiley ] -> [ Mine ]
random [ Spawn no Smiley ] -> [ Mine ]
random [ Spawn no Smiley ] -> [ Mine ]
random [ Spawn no Smiley ] -> [ Mine ])
( Create L, R, T, B markers )
left [ Spawn Smiley ] [ Mine no Hidden | no Border no Number ] -> [ Spawn Smiley ] [ Mine | MineL ] SFX0
right [ Spawn Smiley ] [ Mine no Hidden | no Border no Number ] -> [ Spawn Smiley ] [ Mine | MineR ] SFX0
up [ Spawn Smiley ] [ Mine no Hidden | no Border no Number ] -> [ Spawn Smiley ] [ Mine | MineT ] SFX0
down [ Spawn Smiley ] [ Mine no Hidden | no Border no Number ] -> [ Spawn Smiley ] [ Mine | MineB ] SFX0
( Create numbers based on mines immediately adjacent )
[ no Border no Number no Mine MineL MineR MineT MineB ] -> [ MineL MineR MineT MineB 4 ]
[ no Border no Number no Mine MineL MineR MineT ] -> [ MineL MineR MineT 3 ]
[ no Border no Number no Mine MineL MineR MineB ] -> [ MineL MineR MineB 3 ]
[ no Border no Number no Mine MineL MineB MineT ] -> [ MineL MineB MineT 3 ]
[ no Border no Number no Mine MineR MineB MineT ] -> [ MineR MineB MineT 3 ]
[ no Border no Number no Mine MineL MineR ] -> [ MineL MineR 2 ]
[ no Border no Number no Mine MineL MineT ] -> [ MineL MineT 2 ]
[ no Border no Number no Mine MineL MineB ] -> [ MineL MineB 2 ]
[ no Border no Number no Mine MineR MineB ] -> [ MineR MineB 2 ]
[ no Border no Number no Mine MineR MineT ] -> [ MineR MineT 2 ]
[ no Border no Number no Mine MineT MineB ] -> [ MineT MineB 2 ]
[ no Border no Number no Mine MineL ] -> [ MineL 1 ]
[ no Border no Number no Mine MineR ] -> [ MineR 1 ]
[ no Border no Number no Mine MineT ] -> [ MineT 1 ]
[ no Border no Number no Mine MineB ] -> [ MineB 1 ]
[ no Border no Number no Mine ] -> [ 0 ]
( Adjust for diagonals )
up [ 7 | MineL ] [ Spawn Smiley ] -> [ 8 | MineL ] [ Spawn Smiley ]
up [ 6 | MineL ] [ Spawn Smiley ] -> [ 7 | MineL ] [ Spawn Smiley ]
up [ 5 | MineL ] [ Spawn Smiley ] -> [ 6 | MineL ] [ Spawn Smiley ]
up [ 4 | MineL ] [ Spawn Smiley ] -> [ 5 | MineL ] [ Spawn Smiley ]
up [ 3 | MineL ] [ Spawn Smiley ] -> [ 4 | MineL ] [ Spawn Smiley ]
up [ 2 | MineL ] [ Spawn Smiley ] -> [ 3 | MineL ] [ Spawn Smiley ]
up [ 1 | MineL ] [ Spawn Smiley ] -> [ 2 | MineL ] [ Spawn Smiley ]
up [ 0 | MineL ] [ Spawn Smiley ] -> [ 1 | MineL ] [ Spawn Smiley ]
up [ 7 | MineR ] [ Spawn Smiley ] -> [ 8 | MineR ] [ Spawn Smiley ]
up [ 6 | MineR ] [ Spawn Smiley ] -> [ 7 | MineR ] [ Spawn Smiley ]
up [ 5 | MineR ] [ Spawn Smiley ] -> [ 6 | MineR ] [ Spawn Smiley ]
up [ 4 | MineR ] [ Spawn Smiley ] -> [ 5 | MineR ] [ Spawn Smiley ]
up [ 3 | MineR ] [ Spawn Smiley ] -> [ 4 | MineR ] [ Spawn Smiley ]
up [ 2 | MineR ] [ Spawn Smiley ] -> [ 3 | MineR ] [ Spawn Smiley ]
up [ 1 | MineR ] [ Spawn Smiley ] -> [ 2 | MineR ] [ Spawn Smiley ]
up [ 0 | MineR ] [ Spawn Smiley ] -> [ 1 | MineR ] [ Spawn Smiley ]
down [ 7 | MineL ] [ Spawn Smiley ] -> [ 8 | MineL ] [ Spawn Smiley ]
down [ 6 | MineL ] [ Spawn Smiley ] -> [ 7 | MineL ] [ Spawn Smiley ]
down [ 5 | MineL ] [ Spawn Smiley ] -> [ 6 | MineL ] [ Spawn Smiley ]
down [ 4 | MineL ] [ Spawn Smiley ] -> [ 5 | MineL ] [ Spawn Smiley ]
down [ 3 | MineL ] [ Spawn Smiley ] -> [ 4 | MineL ] [ Spawn Smiley ]
down [ 2 | MineL ] [ Spawn Smiley ] -> [ 3 | MineL ] [ Spawn Smiley ]
down [ 1 | MineL ] [ Spawn Smiley ] -> [ 2 | MineL ] [ Spawn Smiley ]
down [ 0 | MineL ] [ Spawn Smiley ] -> [ 1 | MineL ] [ Spawn Smiley ]
down [ 7 | MineR ] [ Spawn Smiley ] -> [ 8 | MineR ] [ Spawn Smiley ]
down [ 6 | MineR ] [ Spawn Smiley ] -> [ 7 | MineR ] [ Spawn Smiley ]
down [ 5 | MineR ] [ Spawn Smiley ] -> [ 6 | MineR ] [ Spawn Smiley ]
down [ 4 | MineR ] [ Spawn Smiley ] -> [ 5 | MineR ] [ Spawn Smiley ]
down [ 3 | MineR ] [ Spawn Smiley ] -> [ 4 | MineR ] [ Spawn Smiley ]
down [ 2 | MineR ] [ Spawn Smiley ] -> [ 3 | MineR ] [ Spawn Smiley ]
down [ 1 | MineR ] [ Spawn Smiley ] -> [ 2 | MineR ] [ Spawn Smiley ]
down [ 0 | MineR ] [ Spawn Smiley ] -> [ 1 | MineR ] [ Spawn Smiley ]
( Remove mine markers )
[ MineMarker ] -> [ ]
( Remove zeros )
[ 0 no Timer no Count ] -> [ ]
( Create hiddens )
[ Spawn no Smiley ] -> [ Hidden ]
[ Spawn Smiley ] [ Mine ] -> [ Spawn Smiley ] [ Mine Hidden ]
[ Spawn Smiley ] [ Number no Count no Timer ] -> [ Spawn Smiley ] [ Number Hidden ]
( Move player and remove last spawn )
[ Spawn Smiley Player ] [ Hidden ] -> [ Smiley ] [ Hidden Player ]
( Player actions )
( Stop Player from moving into borders )
[ > Player | Border ] -> cancel
( Stop Player from moving off smiley )
[ > Player Smiley ] -> cancel
( Cancel if nothing to unhide )
[ action Player no Hidden ] -> cancel
( Unhide mine player is on and create red background )
[ action Player Hidden Flag Mine ] -> [ Player action Mine Red ]
( Unhide empty space [or number] )
[ action Player Hidden Flag no Mine Background ] -> [ Player action Background ]
( Flag )
[ action Player Hidden no Flag ] -> [ Player Hidden Flag ]
( When uncovering a mine )
( Unhide all mines )
[ action Mine ] [ Mine ] -> [ action Mine ] [ action Mine no Hidden no Flag ]
( Set to sad face )
[ action Mine ] [ Happy ] -> [ action Mine ] [ Sad ]
( Move player )
[ action Mine ] [ Player no Sad ] [ Sad ] -> [ action Mine ] [ ] [ Player Sad ]
( Clear action )
[ action Mine ] -> [ stationary Mine ]
( When uncovering an empty space )
( Flood fill )
[ Background Hidden | action Background no Hidden no Number ] -> [ action Background no Flag | action Background ]
( Check for win condition: all mines are flagged [and no empty spaces are flagged] )
( Set action on all tiles with Mine and Flag )
[ Mine Flag ] -> [ action Mine action Flag ]
( If any mines or flags are alone then unset all )
[ stationary Mine ] [ action Mine ] -> [ Mine ] [ Mine ]
[ stationary Mine ] [ action Flag ] -> [ Mine ] [ Flag ]
[ stationary Flag ] [ action Mine ] -> [ Flag ] [ Mine ]
[ stationary Flag ] [ action Flag ] -> [ Flag ] [ Flag ]
( If some are still set, we've won! Move the player )
[ action Mine ] [ Player no Happy ] [ Happy ] -> [ action Mine ] [ ] [ Player Happy ]
( Check for win condition: all empty spaces are revealed )
( Set action on all tiles with Mine and Hidden )
[ Mine Hidden ] -> [ action Mine action Hidden ]
( If any hiddens are alone then unset all )
[ stationary Hidden ] [ action Hidden ] -> [ Hidden ] [ Hidden ]
[ stationary Hidden ] [ action Mine ] -> [ Hidden ] [ Mine ]
( If some are still set, we've won! Move the player )
[ action Mine ] [ Player no Happy ] [ Happy ] -> [ action Mine ] [ ] [ Player Happy ]
( Mine counter )
( Reset mine count to 0 )
[ Count Number | Count Number | Count Number ] -> [ Count 0 | Count 0 | Count 0 ]
( Clear action )
[ action Flag ] -> [ Flag ]
[ action Mine ] -> [ Mine ]
( Count mines )
startloop
random right [ Count | no Count ] [ stationary Mine ] -> [ action Count | no Count ] [ action Mine ]
[ action Count 0 ] -> [ Count 1 ]
[ action Count 1 ] -> [ Count 2 ]
[ action Count 2 ] -> [ Count 3 ]
[ action Count 3 ] -> [ Count 4 ]
[ action Count 4 ] -> [ Count 5 ]
[ action Count 5 ] -> [ Count 6 ]
[ action Count 6 ] -> [ Count 7 ]
[ action Count 7 ] -> [ Count 8 ]
[ action Count 8 ] -> [ Count 9 ]
right [ Count | action Count 9 ] -> [ action Count | Count 0 ]
endloop
( Subtract flags from mine count )
startloop
random right [ Count | no Count ] [ stationary Flag ] -> [ action Count | no Count ] [ action Flag ]
[ Count 0 | Count 0 | Count 0 ] -> [ stationary Count 0 | stationary Count 0 | stationary Count 0 ]
[ action Count 9 ] -> [ Count 8 ]
[ action Count 8 ] -> [ Count 7 ]
[ action Count 7 ] -> [ Count 6 ]
[ action Count 6 ] -> [ Count 5 ]
[ action Count 5 ] -> [ Count 4 ]
[ action Count 4 ] -> [ Count 3 ]
[ action Count 3 ] -> [ Count 2 ]
[ action Count 2 ] -> [ Count 1 ]
[ action Count 1 ] -> [ Count 0 ]
right [ Count | action Count 0 ] -> [ action Count | Count 9 ]
endloop
==============
WINCONDITIONS
==============
=======
LEVELS
=======
┌---------┐
|ccc.o.ttt|
|---------|
|#########|
|#########|
|#########|
|#########|
|#########|
|#########|
|#########|
|#########|
|#########|
└---------┘
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment