You are not logged in. login register
Game frogs_and_toads
name frogs_and_toads
creator stephan
number of roles 1
stylesheet frogs_and_toads/frogs_and_toads.xsl
GDL v1
enabled
matches show matches
statistics show game statistics
description The frogs start in the lower right square of the board, the toads in the upper left one. The cell in the intersection of the two squares is empty. The player can move a piece (frog or toad) either to a horizontally or vertically adjacent cell if that is empty or jump over another piece onto the empty cell. The goal is to inverse the initial position.
In this version, the player gets points depending on the number of pieces placed correctly.
GDL by Peter Kissmann (TZI, University of Bremen)

Game Description

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; frogs and toads (2 4x4-boards)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; The board consists of two squares that share one corner. All cells except
;;; for the shared one are occupied: In the one square, each cell is occupied
;;; by toads; in the other one, each is occupied by a frog.
;;; The goal is to invert the positions of frogs and toads. To achieve this,
;;; they may move into the empty cell, if it is (horizontally or vertically)
;;; neighboring, or they may jump over an occupied cell in a straight line
;;; (again only horizontally or vertically).
;;;
;;; Initial Position:
;;;
;;;  +-+-+-+-+
;;; 7|t|t|t|t|
;;;  +-+-+-+-+
;;; 6|t|t|t|t|
;;;  +-+-+-+-+
;;; 5|t|t|t|t|
;;;  +-+-+-+-+-+-+-+
;;; 4|t|t|t| |f|f|f|
;;;  +-+-+-+-+-+-+-+
;;; 3      |f|f|f|f|
;;;        +-+-+-+-+
;;; 2      |f|f|f|f|
;;;        +-+-+-+-+
;;; 1      |f|f|f|f|
;;;        +-+-+-+-+
;;;   1 2 3 4 5 6 7
;;; 

(role player)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(init (cell 1 4 toad))
(init (cell 1 5 toad))
(init (cell 1 6 toad))
(init (cell 1 7 toad))
(init (cell 2 4 toad))
(init (cell 2 5 toad))
(init (cell 2 6 toad))
(init (cell 2 7 toad))
(init (cell 3 4 toad))
(init (cell 3 5 toad))
(init (cell 3 6 toad))
(init (cell 3 7 toad))
(init (cell 4 1 frog))
(init (cell 4 2 frog))
(init (cell 4 3 frog))
(init (cell 4 4 floor))
(init (cell 4 5 toad))
(init (cell 4 6 toad))
(init (cell 4 7 toad))
(init (cell 5 1 frog))
(init (cell 5 2 frog))
(init (cell 5 3 frog))
(init (cell 5 4 frog))
(init (cell 6 1 frog))
(init (cell 6 2 frog))
(init (cell 6 3 frog))
(init (cell 6 4 frog))
(init (cell 7 1 frog))
(init (cell 7 2 frog))
(init (cell 7 3 frog))
(init (cell 7 4 frog))
(init (correctFrogs 0))
(init (correctToads 0))

(init (step 0))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(<= (next (cell ?r2 ?c2 ?t))
    (true (cell ?r1 ?c1 ?t))
    (distinct ?t floor)
    (does player (move ?r1 ?c1 ?r2 ?c2))
)
(<= (next (cell ?r2 ?c2 ?t))
    (true (cell ?r1 ?c1 ?t))
    (distinct ?t floor)
    (does player (jump ?r1 ?c1 ?r2 ?c2))
)

(<= (next (cell ?r1 ?c1 floor))
    (does player (move ?r1 ?c1 ?r2 ?c2))
)
(<= (next (cell ?r1 ?c1 floor))
    (does player (jump ?r1 ?c1 ?r2 ?c2))
)

(<= (next (correctFrogs ?n2))
    (does player (move 4 4 3 4))
    (true (cell 4 4 frog))
    (true (correctFrogs ?n1))
    (succ ?n1 ?n2)
)

(<= (next (correctFrogs ?n2))
    (does player (move 4 4 4 5))
    (true (cell 4 4 frog))
    (true (correctFrogs ?n1))
    (succ ?n1 ?n2)
)

(<= (next (correctFrogs ?n1))
    (does player (move 3 4 4 4))
    (true (cell 3 4 frog))
    (true (correctFrogs ?n2))
    (succ ?n1 ?n2)
)

