// (define "GroupCount" (max 0 (max (sizes Group "ScoreConnectionDirection" #1) ) ) ) //--------------------------- // Defines for Tiebreaker scoring option (define "CascadeScore" (max 0 (max (difference (sizes Group "ScoreConnectionDirection" #1) (sizes Group "ScoreConnectionDirection" #2) ) ) ) ) (define "CascadeTie" (and (set Score Mover (var "MoverScore")) (set Score Next (var "NextScore")) ) ) (define "CascadeTiebreaker" (if (= (var "MoverScore") (var "NextScore")) (and (set Score Mover (* ("CascadeScore" Mover Next))) (set Score Next (* ("CascadeScore" Next Mover))) ) ("CascadeTie") ) ) //--------------------- // Defines for scoring options (define "Scoring" // Captures + cascade scoring (set Var "MoverScore" (+ (value Piece at:(handSite Mover)) ("GroupCount" Mover) ) (then (set Var "NextScore" (+ (value Piece at:(handSite Next)) ("GroupCount" Next) ) (then ("CascadeTiebreaker") ) ) ) ) ) //---------------------------- (define "CapturingAtScoreWhat4Who" (forEach Value (array #1) (if (> 2 (count Sites in:(sites Around (value) "ConnectionDirection" if:(is Empty (to))))) (if (is #2 (who at:(value))) (remove (value) (then (if (is Empty (handSite #3)) (add (piece (id "Disc" #2)) (to (handSite #3)) (then (set Value at:(handSite #3) (+ 1 (value Piece at:(handSite #3)))) )) (set Value at:(handSite #3) (+ 1 (value Piece at:(handSite #3)))) ) ) ) (remove (value)) ) ) ) ) //----------------------------- // Placement condition (define "AllHave1Connection2Edge" (all Sites #1 if:(or (and (is Empty (site)) (is In (site) (sites Outer)) ) (!= Infinity (count Steps (step "ConnectionDirection" (to if:(is Empty (to))) ) (site) (difference (sites Outer) (site)) ) ) ) ) ) //----------------------------------------------- // Main routine (game "Watershed" (players 2) (equipment { "BoardUsed" (piece "Ball" Each) (piece "Disc" Each) (hand Each size:1) }) (rules (start (set Score Each 0)) (play (do (move Add (to (sites Empty) if:(< 1 (count Sites in:(intersection (sites Around (to) "ConnectionDirection") (sites Empty) ) ) ) ) ) ifAfterwards:("AllHave1Connection2Edge" (intersection (sites Around (last To) "ConnectionDirection") (sites Empty) ) ) (then (do ("CapturingAtScoreWhat4Who" (intersection (sites Occupied by:All) (sites Around (last To) "ConnectionDirection") ) Next // which pieces score: Mover, Next, All, None // who gets their value ) next:("Scoring") ) ) ) ) (end (if (no Moves Next) { (if (= (score Mover) (score Next)) (result Mover Win) ) (if (!= (score Mover) (score Next)) (byScore) ) } ) ) ) ) /----------------------------------------- // Defines for Options (define "ScoreConnectionDirection" ) (define "ConnectionDirection" ) (define "BoardUsed" ) (define "SquareGrid" (board (square ) use:Cell)) (define "SquareDiagonal" (board (square ) use:Vertex)) //------------------------------------------------- // Options (option "Board Size" args:{ } { (item "Order 5" <5> <1.4> "Order 5 board") (item "Order 7" <7> <1.3> "Order 7 board") (item "Order 9" <9> <1.23> "Order 9 board")** (item "Order 11" <11> <1.2> "Order 11 board") (item "Order 13" <13> <1.18> "Order 13 board") (item "Order 19" <19> <1.13> "Order 19 board") } ) (option "Variant" args:{ } { (item "Plateau - Omni connectivity - Orthogonal groups" <"SquareDiagonal"> <(colour 156 130 126)> <-1> "Watershed Plateau: Omni-Square Grid - Orthogonal group scoring, Bonus for opponent's captured, Largest group loses a tie.") (item "Floodplains - Orthogonal connectivity - Omni groups" <"SquareDiagonal"> <(colour 130 156 126)> <-1> "Watershed Floodplains: Square Grid - Omni directional group scoring, Bonus for sites you lost, Largest group loses in a tie.") } ) //--------------------------------------------- (define "ColourBackground1" (colour 126 130 156)) (define "ColourBackground2" (colour 156 130 126)) (define "ColourBackground" ) (metadata (info { (description "Watershed is a square board placement game based on Branching Coral, with the principle of placing pieces, such that, after placement, every site on the boards still has a connection via empty sites to an empty site at the perimeter. Scoring for the standard Plateau version is based on the size of the largest group plus a bonus factor for the number of opponent's pieces captured. This works to reward capture and thus encourages breaking up opponent's groups, while remaining straight forward in the need to enlarge your largest group, it allows creating come-back groups, or staging combacks by capturing material. Ties are broken in favour of the underdog by considering only the largest group size as a negative score without including the capture bonus. Opponent-paired groups of the same size are excluded in this comparison. If all groups are paired in size with the opponent, last to play wins. Play is only on odd sized boards to avoid mirror strategy, since last to play also wins. A Floodplain variant reverses the board connections, group connections, bonus attribution and tie-breaker rules.") (rules "Goal: Score the most points: -- One point for each stone in one's largest group. -- Bonus points are also awarded for certain captured stones. The board starts empty. Players take alternating turns placing one of their stones onto an empty site. Directly after placement, every site of the board must remain connected to an empty perimeter site via a continuous path of empty sites, and the stone that was placed must be next to any 2 empty sites. Capture After placement, simultaneously remove all the stones adjacent to the placed stone that are no longer next to 2 empty sites. There is no passing. The game ends when no more placements can be made. Ties are broken in favor of the underdog by compairing cascading largest groups (excluding tied pairs) Tie breaker scores are negative, so largest group LOSES. Plateau version (mauve background): Connection to the edge is by omni-directional steps. Stone groups are orthogonal only. Players score one point for every stone in their largest group, plus a bonus point for each captured opponent's stone. The player with the higher score wins. Floodplain version (green background): Connection to the edge is by orthogonal steps. Stone groups are omni-directional adjacent. Players score one point for every stone in their largest group, plus a bonus point for each of their stones that the opponent removed from the board. The player with the higher score wins.") (id "1661") (version "1.3.12") (classification "experimental") (author "Dale W. Walton") (credit "Dale W. Walton") (date "06-05-2021") } ) (graphics { (player Colour P1 (colour 120 36 0)) (player Colour P2 (colour Cream)) (piece Scale "Ball" 0.95) (piece Scale "Disc" 0.70) (piece Background "Ball" image:"Disc" fillColour:(colour 0 0 0 130) edgeColour:(colour 0 0 0 130)) (board Colour Phase0 "ColourBackground") (board StyleThickness InnerEdges 0.4) (board StyleThickness OuterEdges 0.6) (board StyleThickness InnerVertices 0.45) (board StyleThickness OuterVertices 0.45) (board Colour InnerVertices (colour Grey)) (board Colour OuterVertices (colour Grey)) (board Colour InnerEdges (colour Black)) (board Colour OuterEdges (colour Black)) (show Edges Diagonal (colour DarkGrey)) (show Piece Value "Disc" Middle) (board Background image:"Square-alt1" fillColour:"ColourBackground" edgeColour:(colour 180 180 180 80) scale:) } ) (ai "Watershed_ai" ) )