gdl/vis_pacman3p.gdl @ 4c2306e08ed1

A few more tweaks
author Steve Losh <steve@stevelosh.com>
date Mon, 15 May 2017 12:22:50 +0000
parents 3f23f6b95cac
children (none)
(role pacman)
(role blinky)
(role inky)
(init (control pacman))
(init (location pacman 5 3))
(init (location blinky 4 6))
(init (location inky 5 6))
(init (location pellet 3 1))
(init (location pellet 4 1))
(init (location pellet 5 1))
(init (location pellet 6 1))
(init (location pellet 3 2))
(init (location pellet 6 2))
(init (location pellet 1 3))
(init (location pellet 2 3))
(init (location pellet 3 3))
(init (location pellet 4 3))
(init (location pellet 6 3))
(init (location pellet 7 3))
(init (location pellet 8 3))
(init (location pellet 1 4))
(init (location pellet 3 4))
(init (location pellet 6 4))
(init (location pellet 8 4))
(init (location pellet 1 5))
(init (location pellet 3 5))
(init (location pellet 6 5))
(init (location pellet 8 5))
(init (location pellet 1 6))
(init (location pellet 2 6))
(init (location pellet 3 6))
(init (location pellet 6 6))
(init (location pellet 7 6))
(init (location pellet 8 6))
(init (location pellet 3 7))
(init (location pellet 6 7))
(init (location pellet 3 8))
(init (location pellet 4 8))
(init (location pellet 5 8))
(init (location pellet 6 8))
(init (collected 0))
(init (step 1))
(<= (legal pacman (move ?dir))
    (true (control pacman))
    (true (location pacman ?x ?y))
    (legalstep ?dir ?x ?y)
    (distinct ?dir nowhere))
(<= (legal pacman (move nowhere))
    (not (true (control pacman))))
(<= (legal ?ghost (move ?dir))
    (ghost ?ghost)
    (true (control ghosts))
    (true (location ?ghost ?x ?y))
    (legalstep ?dir ?x ?y)
    (distinct ?dir nowhere))
(<= (legal ?ghost (move nowhere))
    (ghost ?ghost)
    (not (true (control ghosts))))
(<= (next (control pacman))
    (true (control ghosts)))
(<= (next (control ghosts))
    (true (control pacman)))
(<= (next (location pellet ?xp ?yp))
    (true (location pellet ?xp ?yp))
    (true (location pacman ?xpm1 ?ypm1))
    (does pacman (move ?dir))
    (nextcell ?dir ?xpm1 ?ypm1 ?xpm2 ?ypm2)
    (distinctcell ?xp ?yp ?xpm2 ?ypm2))
(<= (next (collected ?n++))
    (true (location pacman ?x1 ?y1))
    (does pacman (move ?dir))
    (nextcell ?dir ?x1 ?y1 ?x2 ?y2)
    (true (location pellet ?x2 ?y2))
    (true (collected ?n))
    (succ ?n ?n++))
(<= (next (collected ?n))
    (true (location pacman ?x1 ?y1))
    (does pacman (move ?dir))
    (nextcell ?dir ?x1 ?y1 ?x2 ?y2)
    (not (true (location pellet ?x2 ?y2)))
    (true (collected ?n)))
(<= (next (location ?char ?x2 ?y2))
    (movable ?char)
    (true (location ?char ?x1 ?y1))
    (does ?char (move ?dir))
    (nextcell ?dir ?x1 ?y1 ?x2 ?y2))
(<= (next (step ?n++))
    (true (step ?n))
    (succ ?n ?n++))
(<= terminal
    captured)
(<= terminal
    nopellets)
(<= terminal
    timeout)
(<= (goal pacman ?g)
    (true (collected ?n))
    (scoremap ?n ?g))
(<= (goal blinky 0)
    (true (location pacman ?xp ?yp))
    (true (location blinky ?xb ?yb))
    (distinctcell ?xp ?yp ?xb ?yb))
(<= (goal blinky 100)
    (true (location pacman ?x ?y))
    (true (location blinky ?x ?y)))
(<= (goal inky 0)
    (true (location pacman ?xp ?yp))
    (true (location inky ?xi ?yi))
    (distinctcell ?xp ?yp ?xi ?yi))
(<= (goal inky 100)
    (true (location pacman ?x ?y))
    (true (location inky ?x ?y)))
(<= (legalstep north ?x ?y)
    (++ ?y ?ynew)
    (cell ?x ?ynew)
    (not (blocked ?x ?y ?x ?ynew)))
(<= (legalstep south ?x ?y)
    (-- ?y ?ynew)
    (cell ?x ?ynew)
    (not (blocked ?x ?y ?x ?ynew)))
(<= (legalstep east ?x ?y)
    (++ ?x ?xnew)
    (cell ?xnew ?y)
    (not (blocked ?x ?y ?xnew ?y)))
(<= (legalstep west ?x ?y)
    (-- ?x ?xnew)
    (cell ?xnew ?y)
    (not (blocked ?x ?y ?xnew ?y)))
(<= (legalstep nowhere ?x ?y)
    (cell ?x ?y))
(<= (nextcell north ?x ?y ?x ?ynew)
    (index ?x)
    (++ ?y ?ynew))
(<= (nextcell south ?x ?y ?x ?ynew)
    (index ?x)
    (-- ?y ?ynew))
(<= (nextcell east ?x ?y ?xnew ?y)
    (index ?y)
    (++ ?x ?xnew))
(<= (nextcell west ?x ?y ?xnew ?y)
    (index ?y)
    (-- ?x ?xnew))
(<= (nextcell nowhere ?x ?y ?x ?y)
    (cell ?x ?y))
(<= (blocked ?x ?y1 ?x ?y2)
    (blockednorth ?x ?y1)
    (++ ?y1 ?y2))
(<= (blocked ?x ?y2 ?x ?y1)
    (blockednorth ?x ?y1)
    (++ ?y1 ?y2))
(<= (blocked ?x1 ?y ?x2 ?y)
    (blockedeast ?x1 ?y)
    (++ ?x1 ?x2))
(<= (blocked ?x2 ?y ?x1 ?y)
    (blockedeast ?x1 ?y)
    (++ ?x1 ?x2))
(<= (distinctcell ?x1 ?y1 ?x2 ?y2)
    (cell ?x1 ?y1)
    (cell ?x2 ?y2)
    (distinct ?x1 ?x2))
(<= (distinctcell ?x1 ?y1 ?x2 ?y2)
    (cell ?x1 ?y1)
    (cell ?x2 ?y2)
    (distinct ?y1 ?y2))
(<= captured
    (true (location pacman ?x ?y))
    (true (location blinky ?x ?y)))
(<= captured
    (true (location pacman ?x ?y))
    (true (location inky ?x ?y)))
(<= nopellets
    (true (collected 35)))
(<= timeout
    (true (step 100)))

(blockednorth 4 1)
(blockednorth 5 1)
(blockednorth 1 2)
(blockednorth 2 2)
(blockednorth 4 2)
(blockednorth 5 2)
(blockednorth 7 2)
(blockednorth 8 2)
(blockednorth 2 3)
(blockednorth 4 3)
(blockednorth 5 3)
(blockednorth 7 3)
(blockednorth 2 5)
(blockednorth 4 5)
(blockednorth 5 5)
(blockednorth 7 5)
(blockednorth 1 6)
(blockednorth 2 6)
(blockednorth 4 6)
(blockednorth 5 6)
(blockednorth 7 6)
(blockednorth 8 6)
(blockednorth 4 7)
(blockednorth 5 7)
(blockedeast 1 4)
(blockedeast 1 5)
(blockedeast 2 1)
(blockedeast 2 2)
(blockedeast 2 4)
(blockedeast 2 5)
(blockedeast 2 7)
(blockedeast 2 8)
(blockedeast 3 2)
(blockedeast 3 4)
(blockedeast 3 5)
(blockedeast 3 7)
(blockedeast 5 2)
(blockedeast 5 4)
(blockedeast 5 5)
(blockedeast 5 7)
(blockedeast 6 1)
(blockedeast 6 2)
(blockedeast 6 4)
(blockedeast 6 5)
(blockedeast 6 7)
(blockedeast 6 8)
(blockedeast 7 4)
(blockedeast 7 5)

(movable pacman)
(movable blinky)
(movable inky)
(ghost blinky)
(ghost inky)
(index 1)
(index 2)
(index 3)
(index 4)
(index 5)
(index 6)
(index 7)
(index 8)
(cell 1 8)
(cell 2 8)
(cell 3 8)
(cell 4 8)
(cell 5 8)
(cell 6 8)
(cell 7 8)
(cell 8 8)
(cell 1 7)
(cell 2 7)
(cell 3 7)
(cell 4 7)
(cell 5 7)
(cell 6 7)
(cell 7 7)
(cell 8 7)
(cell 1 6)
(cell 2 6)
(cell 3 6)
(cell 4 6)
(cell 5 6)
(cell 6 6)
(cell 7 6)
(cell 8 6)
(cell 1 5)
(cell 2 5)
(cell 3 5)
(cell 4 5)
(cell 5 5)
(cell 6 5)
(cell 7 5)
(cell 8 5)
(cell 1 4)
(cell 2 4)
(cell 3 4)
(cell 4 4)
(cell 5 4)
(cell 6 4)
(cell 7 4)
(cell 8 4)
(cell 1 3)
(cell 2 3)
(cell 3 3)
(cell 4 3)
(cell 5 3)
(cell 6 3)
(cell 7 3)
(cell 8 3)
(cell 1 2)
(cell 2 2)
(cell 3 2)
(cell 4 2)
(cell 5 2)
(cell 6 2)
(cell 7 2)
(cell 8 2)
(cell 1 1)
(cell 2 1)
(cell 3 1)
(cell 4 1)
(cell 5 1)
(cell 6 1)
(cell 7 1)
(cell 8 1)
(++ 1 2)
(++ 2 3)
(++ 3 4)
(++ 4 5)
(++ 5 6)
(++ 6 7)
(++ 7 8)
(-- 8 7)
(-- 7 6)
(-- 6 5)
(-- 5 4)
(-- 4 3)
(-- 3 2)
(-- 2 1)
(succ 0 1)
(succ 1 2)
(succ 2 3)
(succ 3 4)
(succ 4 5)
(succ 5 6)
(succ 6 7)
(succ 7 8)
(succ 8 9)
(succ 9 10)
(succ 10 11)
(succ 11 12)
(succ 12 13)
(succ 13 14)
(succ 14 15)
(succ 15 16)
(succ 16 17)
(succ 17 18)
(succ 18 19)
(succ 19 20)
(succ 20 21)
(succ 21 22)
(succ 22 23)
(succ 23 24)
(succ 24 25)
(succ 25 26)
(succ 26 27)
(succ 27 28)
(succ 28 29)
(succ 29 30)
(succ 30 31)
(succ 31 32)
(succ 32 33)
(succ 33 34)
(succ 34 35)
(succ 35 36)
(succ 36 37)
(succ 37 38)
(succ 38 39)
(succ 39 40)
(succ 40 41)
(succ 41 42)
(succ 42 43)
(succ 43 44)
(succ 44 45)
(succ 45 46)
(succ 46 47)
(succ 47 48)
(succ 48 49)
(succ 49 50)
(succ 50 51)
(succ 51 52)
(succ 52 53)
(succ 53 54)
(succ 54 55)
(succ 55 56)
(succ 56 57)
(succ 57 58)
(succ 58 59)
(succ 59 60)
(succ 60 61)
(succ 61 62)
(succ 62 63)
(succ 63 64)
(succ 64 65)
(succ 65 66)
(succ 66 67)
(succ 67 68)
(succ 68 69)
(succ 69 70)
(succ 70 71)
(succ 71 72)
(succ 72 73)
(succ 73 74)
(succ 74 75)
(succ 75 76)
(succ 76 77)
(succ 77 78)
(succ 78 79)
(succ 79 80)
(succ 80 81)
(succ 81 82)
(succ 82 83)
(succ 83 84)
(succ 84 85)
(succ 85 86)
(succ 86 87)
(succ 87 88)
(succ 88 89)
(succ 89 90)
(succ 90 91)
(succ 91 92)
(succ 92 93)
(succ 93 94)
(succ 94 95)
(succ 95 96)
(succ 96 97)
(succ 97 98)
(succ 98 99)
(succ 99 100)
(scoremap 0 0)
(scoremap 1 2)
(scoremap 2 4)
(scoremap 3 6)
(scoremap 4 8)
(scoremap 5 10)
(scoremap 6 12)
(scoremap 7 14)
(scoremap 8 16)
(scoremap 9 18)
(scoremap 10 20)
(scoremap 11 23)
(scoremap 12 26)
(scoremap 13 29)
(scoremap 14 32)
(scoremap 15 35)
(scoremap 16 38)
(scoremap 17 41)
(scoremap 18 44)
(scoremap 19 47)
(scoremap 20 50)
(scoremap 21 53)
(scoremap 22 56)
(scoremap 23 59)
(scoremap 24 62)
(scoremap 25 65)
(scoremap 26 68)
(scoremap 27 71)
(scoremap 28 74)
(scoremap 29 77)
(scoremap 30 80)
(scoremap 31 83)
(scoremap 32 86)
(scoremap 33 89)
(scoremap 34 95)
(scoremap 35 100)

(<= (visible 1 ?y1 1 ?y2)
    (index ?y1)
    (index ?y2))
(<= (visible 3 ?y1 3 ?y2)
    (index ?y1)
    (index ?y2))
(<= (visible 6 ?y1 6 ?y2)
    (index ?y1)
    (index ?y2))
(<= (visible 8 ?y1 8 ?y2)
    (index ?y1)
    (index ?y2))
(<= (visible ?x1 1 ?x2 1)
    (index ?x1)
    (index ?x2))
(<= (visible ?x1 3 ?x2 3)
    (index ?x1)
    (index ?x2))
(<= (visible ?x1 6 ?x2 6)
    (index ?x1)
    (index ?x2))
(<= (visible ?x1 8 ?x2 8)
    (index ?x1)
    (index ?x2))

(<= (sees ?r1 (location ?r2 ?x2 ?y2))
    (next (location ?r2 ?x2 ?y2))
    (next (location ?r1 ?x1 ?y1))
    (visible ?x1 ?y1 ?x2 ?y2))
(<= (sees ?r1 (collected ?n))
    (role ?r1)
    (next (collected ?n)))