Skip to content

Instantly share code, notes, and snippets.

@thelast19digitsofpi
Created July 11, 2022 23:47
Show Gist options
  • Save thelast19digitsofpi/61a693080058330290584d0f816f8530 to your computer and use it in GitHub Desktop.
Save thelast19digitsofpi/61a693080058330290584d0f816f8530 to your computer and use it in GitHub Desktop.
Find And Also Destroy (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
title Find And Also Destroy
author thelast19digitsofpi
run_rules_on_level_start
(realtime is just for automatic stuff)
realtime_interval 0.01
noundo
key_repeat_interval 0.4
========
OBJECTS
========
Background
lightgray
Sea1
#39f #5af
10000
00000
00011
01110
11000
Sea2
#39f #5af
00111
00100
11000
00000
00001
InitializationOfSubs
red
Sub
transparent (you can't see it, of course!)
SubDead
#38d #5a5
00000
00100
01010
00100
00000
(Distance markers)
Distance1
#600
..0..
.00..
..0..
..0..
.000.
Distance2
#500
.00..
...0.
..0..
.0...
.000.
Distance3
#400
.00..
...0.
..0..
...0.
.00..
Distance4
#300
.0.0.
.0.0.
.000.
...0.
...0.
Distance5
#200
.000.
.0...
.00..
...0.
.00..
Distance6
#100
..00.
.0...
.00..
.0.0.
..0..
Distance7
#000
.000.
...0.
..0..
..0..
..0..
Distance8
black
.000.
.0.0.
.000.
.0.0.
.000.
Distance9
black
..0..
.0.0.
..00.
...0.
..0..
Distance10OrMore
black
..0..
..0..
00000
..0..
..0..
(Marker for clear spots)
DefinitelyNoSub
#555
.....
.....
..0..
.....
.....
(Breadth-first search)
BFSGo
transparent
BFS0
transparent
BFS1
transparent
BFS2
transparent
BFS3
transparent
BFS4
transparent
BFS5
transparent
BFS6
transparent
BFS7
transparent
BFS8
transparent
BFS9
transparent
Wall
brown
(standard cursor)
Player
#060
00.00
0...0
.....
0...0
00.00
(Display digits)
0
white
..0..
.0.0.
.0.0.
.0.0.
..0..
1
white
..0..
.00..
..0..
..0..
.000.
2
white
.00..
...0.
..0..
.0...
.000.
3
white
.00..
...0.
..0..
...0.
.00..
4
white
.0.0.
.0.0.
.000.
...0.
...0.
5
white
.000.
.0...
.00..
...0.
.00..
6
white
..00.
.0...
.00..
.0.0.
..0..
7
white
.000.
...0.
..0..
..0..
..0..
8
white
.000.
.0.0.
.000.
.0.0.
.000.
9
white
..0..
.0.0.
..00.
...0.
..0..
Decrease
yellow
.....
.....
.....
.....
00000
Increase3
transparent
Increase1
transparent
ScansTen
#050
ScansOne
#050
MinesTen
#800
MinesOne
#600
DigitStorageTen
black
DigitStorageOne
darkblue
Help
black #6f6
01110
10001
00110
00000
00100
=======
LEGEND
=======
! = InitializationOfSubs
DigitStorage = DigitStorageTen or DigitStorageOne
Sea = Sea1 or Sea2
ScansPlace = ScansTen or ScansOne
T = ScansTen and 0
S = ScansOne and 0
MinesPlace = MinesTen or MinesOne
N = MinesTen and 0
M = MinesOne and 0
L = DigitStorageTen
K = DigitStorageOne
Distance = Distance1 or Distance2 or Distance3 or Distance4 or Distance5 or Distance6 or Distance7 or Distance8 or Distance9 or Distance10OrMore
BFS = BFS0 or BFS1 or BFS2 or BFS3 or BFS4 or BFS5 or BFS6 or BFS7 or BFS8 or BFS9
Digit = 0 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9
. = Sea1
# = Wall
P = Sea1 and Player
Q = Wall and Player
? = Help
=======
SOUNDS
=======
sfx0 71841701
sfx1 50219506
================
COLLISIONLAYERS
================
Background
InitializationOfSubs
BFS, BFSGo
sea
Sub
SubDead
DefinitelyNoSub
Distance
ScansTen, ScansOne, MinesTen, MinesOne
Help
DigitStorageTen, DigitStorageOne
Decrease, Increase3, Increase1
Digit
Wall
Player
======
RULES
======
(Initialize the subs...)
vertical [InitializationOfSubs] [Digit | DigitStorage no Digit] -> [InitializationOfSubs] [MinesTen Digit | Digit DigitStorage]
RIGHT [MinesTen | MinesTen] -> [MinesTen | MinesOne]
(If you're being curious...)
[> Player | MinesPlace] -> [Player | MinesPlace] message That's the number of ships that have not been destroyed.
[> Player | ScansPlace] -> [Player | ScansPlace] message That's the number of scans you have left.
[> Player | Help] -> [Player | Help] message Move the cursor to a sea space and press X. The number is how many horizontal or vertical steps to the nearest
(Scanning.)
[Action Player Sea] [ScansOne] -> [Action Player Sea BFS0] [ScansOne Decrease]
(Did you hit?)
[BFS0 Sub] [MinesOne] -> [SubDead] [MinesOne Decrease] sfx0
[Action Player BFS0] -> [Action Player BFS0] sfx1
[Action Player] -> [Player]
(Breadth-first search here we go!)
[BFS0 | Sea no BFS] -> [BFS0 | Sea BFS1]
[BFS1 Sub] [BFS0] -> [Sub] [Distance1]
[BFS1] [BFS0] -> [BFS1 DefinitelyNoSub] [BFS0]
[BFS1 | Sea no BFS] [BFS0] -> [BFS1 | Sea BFS2] [BFS0]
[BFS2 Sub] [BFS0] -> [Sub] [Distance2]
[BFS2] [BFS0] -> [BFS2 DefinitelyNoSub] [BFS0]
[BFS2 | Sea no BFS] [BFS0] -> [BFS2 | Sea BFS3] [BFS0]
[BFS3 Sub] [BFS0] -> [Sub] [Distance3]
[BFS3] [BFS0] -> [BFS3 DefinitelyNoSub] [BFS0]
[BFS3 | Sea no BFS] [BFS0] -> [BFS3 | Sea BFS4] [BFS0]
[BFS4 Sub] [BFS0] -> [Sub] [Distance4]
[BFS4] [BFS0] -> [BFS4 DefinitelyNoSub] [BFS0]
[BFS4 | Sea no BFS] [BFS0] -> [BFS4 | Sea BFS5] [BFS0]
[BFS5 Sub] [BFS0] -> [Sub] [Distance5]
[BFS5] [BFS0] -> [BFS5 DefinitelyNoSub] [BFS0]
[BFS5 | Sea no BFS] [BFS0] -> [BFS5 | Sea BFS6] [BFS0]
[BFS6 Sub] [BFS0] -> [Sub] [Distance6]
[BFS6] [BFS0] -> [BFS6 DefinitelyNoSub] [BFS0]
[BFS6 | Sea no BFS] [BFS0] -> [BFS6 | Sea BFS7] [BFS0]
[BFS7 Sub] [BFS0] -> [Sub] [Distance7]
[BFS7] [BFS0] -> [BFS7 DefinitelyNoSub] [BFS0]
[BFS7 | Sea no BFS] [BFS0] -> [BFS7 | Sea BFS8] [BFS0]
[BFS8 Sub] [BFS0] -> [Sub] [Distance8]
[BFS8] [BFS0] -> [BFS8 DefinitelyNoSub] [BFS0]
[BFS8 | Sea no BFS] [BFS0] -> [BFS8 | Sea BFS9] [BFS0]
[BFS9 Sub] [BFS0] -> [Sub] [Distance9]
[BFS9] [BFS0] -> [BFS9 DefinitelyNoSub] [BFS0]
(found nothing?!)
[BFS0] [BFS9] -> [Distance10OrMore] [] message No subs found in range 9. The closest one is at least 10 away but it might be farther.
[BFS0] -> [DefinitelyNoSub] message Nothing in this pond. The scan can't pass through the dry land.
(cleanup)
[BFS] -> []
(All the ways to affect the digits.)
(Place a sub somewhere random)
random [InitializationOfSubs] [Sea no Sub] [DigitStorageOne] [ScansOne] -> [InitializationOfSubs] [Sea Sub] [DigitStorageOne Decrease] [ScansOne Increase3]
(decrease)
LEFT [0 Decrease | Digit] -> [9 | Digit Decrease]
(this should not happen.)
+ RIGHT [0 Decrease | Digit] [Player] -> [ | ] [] message Game over!
+ [1 Decrease] -> [0]
+ [2 Decrease] -> [1]
+ [3 Decrease] -> [2]
+ [4 Decrease] -> [3]
+ [5 Decrease] -> [4]
+ [6 Decrease] -> [5]
+ [7 Decrease] -> [6]
+ [8 Decrease] -> [7]
+ [9 Decrease] -> [8]
(increasements)
+ LEFT [7 Increase3 | Digit] -> [0 | Digit Increase1]
+ LEFT [8 Increase3 | Digit] -> [1 | Digit Increase1]
+ LEFT [9 Increase3 | Digit] -> [2 | Digit Increase1]
+ [0 Increase3] -> [3]
+ [1 Increase3] -> [4]
+ [2 Increase3] -> [5]
+ [3 Increase3] -> [6]
+ [4 Increase3] -> [7]
+ [5 Increase3] -> [8]
+ [6 Increase3] -> [9]
+ [0 Increase1] -> [1]
+ [1 Increase1] -> [2]
+ [2 Increase1] -> [3]
+ [3 Increase1] -> [4]
+ [4 Increase1] -> [5]
+ [5 Increase1] -> [6]
+ [6 Increase1] -> [7]
+ [7 Increase1] -> [8]
+ [8 Increase1] -> [9]
(special case for zero on the digit storage -- turn it off completely)
[DigitStorageTen 0 | DigitStorageOne 0] [InitializationOfSubs] -> [Wall | Wall] [Wall]
(adjust the seas)
late RIGHT [no Sea | Sea] -> [no Sea | Sea1]
late RIGHT [Sea1 | Sea1] -> [Sea1 | Sea2]
late RIGHT [Sea2 | Sea2] -> [Sea2 | Sea1]
(you lose)
late [ScansTen 0] [ScansOne 0] [Sub] [Player] -> [] [] [Sub] [] message You have failed to find all the subs. You lose! Press 'R' to restart.
==============
WINCONDITIONS
==============
no Sub
=======
LEVELS
=======
message Find all the enemy submarines. They all are single tiles.
message You have a limited number of shots (green number) so use them wisely.
message If you miss, you get the DISTANCE to the CLOSEST submarine. (Diagonal steps are not allowed, but the path can turn.)
message Move the cursor with the arrows and press X to scan. disable it.
message Move to the "?" space if you need help.
###....###
##......##
04......TS
LK......##
##....P.?#
!##....###
message Good, now try a 10x10 grid.
message Your scans have a maximum range of 9. A "+" means the nearest sub is AT LEAST 10 spaces away, but it could be more.
##..........##
##..........##
10..........TS
LK....P.....##
##..........##
##..........##
##..........##
##..........##
##..........##
!#..........?#
message I didn't say this game had to make any sense.
message You can "move" through dry land, but your scans cannot.
##...........###...##
##..###..#...#.#...##
20..#....#...###...TS
LK....####.........##
##.##..............##
###..#.....####...###
########....###....##
##..#..#.#.#.####...#
#.#....#......#.#.#.#
#....#....P...#.....#
#.............#######
##...#..#..##.#...#.#
##.....###...##.#.###
####.#######.##...###
#.##.#######.#####..#
####.........###....#
!####################
message You're not really boxed in.
#################
#...#...#...#...#
#.#...#...#...#.#
#...#...#...#...#
##.###########.##
#...#########...#
#.#.####Q####.#.#
#...#########...#
##.###12#ts###.##
#...##lk#####...#
#.#.#########.#.#
#...#########...#
##.###########.##
#...#...#...#...#
#.#...#...#...#.#
#...#...#...#...#
!################
message There are 33 submarines in 272 spaces.
##...................##
##...................##
##...#.....P.....#...##
33...................TS
LK...................##
##...................##
##........###........##
##........###........##
##........###........##
##...................##
##...................##
##...................##
##...#...........#...##
##...................##
!#...................?#
message All right, this is the last level. Kind of desolate, don't you think?
#####.............#####
####...............####
###.................###
##...................##
06.......#####.......TS
LK......#.....#......##
##......#.....#......##
##......#..Q..#......##
##......#.....#......##
##......#.....#......##
##.......#####.......##
##...................##
###.................###
####...............####
!####.............###?#
message You win!!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment