Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/Documentation/rules.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ <h3>Left-hand Side</h3>
<p>
The direction <b>DOWN</b> indicates what direction the pattern will be oriented.
<p>
One can also have ellipses in patterns, that allow for them to be variable length. Here's a lava gun that turns anyone in-line with it into a Corpse
One can also have ellipses in patterns, that allow for them to be variable length. Here's a lava gun that turns anyone in line with it into a Corpse:
<p>
<pre><code> late [ LavaGun | ... | Mortal ] -> [ LavaGun | ... | Corpse ]</code></pre>
<p>
Expand All @@ -137,7 +137,14 @@ <h3>Left-hand Side</h3>
<p>
and never finish compiling.
<p>
A technical point that might occasionally be relevant : ellipsis-based rules search from smallest to biggest.
A technical point that might occasionally be relevant : ellipsis-based rules search from smallest to biggest.
<p>
Also, it's possible to use two ellipses in a single pattern, such as stiff like this.
<pre><code>(92) [ > Player | ... | Crate | ... | Crate ] -> [ > Player | ... | > Crate | ... | Crate ]
</code></pre>
<p>
(Please be a little bit careful with using multiple ellipses in a single rule - it might get a bit slow).
<p>
<h3>Right-hand Side</h3>
If we had the following rule
<p>
Expand Down
22 changes: 11 additions & 11 deletions src/demo/constellationz.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ red
Teleport
white

target
Target
blue
.....
.000.
Expand All @@ -49,13 +49,13 @@ LEGEND
. = Background
P = Player
O = Teleport
t = target
t = Target

=========
SOUNDS
=========

sfx1 44641500 (teleport)
sfx1 44641500 (Teleport)
startgame 26858107
startlevel 34443107
endlevel 34292905
Expand All @@ -65,27 +65,27 @@ COLLISIONLAYERS
================

Background
Teleport,BorderTile, target
Teleport,BorderTile, Target
Player, AltPlayer

======
RULES
======

late [ player Teleport ] -> [ altplayer Teleport ] sfx1
late [ Player Teleport ] -> [ AltPlayer Teleport ] sfx1

late [ altplayer Teleport ] [ Teleport no altplayer ] -> [ altplayer teleport ] [ Teleport player ]
late [ altplayer ] -> [ ]
late [ AltPlayer Teleport ] [ Teleport no AltPlayer ] -> [ AltPlayer Teleport ] [ Teleport Player ]
late [ AltPlayer ] -> [ ]

late [ player bordertile ] -> cancel
late [ Player BorderTile ] -> cancel

==============
WINCONDITIONS
==============

some player
all player on target
all target on player
some Player
all Player on Target
all Target on Player

=======
LEVELS
Expand Down
46 changes: 23 additions & 23 deletions src/demo/midas.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ homepage https://web.archive.org/web/20160706204929/http://wanderlands.org/

(

A port of the luxuriant Wanderlands game, Midas, with permission of the authors. It's a bit messy, if you can find a way to tidy it up, let me know : ]
A port of the luxuriant Wanderlands game, Midas, with permission of the authors. It's a bit messy, if you can find a way to tidy it UP, let me know : ]

the original is here
https://web.archive.org/web/20120219201941/http://wanderlands.org/main/midas

update: uh, it's flash, so not a playable link any more...
update: uh, it's flash, so not a playable link any more...also the original developer site is gone.

)

Expand All @@ -20,7 +20,7 @@ OBJECTS
Background
white

lovebase
Lovebase
white

Target
Expand Down Expand Up @@ -83,7 +83,7 @@ blue
Wall
gray

love
Love
pink
.0.0.
00000
Expand Down Expand Up @@ -111,7 +111,7 @@ D = GoldingBlock
SOUNDS
=========

sfx0 28219707 (touch water)
sfx0 28219707 (touch Water)
sfx1 45545307 (golding)
sfx2 42491507 (make lady gold :/ )
StartGame 8892900
Expand All @@ -124,40 +124,40 @@ COLLISIONLAYERS
================

Background
lovebase
Lovebase
PlayerGround, PlayerJump1,PlayerJump2, Wall, Water, GoldBlock, Target, GoldTarget, GoldingBlock
Crown
love
Love

======
RULES
======

UP [ Up PlayerGround | No Obstacle ] -> [ Up PlayerJump2 | ]
DOWN [ Up JumpingPlayer | no obstacle ] -> [ JumpingPlayer | ]
DOWN [ Up PlayerJump2 | no obstacle ] -> [ PlayerJump2 | ]
UP [ UP PlayerGround | NO Obstacle ] -> [ UP PlayerJump2 | ]
DOWN [ UP JumpingPlayer | NO Obstacle ] -> [ JumpingPlayer | ]
DOWN [ UP PlayerJump2 | NO Obstacle ] -> [ PlayerJump2 | ]

[ stationary CanFall ] -> [ Down CanFall ]
[ STATIONARY CanFall ] -> [ Down CanFall ]

horizontal [ > PlayerJump1 | NO obstacle ] -> [ | PlayerGround ]
horizontal [ > PlayerJump2 | NO obstacle ] -> [ | PlayerJump1 ]
LATE DOWN [ PlayerGround | NO obstacle ] -> [ | playerground ]
HORIZONTAL [ > PlayerJump1 | NO Obstacle ] -> [ | PlayerGround ]
HORIZONTAL [ > PlayerJump2 | NO Obstacle ] -> [ | PlayerJump1 ]
LATE DOWN [ PlayerGround | NO Obstacle ] -> [ | PlayerGround ]

LATE [ crown no player ] [ player ] -> [ ] [ crown player ]
LATE [ goldingblock ] -> [ goldblock ]
LATE [ crown | wall ] -> [ crown | goldingblock ] sfx1
LATE [ crown | water ] -> [ | water ] sfx0
LATE [ crown | target ] -> [ crown | goldtarget ] sfx2
LATE [ Crown NO Player ] [ Player ] -> [ ] [ Crown Player ]
LATE [ GoldingBlock ] -> [ GoldBlock ]
LATE [ Crown | Wall ] -> [ Crown | GoldingBlock ] sfx1
LATE [ Crown | Water ] -> [ | Water ] sfx0
LATE [ Crown | Target ] -> [ Crown | GoldTarget ] sfx2
LATE DOWN [ JumpingPlayer | Obstacle ] -> [ PlayerGround | Obstacle ]

LATE [ player | target ] -> [ player lovebase | target ]
LATE UP [ lovebase | ] -> [ | love ]
LATE [ Player | Target ] -> [ Player Lovebase | Target ]
LATE UP [ Lovebase | ] -> [ | Love ]

==============
WINCONDITIONS
==============

some love (Awwww!)
some Love (Awwww!)

=======
LEVELS
Expand Down Expand Up @@ -358,7 +358,7 @@ message Is she still waiting?
#...................#
#####################

message Is love just fool's gold?
message Is Love just fool's gold?

#####################
#...................#
Expand Down
9 changes: 4 additions & 5 deletions src/demo/octat.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,12 @@ RULES
======

[ > Player | no Activetile ] -> cancel
[ > Player | ] -> [ | Player ]

[ Activetile | Player ] -> [ Temp | Player ]
[ no Temp | Player ] -> [ Activetile | Player ]
[ Temp ] -> [ ]
late [ Activetile | Player ] -> [ Temp | Player ]
late [ no Temp | Player ] -> [ Activetile | Player ]
late [ Temp ] -> [ ]

[ Activetile Void ] -> [ Void ]
late [ Activetile Void ] -> [ Void ]

==============
WINCONDITIONS
Expand Down
8 changes: 4 additions & 4 deletions src/demo/whaleworld.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,20 @@ VBeam
RULES
======

(while we allow whales to move onto the void, player's aren't)
(While we allow whales to move onto the void, player's aren't)
[ > player | void ] -> [ player | void ]

(beams detect motion)
(Beams detect motion)
horizontal [ > Player | VBeam ] -> [ > Player | > VBeam ]
vertical [ > Player | HBeam ] -> [ > Player | > HBeam ]

(If beams detected motion, transfer that to the whales)
[ Whale | ... | perpendicular Beam ] -> [ perpendicular Whale | ... | perpendicular Beam ]

(remove whales, if necessary)
(Remove whales, if necessary)
late [ Whale Void ] -> [ Void ]

(remove beams)
(Remove beams)
[ Beam ] -> [ ]

(Place HVeams and VBeams)
Expand Down
2 changes: 1 addition & 1 deletion src/demo/zenpuzzlegarden.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Player, Rock
RULES
======

(The h and v sand effects are cosmetic - how could this be done in a single line if there was only one type brushed sand?)
(The h and v sand effects are cosmetic - how could this be done in a single line if there was only one type of brushed sand?)

horizontal [ UnbrushedSand > Player ] -> [ HBrushedSand > Player ]
vertical [ UnbrushedSand > Player ] -> [ VBrushedSand > Player ]
Expand Down
12 changes: 8 additions & 4 deletions src/js/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -1891,18 +1891,22 @@ function collapseRules(groups) {
var newrule = [0, [], oldrule.rhs.length > 0, oldrule.lineNumber /*ellipses,group number,rigid,commands,randomrule,[cellrowmasks]*/ ];
var ellipses = [];
for (var j = 0; j < oldrule.lhs.length; j++) {
ellipses.push(false);
ellipses.push(0);
}

newrule[0] = dirMasks[oldrule.direction];
for (var j = 0; j < oldrule.lhs.length; j++) {
var cellrow_l = oldrule.lhs[j];
for (var k = 0; k < cellrow_l.length; k++) {
if (cellrow_l[k] === ellipsisPattern) {
if (ellipses[j]) {
logError("You can't use two ellipses in a single cell match pattern. If you really want to, please implement it yourself and send me a patch :) ", oldrule.lineNumber);
ellipses[j] ++;
if (ellipses[j]>2) {
logError("You can't use more than two ellipses in a single cell match pattern.", oldrule.lineNumber);
} else {
if (k>0 && cellrow_l[k-1]===ellipsisPattern){
logWarning("Why would you go and have two ellipses in a row like that? It's exactly the same as just having a single ellipsis, right?", oldrule.lineNumber);
}
}
ellipses[j] = true;
}
}
newrule[1][j] = cellrow_l;
Expand Down
Loading