Pattern-Script icon indicating copy to clipboard operation
Pattern-Script copied to clipboard

Disallow mixing late rules and non-late rules in a rule group

Open ClementSparrow opened this issue 4 years ago • 5 comments

Something like this…:

[ > Player | Crate ] -> [ > Player | > Crate ]
+ late [ Player | Crate ] -> [ Crate | Player ]

…doesn't make sense?

ClementSparrow avatar Aug 12 '21 20:08 ClementSparrow

Yeah it's pretty janky. Puzzlescript naively just splits them up, but an error/warning would not be amiss :)

increpare avatar Aug 13 '21 10:08 increpare

yeah, actually I think the best way to do it would be to deal with late like we already do with random: only allow the keyword on the first rule of the group and consider then that it applies to the whole group.

That's however something you probably shouldn't do with PuzzleScript because it could break old games, but I don't have this concern with Pattern:Script :-) (yet)

ClementSparrow avatar Aug 13 '21 18:08 ClementSparrow

If you want to play old PS games, play them on PS. Splitting a group in two (early and late) is never going to be what was intended. I go for late as a group modifier, like rule directions and random.

david-pfx avatar Mar 10 '23 03:03 david-pfx

I just had a long debugging session caused by a rule group where I put the late on the first rule but forgot to add it after the + in the second rule. And I was like "why is this rule not applied?", and the reason was that it was attempted before the movement phase at a time it could not apply. So I would definitely recommend that the late keyword applies to the whole group.

I would even argue that the late keyword should not exist as a rule keyword but should be a section keyword. Yes, I also had a bug because of that.

ClementSparrow avatar Jun 23 '23 18:06 ClementSparrow

PS has this warning, which might have helped:

logWarning('Oh gosh you can mix late and non-late rules in a rule-group if you really want to, but gosh why would you want to do that?  What do you expect to accomplish?', lineNumber);

And yes, internally late is a section, and there are arguments in favour of that.

david-pfx avatar Jun 23 '23 23:06 david-pfx