You are not logged in. login register
Game amazons_fixed
name amazons_fixed
creator TheCat
number of roles 2
stylesheet generic/generic.xsl
GDL v1
enabled
matches show matches
statistics show game statistics
description The amazons board game - the orthodox version

Game Description

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Amazons -- the orthodox version
;;;
;;; Fixed by Marek SzykuÅ?a
;;; The game ends when the current player has no legal move.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ROLE Relations
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(role white)
(role black)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; INIT Relations
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(init (location  4  1 white))
(init (location  7  1 white))
(init (location  1  4 white))
(init (location 10  4 white))

(init (location  1  7 black))
(init (location 10  7 black))
(init (location  4 10 black))
(init (location  7 10 black))

(init (control white))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; LEGAL Relations
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(<= (legal ?player noop)
    (role ?player)
    (not (true (control ?player))))
    
(<= (legal ?player (play ?x1 ?y1 ?x2 ?y2 ?x3 ?y3))
    (true (control ?player))
    (true (location ?x1 ?y1 ?player))
    (queenMove ?x1 ?y1 ?x2 ?y2)
    (emptyCell ?x2 ?y2)
    (queenMoveIgnoring ?x1 ?y1 ?x2 ?y2 ?x3 ?y3)
    (emptyCell ?x3 ?y3))    

(<= (legal ?player (play ?x1 ?y1 ?x2 ?y2 ?x1 ?y1))
    (true (control ?player))
    (true (location ?x1 ?y1 ?player))
    (queenMove ?x1 ?y1 ?x2 ?y2)
    (emptyCell ?x2 ?y2))
    
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; NEXT Relations
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
(<= (next (location ?x ?y ?state))
    (true (location ?x ?y ?state))
    (does ?player (play ?x1 ?y1 ?x2 ?y2 ?x3 ?y3))
    (distinctCell ?x ?y ?x1 ?y1))
    
(<= (next (location ?x2 ?y2 ?player))
    (does ?player (play ?x1 ?y1 ?x2 ?y2 ?x3 ?y3)))
    
(<= (next (location ?x3 ?y3 arrow))
    (does ?player (play ?x1 ?y1 ?x2 ?y2 ?x3 ?y3)))
    
(<= (next (control black))
    (true (control white)))
(<= (next (control white))
    (true (control black)))
    
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; TERMINAL Relations
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(<= terminal
    (true (control ?player))
    (not (legalMove ?player)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; GOAL Relations
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(<= (goal white 100)
    (true (control black)))
(<= (goal white 0)
    (true (control white)))
    
(<= (goal black 100)
    (true (control white)))
(<= (goal black 0)
    (true (control black)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; View Definitions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(<= (legalMove ?player)
    (true (location ?x1 ?y1 ?player))
    (queenMove ?x1 ?y1 ?xAny ?yAny)
    (emptyCell ?xAny ?yAny))

(<= (queenMove ?x1 ?y1 ?x2 ?y2)
    (rookMove ?x1 ?y1 ?x2 ?y2))
(<= (queenMove ?x1 ?y1 ?x2 ?y2)
    (bishopMove ?x1 ?y1 ?x2 ?y2))
    
(<= (rookMove ?x1 ?y1 ?x2 ?y2)
    (horizontalMove ?x1 ?y1 ?x2 ?y2))
(<= (rookMove ?x1 ?y1 ?x2 ?y2)
    (horizontalMove ?x2 ?y2 ?x1 ?y1))
(<= (rookMove ?x1 ?y1 ?x2 ?y2)
    (verticalMove ?x1 ?y1 ?x2 ?y2))
(<= (rookMove ?x1 ?y1 ?x2 ?y2)
    (verticalMove ?x2 ?y2 ?x1 ?y1))

(<= (bishopMove ?x1 ?y1 ?x2 ?y2)
    (diagonalUpMove ?x1 ?y1 ?x2 ?y2))
(<= (bishopMove ?x1 ?y1 ?x2 ?y2)
    (diagonalUpMove ?x2 ?y2 ?x1 ?y1))
(<= (bishopMove ?x1 ?y1 ?x2 ?y2)
    (diagonalDownMove ?x1 ?y1 ?x2 ?y2))
(<= (bishopMove ?x1 ?y1 ?x2 ?y2)
    (diagonalDownMove ?x2 ?y2 ?x1 ?y1))    
    
(<= (horizontalMove ?x1 ?y ?x3 ?y)
    (++ ?x1 ?x2)
    (emptyCell ?x2 ?y)
    (horizontalMove ?x2 ?y ?x3 ?y)
    (index ?y))
(<= (horizontalMove ?x1 ?y ?x2 ?y)
    (++ ?x1 ?x2)
    (index ?y))

(<= (verticalMove ?x ?y1 ?x ?y3)
    (++ ?y1 ?y2)
    (emptyCell ?x ?y2)
    (verticalMove ?x ?y2 ?x ?y3)
    (index ?x))
(<= (verticalMove ?x ?y1 ?x ?y2)
    (++ ?y1 ?y2)
    (index ?x))	
	
(<= (diagonalUpMove ?x1 ?y1 ?x3 ?y3)
    (++ ?x1 ?x2)
    (++ ?y1 ?y2)
    (emptyCell ?x2 ?y2)
    (diagonalUpMove ?x2 ?y2 ?x3 ?y3))
(<= (diagonalUpMove ?x1 ?y1 ?x2 ?y2)
    (++ ?x1 ?x2)
    (++ ?y1 ?y2))	
	
(<= (diagonalDownMove ?x1 ?y1 ?x3 ?y3)
    (++ ?x1 ?x2)
    (++ ?y2 ?y1)
    (emptyCell ?x2 ?y2)
    (diagonalDownMove ?x2 ?y2 ?x3 ?y3))
(<= (diagonalDownMove ?x1 ?y1 ?x2 ?y2)
    (++ ?x1 ?x2) 
    (++ ?y2 ?y1))    
    
(<= (queenMoveIgnoring ?xIg ?yIg ?x1 ?y1 ?x2 ?y2)
    (rookMoveIgnoring ?xIg ?yIg ?x1 ?y1 ?x2 ?y2))
(<= (queenMoveIgnoring ?xIg ?yIg ?x1 ?y1 ?x2 ?y2)
    (bishopMoveIgnoring ?xIg ?yIg ?x1 ?y1 ?x2 ?y2))
    
(<= (rookMoveIgnoring ?xIg ?yIg ?x1 ?y1 ?x2 ?y2)
    (horizontalMoveIgnoring ?xIg ?yIg ?x1 ?y1 ?x2 ?y2))
(<= (rookMoveIgnoring ?xIg ?yIg ?x1 ?y1 ?x2 ?y2)
    (horizontalMoveIgnoring ?xIg ?yIg ?x2 ?y2 ?x1 ?y1))
(<= (rookMoveIgnoring ?xIg ?yIg ?x1 ?y1 ?x2 ?y2)
    (verticalMoveIgnoring ?xIg ?yIg ?x1 ?y1 ?x2 ?y2))
(<= (rookMoveIgnoring ?xIg ?yIg ?x1 ?y1 ?x2 ?y2)
    (verticalMoveIgnoring ?xIg ?yIg ?x2 ?y2 ?x1 ?y1))

(<= (bishopMoveIgnoring ?xIg ?yIg ?x1 ?y1 ?x2 ?y2)
    (diagonalUpMoveIgnoring ?xIg ?yIg ?x1 ?y1 ?x2 ?y2))
(<= (bishopMoveIgnoring ?xIg ?yIg ?x1 ?y1 ?x2 ?y2)
    (diagonalUpMoveIgnoring ?xIg ?yIg ?x2 ?y2 ?x1 ?y1))
(<= (bishopMoveIgnoring ?xIg ?yIg ?x1 ?y1 ?x2 ?y2)
    (diagonalDownMoveIgnoring ?xIg ?yIg ?x1 ?y1 ?x2 ?y2))
(<= (bishopMoveIgnoring ?xIg ?yIg ?x1 ?y1 ?x2 ?y2)
    (diagonalDownMoveIgnoring ?xIg ?yIg ?x2 ?y2 ?x1 ?y1))    
    
(<= (horizontalMoveIgnoring ?xIg ?yIg ?x1 ?y ?x3 ?y)
    (++ ?x1 ?x2)
    (emptyCell ?x2 ?y)
    (horizontalMoveIgnoring ?xIg ?yIg ?x2 ?y ?x3 ?y)
    (index ?y))
(<= (horizontalMoveIgnoring ?x2 ?y ?x1 ?y ?x3 ?y)
    (++ ?x1 ?x2)
    (horizontalMoveIgnoring ?x2 ?y ?x2 ?y ?x3 ?y)
    (index ?y))
(<= (horizontalMoveIgnoring ?xIg ?yIg ?x1 ?y ?x2 ?y)
    (++ ?x1 ?x2)
    (index ?y)
    (cell ?xIg ?yIg))

(<= (verticalMoveIgnoring ?xIg ?yIg ?x ?y1 ?x ?y3)
    (++ ?y1 ?y2)
    (emptyCell ?x ?y2)
    (verticalMoveIgnoring ?xIg ?yIg ?x ?y2 ?x ?y3)
    (index ?x))
(<= (verticalMoveIgnoring ?x ?y2 ?x ?y1 ?x ?y3)
    (++ ?y1 ?y2)
    (verticalMoveIgnoring ?x ?y2 ?x ?y2 ?x ?y3)
    (index ?x))
(<= (verticalMoveIgnoring ?xIg ?yIg ?x ?y1 ?x ?y2)
    (++ ?y1 ?y2)
    (index ?x)
    (cell ?xIg ?yIg))	
	
(<= (diagonalUpMoveIgnoring ?xIg ?yIg ?x1 ?y1 ?x3 ?y3)
    (++ ?x1 ?x2)
    (++ ?y1 ?y2)
    (emptyCell ?x2 ?y2)
    (diagonalUpMoveIgnoring ?xIg ?yIg ?x2 ?y2 ?x3 ?y3))
(<= (diagonalUpMoveIgnoring ?x2 ?y2 ?x1 ?y1 ?x3 ?y3)
    (++ ?x1 ?x2)
    (++ ?y1 ?y2)
    (diagonalUpMoveIgnoring ?x2 ?y2 ?x2 ?y2 ?x3 ?y3))
(<= (diagonalUpMoveIgnoring ?xIg ?yIg ?x1 ?y1 ?x2 ?y2)
    (++ ?x1 ?x2)
    (++ ?y1 ?y2)
    (cell ?xIg ?yIg))	
	
(<= (diagonalDownMoveIgnoring ?xIg ?yIg ?x1 ?y1 ?x3 ?y3)
    (++ ?x1 ?x2)
    (++ ?y2 ?y1)
    (emptyCell ?x2 ?y2)
    (diagonalDownMoveIgnoring ?xIg ?yIg ?x2 ?y2 ?x3 ?y3))
(<= (diagonalDownMoveIgnoring ?x2 ?y2 ?x1 ?y1 ?x3 ?y3)
    (++ ?x1 ?x2)
    (++ ?y2 ?y1)
    (diagonalDownMoveIgnoring ?x2 ?y2 ?x2 ?y2 ?x3 ?y3))
(<= (diagonalDownMoveIgnoring ?xIg ?yIg ?x1 ?y1 ?x2 ?y2)
    (++ ?x1 ?x2) 
    (++ ?y2 ?y1)
    (cell ?xIg ?yIg))    

(<= (emptyCell ?x ?y)
    (cell ?x ?y)
    (not (true (location ?x ?y white)))
    (not (true (location ?x ?y black)))
	(not (true (location ?x ?y arrow))))

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

(<= (cell ?x ?y)
    (index ?x)
    (index ?y))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Static Relations
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(index 1) (index 2) (index 3) (index 4) (index 5) (index 6) (index 7) (index 8) (index 9) (index 10)
(++ 1 2)  (++ 2 3)  (++ 3 4)  (++ 4 5)  (++ 5 6)  (++ 6 7)  (++ 7 8)  (++ 8 9)  (++ 9 10)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Bases and Inputs
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(<= (input ?player noop)
	(role ?player))
;Squares 1 and 2 need to lie on the same line, as do squares 2 and 3.
(<= (sameLine ?x ?y1 ?x ?y2)
	(index ?x)
	(index ?y1)
	(index ?y2))
(<= (sameLine ?x1 ?y ?x2 ?y)
	(index ?x1)
	(index ?x2)
	(index ?y))
(<= (sameLine ?x1 ?y1 ?x2 ?y2)
	(diagPos ?x1 ?y1 ?x2 ?y2))
(<= (sameLine ?x1 ?y1 ?x2 ?y2)
	(diagPos ?x2 ?y2 ?x1 ?y1))
(<= (sameLine ?x1 ?y1 ?x2 ?y2)
	(diagNeg ?x1 ?y1 ?x2 ?y2))
(<= (sameLine ?x1 ?y1 ?x2 ?y2)
	(diagNeg ?x2 ?y2 ?x1 ?y1))
(<= (diagPos ?x1 ?y1 ?x2 ?y2)
	(++ ?x1 ?x2)
	(++ ?y1 ?y2))
(<= (diagPos ?x1 ?y1 ?x3 ?y3)
	(diagPos ?x1 ?y1 ?x2 ?y2)
	(++ ?x2 ?x3)
	(++ ?y2 ?y3))
(<= (diagNeg ?x1 ?y1 ?x2 ?y2)
	(++ ?x1 ?x2)
	(++ ?y2 ?y1))
(<= (diagNeg ?x1 ?y1 ?x3 ?y3)
	(diagNeg ?x1 ?y1 ?x2 ?y2)
	(++ ?x2 ?x3)
	(++ ?y3 ?y2))
(<= (input ?player (play ?x1 ?y1 ?x2 ?y2 ?x3 ?y3))
	(role ?player)
	(sameLine ?x1 ?y1 ?x2 ?y2)
	(sameLine ?x2 ?y2 ?x3 ?y3))
(<= (base (control ?player))
	(role ?player))
(<= (base (location ?x ?y arrow))
	(index ?x)
	(index ?y))
(<= (base (location ?x ?y ?mark))
	(index ?x)
	(index ?y)
	(role ?mark))
 

sees_XML(...) rules

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