(define "DiagonalNESW" (union (sites Direction from:(last To) NE included:True) (sites Direction from:(last To) SW)) ) (define "DiagonalSENW" (union (sites Direction from:(last To) SE included:True) (sites Direction from:(last To) NW)) ) //------------------------------------------------------------------------------ (game "Diagonals" (players 2) (equipment { (board (square 8) use:Vertex) (piece "Ball" Each) }) (rules (play (move Add (to (sites Empty)) (then (and (if (not (is In (last To) (sites {"A8" "H1"}))) (if (all Sites ("DiagonalNESW") if:(is Occupied (site))) (addScore Mover (count Sites in:(forEach ("DiagonalNESW") if:("IsFriendAt" (site))))) ) ) (if (not (is In (last To) (sites {"A1" "H8"}))) (if (all Sites ("DiagonalSENW") if:(is Occupied (site))) (addScore Mover (count Sites in:(forEach ("DiagonalSENW") if:("IsFriendAt" (site))))) ) ) ) ) ) ) (end (if (is Full) (byScore))) ) ) //------------------------------------------------------------------------------ (metadata (info { (description "A scoring game involving diagonals of the board.") (rules "TURN - On each turn, each player drops a friendly stone on an empty cell. If a diagonal line is full (i.e., there are no empty cells on that diagonal), the player who dropped the last stone achieves so many points as the number of friendly stones on the finished line. Two lines can be finished on one turn, the player achieves points for both lines (the dropped stone counts twice, once for each diagonal). A diagonal line must have at least 2 stones. So, corner cells do not count as diagonals. GOAL - When all cells are occupied, wins the player with more points.") (id "1803") (source "www.di.fc.ul.pt") (version "1.3.14") (classification "board/race/score") (credit "Eric Piette") } ) (graphics { (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 "Diagonals_ai" ) )