(define "ConnectedEdges" (!= 0 (count Sites in:(forEach (sites Occupied by:#1) if:(is Connected at:(site) All #1)))) ) //------------------------------------------------------------------------------ (game "Tara" (players 2) (equipment { (board (square 5) use:Vertex) (piece "Ball" Each) (regions P1 {(sites Top) (sites Bottom) }) (regions P2 {(sites Left) (sites Right) }) }) (rules phases:{ (phase "Opening" (play (move Add (to (intersection (sites Top) (sites Left))) ) ) (nextPhase "Main") ) (phase "Main" (play (if (is Mover P1) (move Select (from (sites Top) if:(not (is In (column of:(from)) (sites Pending)))) (then (and { (if (is Enemy (who at:(coord row:0 column:(column of:(last From))))) (set Pending (row of:(coord row:0 column:(column of:(last From))))) ) (push (from (last To)) S) (add (piece (id "Ball" Mover)) (to (last To))) }) ) ) (move Select (from (sites Left) if:(not (is In (row of:(from)) (sites Pending)))) (then (and { (if (is Enemy (who at:(coord row:(row of:(last From)) column:(- (count Columns) 1)))) (set Pending (column of:(coord row:(row of:(last From)) column:(- (count Columns) 1)))) ) (push (from (last To)) E) (add (piece (id "Ball" Mover)) (to (last To))) }) ) ) ) ) ) } (end { (if ("ConnectedEdges" P1) (result P1 Win)) (if ("ConnectedEdges" P2) (result P2 Win)) }) ) ) //------------------------------------------------------------------------------ (metadata (info { (description "The game is played on a initial empty 5x5 board.") (rules "MOVE - Each player inserts a stone onto the board from an edge. Black inserts from top and pushes from top to bottom, White inserts from left and pushes from left to right. - Black starts with a stone on the top-left corner. - Passing is not allowed - If a stone, when pushed meets another stone, this too is pushed on the same direction, and so on... EDGE - A stone pushed off the edge during a push is returned to the player (there are no captures). If it is an opponent stone, this row/column cannot be used on the next turn (friendly stones do not have such restriction). GOAL - Wins the player which makes a path between the edges (top-bottom for Black, right-left for White). Stones may be connected orthogonal or diagonal.") (id "1812") (source "www.di.fc.ul.pt") (version "1.3.12") (classification "board/space/connection") (author "Dijkstra and van Dijk") (credit "Eric Piette") } ) (graphics { (player Colour P1 (colour VeryDarkGrey)) (player Colour P2 (colour White)) (show Edges Diagonal (colour Hidden)) (board Background image:"square.svg" fillColour:(colour 223 178 110) edgeColour:(colour 223 178 110) scale:1.25) (board Colour OuterEdges (colour Black)) (board Colour InnerEdges (colour Black)) (board Colour OuterVertices (colour Hidden)) (board Colour InnerVertices (colour Hidden)) (show Symbol "disc" (sites Corners) fillColour:(colour Black) edgeColour:(colour Black) scale:0.3) }) (ai "Tara_ai" ) )