(<= (next (correctFrogs ?n1))
    (does player (move 4 5 4 4))
    (true (cell 4 5 frog))
    (true (correctFrogs ?n2))
    (succ ?n1 ?n2)
)

(<= (next (correctFrogs ?n))
    (does player (move ?x1 ?y1 ?x2 ?y2))
    (true (cell ?x1 ?y1 frog))
    (not (does player (move 4 4 3 4)))
    (not (does player (move 4 4 4 5)))
    (not (does player (move 3 4 4 4)))
    (not (does player (move 4 5 4 4)))
    (true (correctFrogs ?n))
)

(<= (next (correctFrogs ?n))
    (does player (move ?x1 ?y1 ?x2 ?y2))
    (true (cell ?x1 ?y1 toad))
    (true (correctFrogs ?n))
)

(<= (next (correctFrogs ?n2))
    (does player (jump 4 4 2 4))
    (true (cell 4 4 frog))
    (true (correctFrogs ?n1))
    (succ ?n1 ?n2)
)

(<= (next (correctFrogs ?n2))
    (does player (jump 4 4 4 6))
    (true (cell 4 4 frog))
    (true (correctFrogs ?n1))
    (succ ?n1 ?n2)
)

(<= (next (correctFrogs ?n2))
    (does player (jump 4 3 4 5))
    (true (cell 4 3 frog))
    (true (correctFrogs ?n1))
    (succ ?n1 ?n2)
)

(<= (next (correctFrogs ?n2))
    (does player (jump 5 4 3 4))
    (true (cell 5 4 frog))
    (true (correctFrogs ?n1))
    (succ ?n1 ?n2)
)

(<= (next (correctFrogs ?n1))
    (does player (jump 2 4 4 4))
    (true (cell 2 4 frog))
    (true (correctFrogs ?n2))
    (succ ?n1 ?n2)
)

(<= (next (correctFrogs ?n1))
    (does player (jump 4 6 4 4))
    (true (cell 4 6 frog))
    (true (correctFrogs ?n2))
    (succ ?n1 ?n2)
)

(<= (next (correctFrogs ?n1))
    (does player (jump 4 5 4 3))
    (true (cell 4 5 frog))
    (true (correctFrogs ?n2))
    (succ ?n1 ?n2)
)

(<= (next (correctFrogs ?n1))
    (does player (jump 3 4 5 4))
    (true (cell 3 4 frog))
    (true (correctFrogs ?n2))
    (succ ?n1 ?n2)
)

(<= (next (correctFrogs ?n))
    (does player (jump ?x1 ?y1 ?x2 ?y2))
    (true (cell ?x1 ?y1 frog))
    (not (does player (jump 4 4 2 4)))
    (not (does player (jump 4 4 4 6)))
    (not (does player (jump 4 3 4 5)))
    (not (does player (jump 5 4 3 4)))
    (not (does player (jump 2 4 4 4)))
    (not (does player (jump 4 6 4 4)))
    (not (does player (jump 4 5 4 3)))
    (not (does player (jump 3 4 5 4)))
    (true (correctFrogs ?n))
)

(<= (next (correctFrogs ?n))
    (does player (jump ?x1 ?y1 ?x2 ?y2))
    (true (cell ?x1 ?y1 toad))
    (true (correctFrogs ?n))
)

(<= (next (correctToads ?n2))
    (does player (move 4 4 4 3))
    (true (cell 4 4 toad))
    (true (correctToads ?n1))
    (succ ?n1 ?n2)
)

(<= (next (correctToads ?n2))
    (does player (move 4 4 5 4))
    (true (cell 4 4 toad))
    (true (correctToads ?n1))
    (succ ?n1 ?n2)
)

(<= (next (correctToads ?n1))
    (does player (move 4 3 4 4))
    (true (cell 4 3 toad))
    (true (correctToads ?n2))
    (succ ?n1 ?n2)
)

(<= (next (correctToads ?n1))
    (does player (move 5 4 4 4))
    (true (cell 5 4 toad))
    (true (correctToads ?n2))
    (succ ?n1 ?n2)
)

(<= (next (correctToads ?n))
    (does player (move ?x1 ?y1 ?x2 ?y2))
    (true (cell ?x1 ?y1 toad))
    (not (does player (move 4 4 4 3)))
    (not (does player (move 4 4 5 4)))
    (not (does player (move 4 3 4 4)))
    (not (does player (move 5 4 4 4)))
    (true (correctToads ?n))
)

(<= (next (correctToads ?n))
    (does player (move ?x1 ?y1 ?x2 ?y2))
    (true (cell ?x1 ?y1 frog))
    (true (correctToads ?n))
)

(<= (next (correctToads ?n2))
    (does player (jump 4 4 6 4))
    (true (cell 4 4 toad))
    (true (correctToads ?n1))
    (succ ?n1 ?n2)
)

(<= (next (correctToads ?n2))
    (does player (jump 4 4 4 2))
    (true (cell 4 4 toad))
    (true (correctToads ?n1))
    (succ ?n1 ?n2)
)

(<= (next (correctToads ?n2))
    (does player (jump 4 5 4 3))
    (true (cell 4 5 toad))
    (true (correctToads ?n1))
    (succ ?n1 ?n2)
)

(<= (next (correctToads ?n2))
    (does player (jump 3 4 5 4))
    (true (cell 3 4 toad))
    (true (correctToads ?n1))
    (succ ?n1 ?n2)
)

(<= (next (correctToads ?n1))
    (does player (jump 6 4 4 4))
    (true (cell 6 4 toad))
    (true (correctToads ?n2))
    (succ ?n1 ?n2)
)

(<= (next (correctToads ?n1))
    (does player (jump 4 2 4 4))
    (true (cell 4 2 toad))
    (true (correctToads ?n2))
    (succ ?n1 ?n2)
)

(<= (next (correctToads ?n1))
    (does player (jump 4 3 4 5))
    (true (cell 4 3 toad))
    (true (correctToads ?n2))
    (succ ?n1 ?n2)
)

(<= (next (correctToads ?n1))
    (does player (jump 5 4 3 4))
    (true (cell 5 4 toad))
    (true (correctToads ?n2))
    (succ ?n1 ?n2)
)

(<= (next (correctToads ?n))
    (does player (jump ?x1 ?y1 ?x2 ?y2))
    (true (cell ?x1 ?y1 toad))
    (not (does player (jump 4 4 6 4)))
    (not (does player (jump 4 4 4 2)))
    (not (does player (jump 4 5 4 3)))
    (not (does player (jump 3 4 5 4)))
    (not (does player (jump 6 4 4 4)))
    (not (does player (jump 4 2 4 4)))
    (not (does player (jump 4 3 4 5)))
    (not (does player (jump 5 4 3 4)))
    (true (correctToads ?n))
)

(<= (next (correctToads ?n))
    (does player (jump ?x1 ?y1 ?x2 ?y2))
    (true (cell ?x1 ?y1 frog))
    (true (correctToads ?n))
)

(<= (next (step ?y))
    (true (step ?x))
    (succ ?x ?y)
)

; The rest is for the frame

(<= (next (cell ?x ?y ?t))
    (true (cell ?x ?y ?t))
    (distinct ?t floor)
    (does player (move ?r1 ?c1 ?r2 ?c2))
    (distinct ?r1 ?x)
    (distinct ?r2 ?x)
)
(<= (next (cell ?x ?y ?t))
    (true (cell ?x ?y ?t))
    (distinct ?t floor)
    (does player (move ?r1 ?c1 ?r2 ?c2))
    (distinct ?c1 ?y)
    (distinct ?c2 ?y)
)
(<= (next (cell ?x ?y ?t))
    (true (cell ?x ?y ?t))
    (distinct ?t floor)
    (does player (jump ?r1 ?c1 ?r2 ?c2))
    (distinct ?r1 ?x)
    (distinct ?r2 ?x)
)
(<= (next (cell ?x ?y ?t))
    (true (cell ?x ?y ?t))
    (distinct ?t floor)
    (does player (jump ?r1 ?c1 ?r2 ?c2))
    (distinct ?c1 ?y)
    (distinct ?c2 ?y)
)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(<= (legal player (move ?r ?c1 ?r ?c2))
    (true (cell ?r ?c2 floor))
    (succ ?c1 ?c2)
    (true (cell ?r ?c1 ?t))
    (distinct ?t floor)
)
(<= (legal player (move ?r ?c1 ?r ?c2))
    (true (cell ?r ?c2 floor))
    (succ ?c2 ?c1)
    (true (cell ?r ?c1 ?t))
    (distinct ?t floor)
)

