Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define (domain lightup)
- ; (:requirements :adl :strips)
- (:requirements :adl)
- (:types
- xpos ;; x positions in the grid *DO NOT REMOVE*
- ypos ;; y positions in the grid *DO NOT REMOVE*
- num ;; numbers from 0 to 4 to count the number of light bulbs
- )
- (:predicates
- ; You may, or may not, use / modify / remove any one of the following
- ; predicates:
- ;; n2 = n1 + 1
- (increment ?n1 ?n2 - num)
- ;; (?x1, ?y1) is (horizontally or vertically) adjacent to (?x2, ?y2)
- (adjacent ?x - xpos ?y - ypos ?x2 - xpos ?y2 - ypos)
- ;; ?x2 is right of ?x1
- (right ?x1 ?x2 - xpos)
- ;; ?y2 is below of ?y1
- (below ?y1 ?y2 - ypos)
- ;; cell (?x, ?y) is lit-up
- (lit ?x - xpos ?y - ypos)
- ;; cell (?x, ?y) is black
- (black ?x - xpos ?y - ypos)
- ;; ?n many light bulbs are vertically or horizontally adjacent to (?x, ?y)
- ;; (may be only defined for the relevant black cells)
- (surrounded ?x - xpos ?y - ypos ?n - num)
- ; TODO (optional): additional predicates go in here
- (decrement ?n1 ?n2 - num)
- (left ?x1 ?x2 - xpos)
- (up ?y1 ?y2 - ypos)
- (bulb ?x - xpos ?y - ypos)
- (inbetweenX ?x1 - xpos ?x - xpos ?x2 - xpos)
- (inbetweenY ?y1 - ypos ?y - ypos ?y2 - ypos)
- )
- (:action place-bulb ; * DO NOT CHANGE THE NAME *
- :parameters (?x - xpos ?y - ypos) ; * DO NOT MODIFY THE PARAMETER LIST *
- :precondition (and
- (not (lit ?x ?y))
- (not (black ?x ?y))
- ; (or (forall (?a - xpos)
- ; (and (right ?x ?a) (not (bulb ?a ?y)) (not (black ?a ?y)))
- ; )
- ; (forall (?a - xpos)
- ; (and
- ; (right ?x ?a)
- ; (bulb ?a ?y)
- ; (exists (?z - xpos) (and (black ?z ?y) (inbetweenX ?x ?z ?a)))
- ; )
- ; )
- ; )
- ; (or (forall (?a - xpos)
- ; (and (left ?x ?a) (not (bulb ?a ?y)) (not (black ?a ?y)))
- ; )
- ; (forall (?a - xpos)
- ; (and
- ; (left ?x ?a)
- ; (bulb ?a ?y)
- ; (exists (?z - xpos) (and (black ?z ?y) (inbetweenX ?a ?z ?x)))
- ; )
- ; )
- ; )
- ; (or (forall (?a - ypos)
- ; (and (up ?y ?a) (not (bulb ?x ?a)) (not (black ?x ?a)))
- ; )
- ; (forall (?a - ypos)
- ; (and
- ; (up ?y ?a)
- ; (bulb ?x ?a)
- ; (exists (?z - ypos) (and (black ?x ?z) (inbetweenY ?y ?z ?a)))
- ; )
- ; )
- ; )
- ; (or (forall (?a - ypos)
- ; (and (below ?y ?a) (not (bulb ?x ?a)) (not (black ?x ?a)))
- ; )
- ; (forall (?a - ypos)
- ; (and
- ; (below ?y ?a)
- ; (bulb ?x ?a)
- ; (exists (?z - ypos) (and (black ?x ?z) (inbetweenY ?a ?z ?y)))
- ; )
- ; )
- ; )
- )
- :effect (and
- (lit ?x ?y)
- (bulb ?x ?y)
- (forall (?a - xpos)
- (when (or
- ; for right side
- (and (right ?x ?a) (not (exists (?z - xpos) (and (right ?a ?z) (black ?z ?y)) )) )
- ; (and (right ?x ?a) (exists (?z1 - xpos) (and (right ?a ?z1) (black ?z1 ?y) (not (exists (?z2 - xpos) (and (left ?z1 ?z2) (right ?x ?z2) (black ?z2 ?y)))))) )
- ; for left side
- (and (left ?x ?a) (not (exists (?z - xpos) (and (left ?a ?z) (black ?z ?y)) )) )
- ; (and (left ?x ?a) (exists (?z1 - xpos) (and (left ?a ?z1) (black ?z1 ?y) (not (exists (?z2 - xpos) (and (right ?z1 ?z2) (left ?x ?z2) (black ?z2 ?y)))))) )
- )
- (lit ?a ?y)
- )
- )
- (forall (?a - ypos)
- (when (or
- ; for up side
- (and (up ?y ?a) (not (exists (?z - ypos) (and (up ?a ?z) (black ?x ?z)) )) )
- ; (and (up ?y ?a) (exists (?z1 - ypos) (and (up ?a ?z1) (black ?x ?z1) (not (exists (?z2 - ypos) (and (below ?z1 ?z2) (up ?y ?z2) (black ?x ?z2)))))) )
- ; for below side
- (and (below ?y ?a) (not (exists (?z - ypos) (and (below ?a ?z) (black ?x ?z)) )) )
- ; (and (below ?y ?a) (exists (?z1 - ypos) (and (below ?a ?z1) (black ?x ?z1) (not (exists (?z2 - ypos) (and (up ?z1 ?z2) (below ?y ?z2) (black ?x ?z2)))))) )
- )
- (lit ?x ?a)
- )
- )
- )
- )
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement