You are not logged in. login register
Game racetrackcorridor
name racetrackcorridor
creator admin
number of roles 2
stylesheet racetrackcorridor/racetrackcorridor.xsl
GDL v1
enabled
matches show matches
statistics show game statistics
description

Game Description

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Racetrack Corridor
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  (role white)
  (role black)

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

  (init (cell wlane a 1 b))
  (init (cell wlane a 2 b))
  (init (cell wlane a 3 white))
  (init (cell wlane b 1 b))
  (init (cell wlane b 2 b))
  (init (cell wlane b 3 b))
  (init (cell wlane c 1 b))
  (init (cell wlane c 2 b))
  (init (cell wlane c 3 b))
  (init (cell wlane d 1 b))
  (init (cell wlane d 2 b))
  (init (cell wlane d 3 b))
  (init (cell wlane e 1 b))
  (init (cell wlane e 2 b))
  (init (cell wlane e 3 b))

  (init (cell blane a 1 b))
  (init (cell blane a 2 b))
  (init (cell blane a 3 black))
  (init (cell blane b 1 b))
  (init (cell blane b 2 b))
  (init (cell blane b 3 b))
  (init (cell blane c 1 b))
  (init (cell blane c 2 b))
  (init (cell blane c 3 b))
  (init (cell blane d 1 b))
  (init (cell blane d 2 b))
  (init (cell blane d 3 b))
  (init (cell blane e 1 b))
  (init (cell blane e 2 b))
  (init (cell blane e 3 b))

;; Wall in lane arg1 above row arg2 on the left or right

  (init (wall wlane a none))
  (init (wall wlane b none))
  (init (wall wlane c none))
  (init (wall wlane d none))

  (init (wall blane a none))
  (init (wall blane b none))
  (init (wall blane c none))
  (init (wall blane d none))

  (init (walls white 4))
  (init (walls black 4))

  (init (step 0))

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

  (<= (next (cell ?lane ?x ?y ?q))
      (true (cell ?lane ?x ?y ?q))
      (playerlane ?player ?lane)
      (does ?player (place ?row ?side)))
 
  (<= (next (cell ?lane ?x ?y ?p))
      (playerlane ?player ?lane)
      (does ?player (move ?p ?u ?v ?x ?y)))

  (<= (next (cell ?lane ?u ?v b))
      (playerlane ?player ?lane)
      (does ?player (move ?p ?u ?v ?x ?y)))

  (<= (next (cell ?lane ?w ?z b))
      (playerlane ?player ?lane)
      (does ?player (move ?p ?u ?v ?x ?y))
      (true (cell ?lane ?w ?z b))
      (distinct ?z ?y))

  (<= (next (cell ?lane ?w ?z b))
      (playerlane ?player ?lane)
      (does ?player (move ?p ?u ?v ?x ?y))
      (true (cell ?lane ?w ?z b))
      (distinct ?w ?x))

  (<= (next (wall ?lane ?r ?s))
      (does ?player (move ?p ?u ?v ?x ?y))
      (opponentlane ?player ?lane)
      (true (wall ?lane ?r ?s)))

  (<= (next (wall ?lane ?row ?side))
      (does ?player (place ?row ?side))
      (opponentlane ?player ?lane)
      (true (wall ?lane ?row none)))

  (<= (next (wall ?lane ?row ?side))
      (does ?player (place ?row1 ?side1))
      (opponentlane ?player ?lane)
      (true (wall ?lane ?row ?side))
      (distinct ?row ?row1))

  (<= (next (wall ?lane ?row none))
      (does ?player (place ?r1 ?s1))
      (opponentlane ?player ?lane)
      (true (wall ?lane ?row none))
      (distinct ?r1 ?row))

  (<= (next (walls ?player ?walls))
      (does ?player (move ?p ?u ?v ?x ?y))
      (true (walls ?player ?walls)))

  (<= (next (walls ?player ?walls))
      (does ?player (place ?row ?side))
      (true (walls ?player ?pwalls))
      (succ ?walls ?pwalls))

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

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

  (<= (legal ?player (move ?player ?u ?v ?x ?y))
      (playerlane ?player ?lane)
      (true (cell ?lane ?u ?v ?player))
      (pawnmove ?lane ?u ?v ?x ?y)
      (true (cell ?lane ?x ?y b)))

  (<= (legal ?player (place ?row left))
      (true (walls ?player ?n))
      (greaterthan ?n 0)
      (opponentlane ?player ?lane)
      (true (wall ?lane ?row none)))

  (<= (legal ?player (place ?row right))
      (true (walls ?player ?n))
      (greaterthan ?n 0)
      (opponentlane ?player ?lane)
      (true (wall ?lane ?row none)))

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

  (playerlane white wlane)
  (playerlane black blane)
  (opponentlane white blane)
  (opponentlane black wlane)

  (<= (pawnmove ?lane ?r1 1 ?r2 1)
      (nrow ?r1 ?r2)
      (true (wall ?lane ?r1 none)))

  (<= (pawnmove ?lane ?r1 1 ?r2 1)
      (nrow ?r1 ?r2)
      (true (wall ?lane ?r1 right)))

  (<= (pawnmove ?lane ?r1 2 ?r2 2)
      (nrow ?r1 ?r2)
      (true (wall ?lane ?r1 none)))

  (<= (pawnmove ?lane ?r1 3 ?r2 3)
      (nrow ?r1 ?r2)
      (true (wall ?lane ?r1 none)))

  (<= (pawnmove ?lane ?r1 3 ?r2 3)
      (nrow ?r1 ?r2)
      (true (wall ?lane ?r1 left)))

  (<= (pawnmove ?lane ?r 1 ?r 2)
  	  (playerlane ?c ?lane)
  	  (coordinate ?r))
  	
  (<= (pawnmove ?lane ?r 2 ?r 1)
  	  (playerlane ?c ?lane)
  	  (coordinate ?r))
  	  
  (<= (pawnmove ?lane ?r 2 ?r 3)
  	  (playerlane ?c ?lane)
  	  (coordinate ?r))
  	  
  (<= (pawnmove ?lane ?r 3 ?r 2)
  	  (playerlane ?c ?lane)
  	  (coordinate ?r))    
  	  
  (nrow a b)
  (nrow b c)
  (nrow c d)
  (nrow d e)

  (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)

  (<= (greaterthan ?larger ?smaller)
      (succ ?smaller ?larger))

  (<= (greaterthan ?larger ?smaller)
      (succ ?next ?larger)
      (greaterthan ?next ?smaller))
      
  (coordinate a)
  (coordinate b)
  (coordinate c)
  (coordinate d)
  (coordinate e)
  (coordinate 1)
  (coordinate 2)
  (coordinate 3)

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

  (<= (goal white 100)
      (true (cell wlane e ?x white))
      (true (cell blane ?r ?x1 black))
      (distinct ?r e))

  (<= (goal white 100)
      (true (cell wlane e ?x white))
      (true (cell blane e ?x1 black))
      (true (walls white ?wn))
      (true (walls black ?bn))
      (greaterthan ?wn ?bn))

  (<= (goal white 50)
      (true (cell wlane e ?x white))
      (true (cell blane e ?x1 black))
      (true (walls white ?wn))
      (true (walls black ?bn))
      (greaterthan ?bn ?wn))

  (<= (goal white 10)
      (true (cell blane e ?x black))
      (true (cell wlane ?r ?x1 white))
      (distinct ?r e))

  (<= (goal black 100)
      (true (cell blane e ?x black))
      (true (cell wlane ?r ?x1 white))
      (distinct ?r e))

  (<= (goal black 100)
      (true (cell wlane e ?x white))
      (true (cell blane e ?x1 black))
      (true (walls white ?wn))
      (true (walls black ?bn))
      (greaterthan ?bn ?wn))

  (<= (goal black 50)
      (true (cell wlane e ?x white))
      (true (cell blane e ?x1 black))
      (true (walls white ?wn))
      (true (walls black ?bn))
      (greaterthan ?wn ?bn))

  (<= (goal black 10)
      (true (cell wlane e ?x white))
      (true (cell blane ?r ?x1 black))
      (distinct ?r e))

  (<= (goal ?role 0)
      (true (cell wlane e ?x white))
      (true (cell blane e ?x1 black))
      (true (walls white ?n))
      (true (walls black ?n))
      (role ?role))

  (<= (goal ?role 5)
      (true (step 20))
      (true (cell wlane ?r1 ?x1 white))
      (true (cell blane ?r2 ?x2 black))
      (distinct ?r1 e)
      (distinct ?r2 e)
      (role ?role))

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

  (<= terminal
      (true (step 20)))

  (<= terminal
      (true (cell ?lane e ?r ?p))
      (distinct ?p b))

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

sees_XML(...) rules

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

; transform cell/4 into wlane/3 and blane/3 so it is identified as two boards
(<= (sees_term (wlane ?y ?x ?c))
  (true (cell wlane ?y ?x ?c))
)
(<= (sees_term (blane ?y ?x ?c))
  (true (cell blane ?y ?x ?c))
)
(<= (sees_term ?f)
  (true ?f)
)