(<= (legal player (move ?r1 ?c ?r2 ?c))
    (true (cell ?r2 ?c floor))
    (succ ?r1 ?r2)
    (true (cell ?r1 ?c ?t))
    (distinct ?t floor)
)
(<= (legal player (move ?r1 ?c ?r2 ?c))
    (true (cell ?r2 ?c floor))
    (succ ?r2 ?r1)
    (true (cell ?r1 ?c ?t))
    (distinct ?t floor)
)

(<= (legal player (jump ?r ?c1 ?r ?c3))
    (true (cell ?r ?c3 floor))
    (succ ?c2 ?c3)
    (true (cell ?r ?c2 ?t2))
    (distinct ?t2 floor)
    (succ ?c1 ?c2)
    (true (cell ?r ?c1 ?t1))
    (distinct ?t1 floor)
)
(<= (legal player (jump ?r ?c1 ?r ?c3))
    (true (cell ?r ?c3 floor))
    (succ ?c3 ?c2)
    (true (cell ?r ?c2 ?t2))
    (distinct ?t2 floor)
    (succ ?c2 ?c1)
    (true (cell ?r ?c1 ?t1))
    (distinct ?t1 floor)
)

(<= (legal player (jump ?r1 ?c ?r3 ?c))
    (true (cell ?r3 ?c floor))
    (succ ?r2 ?r3)
    (true (cell ?r2 ?c ?t2))
    (distinct ?t2 floor)
    (succ ?r1 ?r2)
    (true (cell ?r1 ?c ?t1))
    (distinct ?t1 floor)
)
(<= (legal player (jump ?r1 ?c ?r3 ?c))
    (true (cell ?r3 ?c floor))
    (succ ?r3 ?r2)
    (true (cell ?r2 ?c ?t2))
    (distinct ?t2 floor)
    (succ ?r2 ?r1)
    (true (cell ?r1 ?c ?t1))
    (distinct ?t1 floor)
)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(<= (goal player 100)
    (true (correctFrogs 15))
    (true (correctToads 15))
)

(<= (goal player 99)
    (true (step 116))
    (true (correctFrogs 14))
    (true (correctToads 15))
)

(<= (goal player 99)
    (true (step 116))
    (true (correctFrogs 15))
    (true (correctToads 14))
)

(<= (goal player 93)
    (true (step 116))
    (true (correctFrogs 14))
    (true (correctToads 14))
)

(<= (goal player 92)
    (true (step 116))
    (true (correctFrogs 14))
    (true (correctToads 13))
)

(<= (goal player 92)
    (true (step 116))
    (true (correctFrogs 13))
    (true (correctToads 14))
)

(<= (goal player 86)
    (true (step 116))
    (true (correctFrogs 13))
    (true (correctToads 13))
)

(<= (goal player 85)
    (true (step 116))
    (true (correctFrogs 12))
    (true (correctToads 13))
)

(<= (goal player 85)
    (true (step 116))
    (true (correctFrogs 13))
    (true (correctToads 12))
)

(<= (goal player 79)
    (true (step 116))
    (true (correctFrogs 12))
    (true (correctToads 12))
)

(<= (goal player 78)
    (true (step 116))
    (true (correctFrogs 12))
    (true (correctToads 11))
)

(<= (goal player 78)
    (true (step 116))
    (true (correctFrogs 11))
    (true (correctToads 12))
)

(<= (goal player 72)
    (true (step 116))
    (true (correctFrogs 11))
    (true (correctToads 11))
)

(<= (goal player 71)
    (true (step 116))
    (true (correctFrogs 10))
    (true (correctToads 11))
)

(<= (goal player 71)
    (true (step 116))
    (true (correctFrogs 11))
    (true (correctToads 10))
)

(<= (goal player 65)
    (true (step 116))
    (true (correctFrogs 10))
    (true (correctToads 10))
)

(<= (goal player 64)
    (true (step 116))
    (true (correctFrogs 10))
    (true (correctToads 9))
)

(<= (goal player 64)
    (true (step 116))
    (true (correctFrogs 9))
    (true (correctToads 10))
)

(<= (goal player 58)
    (true (step 116))
    (true (correctFrogs 9))
    (true (correctToads 9))
)

(<= (goal player 57)
    (true (step 116))
    (true (correctFrogs 8))
    (true (correctToads 9))
)

(<= (goal player 57)
    (true (step 116))
    (true (correctFrogs 9))
    (true (correctToads 8))
)

(<= (goal player 51)
    (true (step 116))
    (true (correctFrogs 8))
    (true (correctToads 8))
)

(<= (goal player 50)
    (true (step 116))
    (true (correctFrogs 8))
    (true (correctToads 7))
)

(<= (goal player 50)
    (true (step 116))
    (true (correctFrogs 7))
    (true (correctToads 8))
)

(<= (goal player 44)
    (true (step 116))
    (true (correctFrogs 7))
    (true (correctToads 7))
)

(<= (goal player 43)
    (true (step 116))
    (true (correctFrogs 6))
    (true (correctToads 7))
)

(<= (goal player 43)
    (true (step 116))
    (true (correctFrogs 7))
    (true (correctToads 6))
)

(<= (goal player 37)
    (true (step 116))
    (true (correctFrogs 6))
    (true (correctToads 6))
)

(<= (goal player 36)
    (true (step 116))
    (true (correctFrogs 6))
    (true (correctToads 5))
)

(<= (goal player 36)
    (true (step 116))
    (true (correctFrogs 5))
    (true (correctToads 6))
)

(<= (goal player 30)
    (true (step 116))
    (true (correctFrogs 5))
    (true (correctToads 5))
)

(<= (goal player 29)
    (true (step 116))
    (true (correctFrogs 4))
    (true (correctToads 5))
)

(<= (goal player 29)
    (true (step 116))
    (true (correctFrogs 5))
    (true (correctToads 4))
)

(<= (goal player 23)
    (true (step 116))
    (true (correctFrogs 4))
    (true (correctToads 4))
)

(<= (goal player 22)
    (true (step 116))
    (true (correctFrogs 4))
    (true (correctToads 3))
)

(<= (goal player 22)
    (true (step 116))
    (true (correctFrogs 3))
    (true (correctToads 4))
)

(<= (goal player 16)
    (true (step 116))
    (true (correctFrogs 3))
    (true (correctToads 3))
)

(<= (goal player 15)
    (true (step 116))
    (true (correctFrogs 2))
    (true (correctToads 3))
)

(<= (goal player 15)
    (true (step 116))
    (true (correctFrogs 3))
    (true (correctToads 2))
)

(<= (goal player 9)
    (true (step 116))
    (true (correctFrogs 2))
    (true (correctToads 2))
)

(<= (goal player 8)
    (true (step 116))
    (true (correctFrogs 2))
    (true (correctToads 1))
)

(<= (goal player 8)
    (true (step 116))
    (true (correctFrogs 1))
    (true (correctToads 2))
)

(<= (goal player 2)
    (true (step 116))
    (true (correctFrogs 1))
    (true (correctToads 1))
)

(<= (goal player 1)
    (true (step 116))
    (true (correctFrogs 0))
    (true (correctToads 1))
)

(<= (goal player 1)
    (true (step 116))
    (true (correctFrogs 1))
    (true (correctToads 0))
)

(<= (goal player 0)
    (true (step 116))
    (true (correctFrogs 0))
    (true (correctToads 0))
)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(<= terminal
    (true (step 116))
)

(<= terminal
    (true (correctFrogs 15))
    (true (correctToads 15))
)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(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)
(succ 100 101)
(succ 101 102)
(succ 102 103)
(succ 103 104)
(succ 104 105)
(succ 105 106)
(succ 106 107)
(succ 107 108)
(succ 108 109)
(succ 109 110)
(succ 110 111)
(succ 111 112)
(succ 112 113)
(succ 113 114)
(succ 114 115)
(succ 115 116)

sees_XML(...) rules

(<= (sees_xml random ?t) (true ?t))
(<= (sees_xml ?p ?t) (role ?p) (distinct ?p random) (true ?t))