BoxMan

If you don’t know how to play the boxman game, you should open BoxMan.zip and click BoxMan.exe to have a try. You can also choose the level of the game to challenge yourselves. There are five cases choosed from level 1, 10, 30, 40, 50 in the following figures.

You can model the location information based on rectangular coordinates as mapped out in Figure 3. For example, we denote by P13 the position (1,3). The calculated action sequence can be like this: MOVE P12 P13, PUSH BOX1 P14 P15, $\dots$, which means the guy runs from position (1,2) to position (1,3), and push the box1 from position (1,4) to position (1,5). However, this is only a very simple and intuitive approach to representing the actions and positions. If you have any other better methods, you can have a try.

Please solve the boxman game by using FF planner. You should hand in 2 files, including a domain file (boxman_domain.pddl) and data file (boxman5.pddl).

boxman_domain.pddl

(define(domain boxman)
    (:predicates
        (box ?x)
        (man ?x)
        (up ?x ?y)
        (left ?x ?y)
    )
    (:action move
        :parameters(?x ?y)
        :precondition
            (and
                (man ?x)
                (not(box ?y))
                (or
                    (up ?x ?y)
                    (up ?y ?x)
                    (left ?x ?y)
                    (left ?y ?x)
                )
            )
        :effect
            (and
                (not(man ?x))
                (man ?y)
            )
    )
    (:action push
        :parameters(?x ?y ?z)
        :precondition
            (and
                (man ?x)
                (box ?y)
                (not(box ?z))
                (or
                    (and(up ?x ?y)(up ?y ?z))
                    (and(up ?y ?x)(up ?z ?y))
                    (and(left ?x ?y)(left ?y ?z))
                    (and(left ?y ?x)(left ?z ?y))
                )
            )
        :effect
            (and
                (not(man ?x))
                (man ?y)
                (not(box ?y))
                (box ?z)
            )
    )
)

boxman5.pddl

(define(problem level50)
    (:domain boxman)
    (:objects
        P05 P15
        P04 P14
        P03 P13 P23 P33 P43 P53
            P12 P22 P32 P42 P52
            P11     P31
            P10 P20 P30
    )
    (:init
        (man P30)(box P12)(box P23)(box P31)
        (left P03 P13)
        (up P04 P03)(left P04 P14)
        (up P05 P04)(left P05 P15)
        (left P10 P20)
        (up P11 P10)
        (up P12 P11)(left P12 P22)
        (up P13 P12)(left P13 P23)
        (up P14 P13)
        (up P15 P14)
        (left P20 P30)
        (left P22 P32)
        (up P23 P22)(left P23 P33)
        (up P31 P30)
        (up P32 P31)(left P32 P42)
        (up P33 P32)(left P33 P43)
        (left P42 P52)
        (up P43 P42)(left P43 P53)
        (up P53 P52)
    )
    (:goal
        (and
            (box P10)
            (box P13)
            (box P23)
        )
    )
)