Can I detect the absence of something in rules?

27 views
Skip to first unread message

Sévan Kazandjian

unread,
Apr 13, 2024, 11:49:12 AMApr 13
to PuzzleScript
Hi everyone,

A small question that is bothering me :
Is it possible to detect the absence of something in the rules?

In WinConditions, I can do
"no Player" to achieve this

But in the rules, I would like to do something like :
[no Player] -> message "game over"
But obviously this will trigger if *one* case has no Player, not if 0 players are present on board.

Is there an elegant way to do this that I'm missing, or any game that uses some similar thing?

Thanks in advance,
Sevan.

Stephen Lavelle

unread,
Apr 13, 2024, 12:19:23 PMApr 13
to Sévan Kazandjian, PuzzleScript
There's a multi-step way to do it - let's there theres an object that there's only one of in the level, PLACE, and there's a temporary token object, TOKEN

[ PLACE ] -> [ PLACE TOKEN ]  (create a single token)
[ PLAYER ] [ TOKEN ] -> [ PLAYER ] [ ] (removed token there's a player)
[ TOKEN ] -> message "game over" (if the token is still there, there must be no player)

--
You received this message because you are subscribed to the Google Groups "PuzzleScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puzzlescript...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/puzzlescript/ccfbaecb-074e-49df-996a-6fb9f5c22895n%40googlegroups.com.

Sévan Kazandjian

unread,
Apr 13, 2024, 3:24:17 PMApr 13
to PuzzleScript
Nice technique, thanks,
That'll come handy.

S.

Reply all
Reply to author
Forward
0 new messages