I am working on a PDDL project for a LightsOut game. While my PDDL code executes successfully in Fast Downward, I face parsing errors in the Visual Studio Code PDDL plugin, and plasp is unable to process it correctly.
Here's a part of my PDDL code causing issues:
(define (domain lightsout)
(:requirements :strips :disjunctive-preconditions :conditional-effects :typing)
(:types
light
)
(:predicates
(on ?l - light)
(off ?l - light)
(adjacent ?l1 ?l2 - light)
)
(:action toggle
:parameters (?l - light)
:precondition (or (on ?l) (off ?l))
:effect (and
(when (on ?l) (and (not (on ?l)) (off ?l)))
(when (off ?l) (and (not (off ?l)) (on ?l)))
(forall (?adj - light)
(when (adjacent ?l ?adj)
(and
(when (on ?adj) (and (not (on ?adj)) (off ?adj)))
(when (off ?adj) (and (not (off ?adj)) (on ?adj)))
)
)
)
)
)
)
The errors reported by the VSC PDDL plugin at line 25 are:
"Syntax error in (and ...)" "Syntax error in action declaration." "Unreadable structure" In addition, plasp is unable to parse this PDDL code. I believe the issue is related to the nested when and forall structures in the action. How can I modify my PDDL code to resolve these parsing errors while maintaining the intended functionality for my game? Are there alternative structures or refactoring techniques I can use to make the code compatible with both the VSC PDDL plugin and plasp?
Any advice or insights to solve these parsing issues would be greatly appreciated.
Split the action into two actions, on's case and off's case? It is probably
orthat is causing the error.