Skip to content

Instantly share code, notes, and snippets.

@inventortimer
Created May 26, 2024 20:12
Show Gist options
  • Save inventortimer/a13b1612079f3cbe6500bd4c019a7849 to your computer and use it in GitHub Desktop.
Save inventortimer/a13b1612079f3cbe6500bd4c019a7849 to your computer and use it in GitHub Desktop.
The Cable Guy (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
title The Cable Guy
author 4sandwiches
homepage https://store.steampowered.com/app/2541310/The_Cable_Guy
(debug)
again_interval 0.05
verbose_logging
========
OBJECTS
========
(TODOs:
- Save Source when connecting switch
- Add another color of cable (red and maybe green) and then allow only vertical and horizontal overlap and maybe cross section
-
)
(Ideas:
- Create repeater/switch: allows to split single cable into 3
- Door should open after clearing the level and allow choosing next level? Or pass cable thrugh it?
)
Background
orange lightbrown orange
00000
01112
01112
01102
02222
WallV
lightgray gray
.101.
.101.
.101.
.101.
.101.
WallH
lightgray gray
.....
11111
00000
11111
.....
WallUL
lightgray gray
.101.
1101.
0001.
1111.
.....
WallDR
lightgray gray
.....
.1111
.1000
.1011
.101.
WallUR
lightgray gray
.101.
.1011
.1000
.1111
.....
WallDL
lightgray gray
.....
1111.
0001.
1101.
.101.
Column
lightgray gray
11111
10001
10001
10001
11111
WindowV
lightblue lightblue white lightgray
.313.
.323.
.313.
.313.
.313.
WindowH
lightblue white lightgray
.....
22222
01000
22222
.....
DoorH
darkbrown
.....
.....
00000
.....
.....
DoorV
darkbrown
..0..
..0..
..0..
..0..
..0..
Plant
darkbrown brown green
22.22
.222.
..2..
11111
.000.
Water
lightgray gray blue lightblue
.223.
.222.
.222.
.010.
.000.
UnconnectedBluePC
lightblue darkgray
00000
01110
00000
.000.
00000
ConnectedBluePC
lightblue blue
00000
01110
00000
.000.
00000
Wall
brown darkbrown
00010
11111
01000
11111
00010
ServerB
black orange blue grey
33333
32223
33333
32223
33333
NonActivePlayer
white
00.00
0...0
.....
0...0
00.00
DeletingPlayer
white
.....
.0.0.
..0..
.0.0.
.....
ActiveBluePlayer
blue
00.00
0...0
.....
0...0
00.00
ConnectedCableVB
blue
..0..
..0..
..0..
..0..
..0..
ConnectedCableHB
blue
.....
.....
00000
.....
.....
(
ConnectedCableDLB
blue
.....
.....
000..
..0..
..0..
ConnectedCableDRB
blue
.....
.....
..000
..0..
..0..
ConnectedCableULB
blue
..0..
..0..
000..
.....
.....
ConnectedCableURB
blue
..0..
..0..
..000
.....
.....
)
ConnectedCableLVB
blue
..0..
..0..
000..
..0..
..0..
ConnectedCableRVB
blue
..0..
..0..
..000
..0..
..0..
ConnectedCableDHB
blue
.....
.....
00000
..0..
..0..
ConnectedCableUHB
blue
..0..
..0..
00000
.....
.....
ConnectedCableCB
blue
..0..
..0..
00000
..0..
..0..
UnconnectedCableD
gray
.....
.....
..0..
..0..
..0..
UnconnectedCableU
gray
..0..
..0..
..0..
.....
.....
UnconnectedCableR
gray
.....
.....
..000
.....
.....
UnconnectedCableL
gray
.....
.....
000..
.....
.....
ConnectedCableDB
blue
.....
.....
..0..
..0..
..0..
ConnectedCableUB
blue
..0..
..0..
..0..
.....
.....
ConnectedCableRB
blue
.....
.....
..000
.....
.....
ConnectedCableLB
blue
.....
.....
000..
.....
.....
SourceD
transparent
SourceU
transparent
SourceL
transparent
SourceR
transparent
EraserL
transparent
EraserR
transparent
EraserD
transparent
EraserU
transparent
InactiveRepeater
gray lightgray darkgray
..1..
.000.
10201
.000.
..1..
RepeaterB
gray blue darkgray
..1..
..0..
10201
..0..
..1..
=======
LEGEND
=======
player = ActiveBluePlayer or NonActivePlayer or DeletingPlayer
ConnectedBlueCable = ConnectedCableUB or ConnectedCableDB or ConnectedCableLB or ConnectedCableRB
ConnectedBlueCableUnused = ConnectedCableVB or ConnectedCableHB or ConnectedCableLVB or ConnectedCableRVB or ConnectedCableDHB or ConnectedCableUHB or ConnectedCableCB
UnconnectedCable = UnconnectedCableD or UnconnectedCableU or UnconnectedCableR or UnconnectedCableL
Source = SourceD or SourceL or SourceR or SourceU
Eraser = EraserD or EraserL or EraserR or EraserU
WallD = WallV or WallH or WallDR or WallDL or WallUR or WallUL
Window = WindowV or WindowH
Door = DoorH or DoorV
EraserV = EraserU or EraserD
EraserH = EraserL or EraserR
Obstacle = WallD or Window or Plant or Water or Door or Column or Wall
Repeater = InactiveRepeater or RepeaterB
ActiveRepeater = RepeaterB
Server = ServerB or RepeaterB
. = Background
# = Wall
S = ServerB
C = ServerB and NonActivePlayer
N = NonActivePlayer
U = UnconnectedBluePC
8 = WallV
6 = WallH
3 = WallDR
1 = WallDL
7 = WallUL
9 = WallUR
4 = WindowV
2 = WindowH
5 = Plant
B = Water
H = DoorH
D = DoorV
L = Column
R = InactiveRepeater
=======
SOUNDS
=======
ActiveBluePlayer move 10467107
NonActivePlayer move 36772507
Player CantMove 4123412
Cancel 4123412
sfx0 40707106
sfx1 10467107
sfx2 4123412 (No movement)
sfx3 113500
sfx4 2868907 (Remove cable)
================
COLLISIONLAYERS
================
Background
EraserL
EraserR
EraserD
EraserU
Source
ConnectedCableUB, UnconnectedCableU
ConnectedCableDB, UnconnectedCableD
ConnectedCableRB, UnconnectedCableR
ConnectedCableLB, UnconnectedCableL
UnconnectedBluePC, ConnectedBluePC, Server, Repeater
ConnectedBlueCableUnused
player, obstacle
======
RULES
======
(Player actions)
[Action NonActivePlayer Server] -> [ActiveBluePlayer Server] sfx0
[Action ActiveBluePlayer] -> [NonActivePlayer]
late [NonActivePlayer connectedbluecable] -> [DeletingPlayer connectedbluecable]
late [DeletingPlayer NO connectedbluecable] -> [NonActivePlayer NO connectedbluecable]
([Action NonActivePlayer connectedbluecable] -> [NonActivePlayer Background])
([Action NonActivePlayer connectedbluecable | ... | connectedbluecable] -> [NonActivePlayer | ... | Background])
(Erase active connection)
[Action DeletingPlayer connectedcableLB connectedcableRB] -> [NonActivePlayer NO connectedcableLB NO connectedcableRB LEFT EraserL RIGHT EraserR]
[Action DeletingPlayer connectedcableUB connectedcableDB] -> [NonActivePlayer NO connectedcableUB NO connectedcableDB UP EraserU DOWN EraserD]
[Action DeletingPlayer connectedcableLB connectedcableUB] -> [NonActivePlayer NO connectedcableLB NO connectedcableUB LEFT EraserL UP EraserU]
[Action DeletingPlayer connectedcableRB connectedcableUB] -> [NonActivePlayer NO connectedcableRB NO connectedcableUB RIGHT EraserR UP EraserU]
[Action DeletingPlayer connectedcableLB connectedcableDB] -> [NonActivePlayer NO connectedcableLB NO connectedcableDB LEFT EraserL DOWN EraserD]
[Action DeletingPlayer connectedcableRB connectedcableDB] -> [NonActivePlayer NO connectedcableRB NO connectedcableDB RIGHT EraserR DOWN EraserD]
[Action DeletingPlayer connectedcableRB] -> [NonActivePlayer NO connectedcableRB RIGHT EraserR]
[Action DeletingPlayer connectedcableLB] -> [NonActivePlayer NO connectedcableRB LEFT EraserL]
[Action DeletingPlayer connectedcableUB] -> [NonActivePlayer NO connectedcableRB UP EraserU]
[Action DeletingPlayer connectedcableDB] -> [NonActivePlayer NO connectedcableRB DOWN EraserD]
LEFT [LEFT EraserL | ActiveRepeater SourceR] -> [ | InactiveRepeater]
RIGHT [RIGHT EraserR | ActiveRepeater SourceL] -> [ | InactiveRepeater]
DOWN[DOWN EraserD | ActiveRepeater SourceU] -> [ | InactiveRepeater]
UP [UP EraserU | ActiveRepeater SourceD] -> [ | InactiveRepeater]
UP [InactiveRepeater | ConnectedCableDB] -> [InactiveRepeater | EraserU ConnectedCableDB]
DOWN [InactiveRepeater | ConnectedCableUB] -> [InactiveRepeater | EraserD ConnectedCableUB]
LEFT [InactiveRepeater | ConnectedCableRB] -> [InactiveRepeater | EraserL ConnectedCableRB]
RIGHT [InactiveRepeater | ConnectedCableLB] -> [InactiveRepeater | EraserR ConnectedCableLB]
RIGHT [RIGHT EraserR | connectedcableLB] -> [ | EraserR connectedcableLB]
LEFT [LEFT EraserL | connectedcableRB] -> [ | EraserL connectedcableRB]
UP [UP EraserU | connectedcableDB] -> [ | EraserU connectedcableDB]
DOWN [DOWN EraserD | connectedcableUB] -> [ | EraserD connectedcableUB]
[EraserL connectedcableRB connectedcableDB] -> [DOWN EraserD] again sfx4
[EraserL connectedcableRB connectedcableUB] -> [UP EraserU] again sfx4
[EraserL connectedcableRB connectedcableLB] -> [LEFT EraserL] again sfx4
[EraserR connectedcableLB connectedcableDB] -> [DOWN EraserD] again sfx4
[EraserR connectedcableLB connectedcableUB] -> [UP EraserU] again sfx4
[EraserR connectedcableLB connectedcableRB] -> [RIGHT EraserR] again sfx4
[EraserU connectedcableDB connectedcableRB] -> [RIGHT EraserR] again sfx4
[EraserU connectedcableDB connectedcableLB] -> [LEFT EraserL] again sfx4
[EraserU connectedcableDB connectedcableUB] -> [UP EraserU] again sfx4
[EraserD connectedcableUB connectedcableRB] -> [RIGHT EraserR] again sfx4
[EraserD connectedcableUB connectedcableLB] -> [LEFT EraserL] again sfx4
[EraserD connectedcableUB connectedcableDB] -> [DOWN EraserD] again sfx4
[EraserL ConnectedBluePC] -> [UnconnectedBluePC]
[EraserR ConnectedBluePC] -> [UnconnectedBluePC]
[EraserD ConnectedBluePC] -> [UnconnectedBluePC]
[EraserU ConnectedBluePC] -> [UnconnectedBluePC]
(
[EraserR connectedcableRB] -> [RIGHT EraserR]
[EraserL connectedcableLB] -> [LEFT EraserL]
[EraserU connectedcableUB] -> [UP EraserU]
[EraserD connectedcableDB] -> [DOWN EraserD]
)
[EraserR connectedbluecable] -> [ ]
[EraserL connectedbluecable] -> [ ]
[EraserU connectedbluecable] -> [ ]
[EraserD connectedbluecable] -> [ ]
[Eraser Server] -> [Server]
(Server rules)
(Server = BlueServer, RedServer...)
[> ActiveBluePlayer Server | connectedbluecable] -> [ActiveBluePlayer Server | connectedbluecable] sfx2
UP [UP ActiveBluePlayer Server | NO Obstacle] -> [UP ActiveBluePlayer Server | ConnectedCableDB NO Obstacle] sfx1
DOWN [DOWN ActiveBluePlayer Server | NO Obstacle] -> [DOWN ActiveBluePlayer Server | ConnectedCableUB NO Obstacle]sfx1
LEFT [LEFT ActiveBluePlayer Server | NO Obstacle] -> [LEFT ActiveBluePlayer Server | ConnectedCableRB NO Obstacle] sfx1
RIGHT [RIGHT ActiveBluePlayer Server | NO Obstacle] -> [RIGHT ActiveBluePlayer Server | ConnectedCableLB NO Obstacle] sfx1
(Repeater/Switch rules)
(late [ActiveBluePlayer InactiveRepeater connectedbluecable] -> [NonActivePlayer RepeaterB])
late [ActiveBluePlayer activerepeater connectedbluecable] -> cancel
UP [UP ActiveBluePlayer | InactiveRepeater] -> [ConnectedCableUB | ActiveBluePlayer RepeaterB SourceD] sfx1
DOWN [DOWN ActiveBluePlayer | InactiveRepeater] -> [ConnectedCableDB | ActiveBluePlayer RepeaterB SourceU]sfx1
LEFT [LEFT ActiveBluePlayer | InactiveRepeater] -> [ConnectedCableLB | ActiveBluePlayer RepeaterB SourceR] sfx1
RIGHT [RIGHT ActiveBluePlayer | InactiveRepeater] -> [ConnectedCableRB | ActiveBluePlayer RepeaterB SourceL] sfx1
(Cable rules)
(Down)
LEFT [LEFT ActiveBluePlayer ConnectedCableDB | NO Obstacle] -> [ConnectedCableDB ConnectedCableLB | ActiveBluePlayer ConnectedCableRB NO Obstacle] sfx1
RIGHT [RIGHT ActiveBluePlayer ConnectedCableDB | NO Obstacle] -> [ConnectedCableDB ConnectedCableRB | ActiveBluePlayer ConnectedCableLB NO Obstacle] sfx1
UP [UP ActiveBluePlayer ConnectedCableDB | NO Obstacle] -> [ConnectedCableDB ConnectedCableUB | ActiveBluePlayer ConnectedCableDB NO Obstacle] sfx1
DOWN [DOWN ActiveBluePlayer ConnectedCableDB | NO Obstacle] -> [ActiveBluePlayer ConnectedCableDB | NO Obstacle] sfx2
(Up)
LEFT [LEFT ActiveBluePlayer ConnectedCableUB | NO Obstacle] -> [ConnectedCableUB ConnectedCableLB | ActiveBluePlayer ConnectedCableRB NO Obstacle] sfx1
RIGHT [RIGHT ActiveBluePlayer ConnectedCableUB | NO Obstacle] -> [ConnectedCableUB ConnectedCableRB | ActiveBluePlayer ConnectedCableLB NO Obstacle] sfx1
DOWN [DOWN ActiveBluePlayer ConnectedCableUB | NO Obstacle] -> [ConnectedCableUB ConnectedCableDB | ActiveBluePlayer ConnectedCableUB NO Obstacle] sfx1
UP [UP ActiveBluePlayer ConnectedCableUB | NO Obstacle] -> [ActiveBluePlayer ConnectedCableUB | NO Obstacle] sfx2
(Left)
RIGHT [RIGHT ActiveBluePlayer ConnectedCableLB | NO Obstacle] -> [ConnectedCableLB ConnectedCableRB | ActiveBluePlayer ConnectedCableLB NO Obstacle] sfx1
LEFT [LEFT ActiveBluePlayer ConnectedCableLB | NO Obstacle] -> [ActiveBluePlayer ConnectedCableLB| NO Obstacle] sfx2
DOWN [DOWN ActiveBluePlayer ConnectedCableLB | NO Obstacle] -> [ConnectedCableLB ConnectedCableDB | ActiveBluePlayer ConnectedCableUB NO Obstacle] sfx1
UP [UP ActiveBluePlayer ConnectedCableLB | NO Obstacle] -> [ConnectedCableLB ConnectedCableUB | ActiveBluePlayer ConnectedCableDB NO Obstacle] sfx1
(Right)
LEFT [LEFT ActiveBluePlayer ConnectedCableRB | NO Obstacle] -> [ConnectedCableRB ConnectedCableLB | ActiveBluePlayer ConnectedCableRB NO Obstacle] sfx1
RIGHT [RIGHT ActiveBluePlayer ConnectedCableRB | NO Obstacle] -> [ActiveBluePlayer ConnectedCableRB | NO Obstacle] sfx2
DOWN [DOWN ActiveBluePlayer ConnectedCableRB | NO Obstacle] -> [ConnectedCableRB ConnectedCableDB | ActiveBluePlayer ConnectedCableUB NO Obstacle] sfx1
UP [UP ActiveBluePlayer ConnectedCableRB | NO Obstacle] -> [ConnectedCableRB ConnectedCableUB | ActiveBluePlayer ConnectedCableDB NO Obstacle] sfx1
[ActiveBluePlayer ConnectedCableLB ConnectedCableRB ConnectedCableUB ] -> CANCEL
[ActiveBluePlayer ConnectedCableLB ConnectedCableRB ConnectedCableDB ] -> CANCEL
[ActiveBluePlayer ConnectedCableLB ConnectedCableUB ConnectedCableDB ] -> CANCEL
[ActiveBluePlayer ConnectedCableRB ConnectedCableUB ConnectedCableDB ] -> CANCEL
( [ ConnectedCableLB ConnectedCableRB ConnectedCableUB] CANCEL )(message "Shortcircuit! Don't overlap cables of the same color.")
(
LEFT [LEFT ActiveBluePlayer ConnectedCableVB | Background] -> [LEFT ActiveBluePlayer ConnectedCableLVB | ConnectedCableHB SourceR Background]
RIGHT [RIGHT ActiveBluePlayer ConnectedCableVB | Background] -> [RIGHT ActiveBluePlayer ConnectedCableRVB | ConnectedCableHB SourceL Background]
UP [UP ActiveBluePlayer ConnectedCableVB | Background] -> [UP ActiveBluePlayer ConnectedCableVB | ConnectedCableVB SourceU Background]
DOWN [DOWN ActiveBluePlayer ConnectedCableVB | Background] -> [DOWN ActiveBluePlayer ConnectedCableVB | ConnectedCableVB SourceD Background]
)
([> ActiveBluePlayer | connectedbluecable] -> [ActiveBluePlayer | conn])
(
LEFT [LEFT ActiveBluePlayer ConnectedCableRVB | Background] -> [ConnectedCableCB | ActiveBluePlayer ConnectedCableHB Background]
)
(
RIGHT [RIGHT ActiveBluePlayer ConnectedCableUHB | Background] -> [ConnectedCableRVB | ActiveBluePlayer ConnectedCableHB Background]
)
(
RIGHT [RIGHT ActiveBluePlayer ConnectedCableHB | Background] -> [ConnectedCableHB | ActiveBluePlayer ConnectedCableHB Background]
RIGHT [RIGHT ActiveBluePlayer ConnectedCableVB | Background] -> [ConnectedCableDHB | ActiveBluePlayer ConnectedCableHB Background]
UP [UP ActiveBluePlayer ConnectedCableHB | Background] -> [ConnectedCableUHB | ActiveBluePlayer ConnectedCableVB Background]
)
(PC connection)
late [ActiveBluePlayer UnconnectedBluePC connectedbluecable | ConnectedBlueCable] -> [NonActivePlayer ConnectedBluePC no connectedbluecable | connectedbluecable] sfx3
late [ActiveBluePlayer ConnectedBluePC] -> cancel
(
late [NonActivePlayer ConnectedBluePC ConnectedCableLB ConnectedCableRB ConnectedCableUB ] -> CANCEL
late [ConnectedBluePC ConnectedCableRB ConnectedCableDB ] -> CANCEL
late [NonActivePlayer ConnectedBluePC ConnectedCableLB ConnectedCableUB ConnectedCableDB ] -> CANCEL
late [NonActivePlayer ConnectedBluePC ConnectedCableRB ConnectedCableUB ConnectedCableDB ] -> CANCEL
)
(
late [ConnectedBluePC SourceR | NO ConnectedCableLB] -> [UnconnectedBluePC | NO ConnectedCableLB] sfx3
EraserShould unplug PC instead
)
==============
WINCONDITIONS
==============
No UnconnectedBluePC
=======
LEVELS
=======
message Connect blue PC to the blue Server
l666h6l
8..u..8
8.....8
8..n..8
8..s..8
l66666l
(
l666666h66l
8.........8
8.........8
8....u....8
d.........8
8....n....8
8....s....8
8.........8
8.........8
l666666666l
)
(
l666h6l
8..u..8
8.....8
8..n..8
8..s..8
l66666l
)
(
l666h6666666l
8...........8
8...........8
8.....u.....8
8..l.....l..d
8...........8
8.....n.....8
8...........8
d..l.....l..8
8.....s.....8
8...........8
8...........8
l6666666h666l
)
(
3666h66666661
8...........8
8...........8
8.....u.....8
8...........d
8...........8
8.....n.....8
8...........8
d...........8
8.....s.....8
8...........8
8...........8
96666666h6667
)
message "Congrats! Level 2: Connect all PCs"
l66666h6l
8...u...8
8.l...l.8
8u8.c.8u8
8.l...l.8
8...u...8
l6h66666l
message Congrats! Level 3
l66666h6l
8u.....u8
8.......8
8u.snr.u8
8.......8
8u.....u8
l6h66666l
(
3666h66666661
8u.........u8
8...........8
8...........8
8...........d
8...........8
8.....s.....8
8...........8
d...........8
8.....n.....8
8...........8
8u.........u8
96666666h6667
3666h6666661
8uub...5uuu8
8..........8
8..........8
8..........d
8u........u8
8.....s....8
8u....n...u8
d..........8
8..........8
8..........8
85uuu.....u8
96666666h667
3666h6666661
8uub...5uuu8
8..........8
8..........8
8..........d
8....361...8
8....8s8...8
8..........8
d..........8
8..........8
8....n.....8
85uuu.....u8
96666666h667
366626666661
8..........8
4..........4
4.....u....4
4..........4
8....361...8
8....8s8...8
8..........8
4..........4
4.....n....4
4..........4
8..........8
96666666h667
............
............
............
......u.....
............
............
......s.....
............
......n.....
............
............
............
............
#######
#..u..#
#.....#
#.....#
#..s..#
#.....#
#..n..#
#.....#
#######
#######
#..u..#
#.....#
#..n..#
#.....#
#..s..#
#######
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment