// 00'Y' a Defector variant for Y / Master Y / Y Hex board (define "AnyOfTheseSitesMeetThisCondition" //(not (all Sites #1 if:#2)) (< 0 (size Array (array (forEach #1 #2)))) ) (define "Side1" (union (sites Side NE) (sites Side N))) (define "Side2" (union (sites Side SE) (sites Side S))) (define "Side3" (union (sites Side NW) (sites Side SW))) (define "NeighborCountOf" (count Pieces #1 in:(sites Around (to) Orthogonal)) ) (define "AddToEmpty" (move Add (to (sites Empty)) (then ))) (define "FlipFromTo" (move Add (piece (id "Disc" #2)) (to (sites Occupied by:#1) if:(< ("NeighborCountOf" #2) (("NeighborCountOf" #1))) (apply (remove (to))) ))) //--------------------------------------------- // Main routine (game "00'Y'" (players 2) (equipment { (board use:Vertex) (piece "Disc" Each ) (piece "Counter" Neutral maxState:2) } ) (rules (play (priority { (if ("SameTurn") ) ("AddToEmpty") } (then (if (or (= 1 (var "MoveInTurn")) (can Move ) ) (moveAgain) (if ("AnyOfTheseSitesMeetThisCondition" (sites Occupied by:) if:("IsWinningConnectionAtSite" (site)) ) (trigger "Win" ) ))))) (end { (if (is Triggered "Win" ) (result Win) ) (if (and (no Moves Mover) ("AnyOfTheseSitesMeetThisCondition" (sites Occupied by:) if:("IsWinningConnectionAtSite" (site)) )) (result Win) ) } ))) //----------------------------- //Scoring (define "StonesOfIn" (intersection (sites Occupied by:#1) #2)) (define "IsWinningConnectionAtSite" // (is Connected 3 { ("StonesOfIn" Mover "Side1") ("StonesOfIn" Mover "Side2") ("StonesOfIn" Mover "Side3") }) (is Connected 3 at:#1 { "Side1" "Side2" "Side3" }) ) (define "IsConnectedAtStartOfFirstMove" // (and "NewTurn" ("IsConnectedPlayer" Mover)) (and (is Next (next)) ("IsConnectedPlayer")) (and (= 1) ("IsConnectedPlayer" )) ) //------------------------------------------------- // Options (option "Protocol" args:{} { (item "Alternating" <(set Var "MoveInTurn" 0)> "Alternating") (item "Turns 122*" <(set Var "MoveInTurn" (% (+ 3 (var "MoveInTurn")) 2))> "Turns 122*")** } ) (option "Flipping" args:{} { (item "All colors, Cascading (00'Y')" <(or ("FlipFromTo" Next Mover) ("FlipFromTo" Mover Next))> "All, Cascading (00'Y')")** (item "Opponents into Friends" <("FlipFromTo" Next Mover)> "Opponent pieces become friends (Defector Y)") // if alternating (item "Friends into Enemies" <("FlipFromTo" Mover Next)> "Freinly pieces become Opponent's pieces") // if alternating } ) (option "Winning" args:{} { (item "At begining of turn" "Win with connections before you start your move.")** (item "At end of turn" "Win with connections at the end of your last move in your last turn") } ) (option "Board" args:{ } { (item "Triangle 5" <(tri 5)> "Triangle-5 Board (15)") (item "Triangle 6" <(tri 6)> "Triangle-6 Board (21)") (item "Triangle 8*" <(tri 8)> "Triangle-8 Board (36)")** (item "Triangle 9" <(tri 9)> "Triangle-9 Board (45)") (item "Triangle 11" <(tri 11)> "Triangle-11 Board (66)") (item "Triangle 12" <(tri 12)> "Triangle-12 Board (78)") (item "Triangle 14" <(tri 14)> "Triangle-14 Board (105)") (item "Triangle 15*" <(tri 15)> "Triangle-15 Board (120)")** (item "Triangle 17" <(tri 17)> "Triangle-17 Board (153)") (item "Hex 3-4" <(tri Limping 3)> "Hex 4-5 Board (48)") (item "Hex 4-5*" <(tri Limping 4)> "Hex 4-5 Board (48)")*** (item "Hex 5-6" <(tri Limping 5)> "Hex 5-6 Board (75)") (item "Hex 6-7*" <(tri Limping 6)> "Hex 6-7 Board (108)")** (item "Hex 7-8" <(tri Limping 7)> "Hex 7-8 Board (146)") (item "Hex 8-9" <(tri Limping 8)> "Hex 8-9 Board (146)") (item "Tiangle 7-7" <(renumber (rotate 90 (trim (remove (tri Limping 7) vertices:{2 3 4 5 6 7 8 12 13 14 15 16 17 23 24 25 26 27 28 35 36 37 38 39 48 49 50 51 52 62 63 64 65 77 78 79 90 91 101 102 103 111 112 113 120 121 122 123 128 129 130 131 135 136 137 138 139 141 142 143 144 145 146} ))))> "Triangle Board (83 turns)" ) } ) //------------------------------------- (define "P1Colour" (colour DarkGreen)) (define "P2Colour" (colour White)) (define "BoardColour" (colour 215 203 170)) (define "EdgesOfSide" (intersection (sites Outer Edge) (forEach of:(difference #1 (sites Corners Vertex)) (sites Incident Edge of:Vertex at:(site)) ))) //--------------------------------------------- (metadata (info { (description "Double-'0' Y ('00'-Y / 'Double Agent Y') is based on 'Defector Y' but causes sequential cascading flips after piece placement. This is applied to every piece that is surrounded by an excess of its own kind, -- not just the flipping of opponents into friends. Since the flips cascade, they are resolved immediately and unlike Defector Y are not pending from previous turns. Therefore the flips are evaluated after each placement, rather than before the last placement of a turn. These changes allow a tactic of placing your piece, then immediately flipping it in order to flip an opponent's piece on the opposite side to become your own; which can be effective for breaking chains. Since chains can be broken, the end condition is evaluated before one's turn rather than after, lessening the sharpness of compared to Defector Y. Note that options can be selected that make the game very close to Defector Y, but there remains a difference in the Alternating Turn versions: conversion here is after placement, originally it was before. However, the Double turn version should be equivalent. The 3rd option, where friends flip to enemies, has a very cold feeling to it especially if the win is at the beginning of the turn.") (rules "Goal: Connect all three edge colors with a single group of connected stones of your own color. (As in 'Y') First turn is a single move. In the standard game subsequent turns have two placements each. The player seeking to connect with the darker color starts. The moves consist of two parts: placement, then conditional 'flipping' of stones: - Placement is to any empty location. - 'Flipping' means changing the color of a stone that has more neighbors of its own color than enemy neighbors. Flipping is restricted to the selected option. Stones are flipped one at a time until no more can flip. Options are: -- 00'Y': All - Each applicable stone flips, one at a time with cascading effects, until no more can flip. -- Defector Y: Enemies flip into Friends - these might be pieces near/at the stone just placed placed, and/or a stone the opponent flipped. -- Friends flip into Enemies - these might be pieces near/at the opponent's last placements or flips. The first player to connect all 3 sides after the all flips have been made is the winner.") (id "4035") (version "1.3.12") (classification "board/space/connection") (author "Dale W. Walton") (credit "Dale W. Walton") (date "14-05-2023") } ) (graphics { (player Colour P1 "P1Colour") (player Colour P2 "P2Colour") (board StyleThickness OuterEdges 7.5) (region Colour Edge ("EdgesOfSide" "Side1") regionSiteType:Edge (colour Red)) (region Colour Edge ("EdgesOfSide" "Side2") regionSiteType:Edge (colour Blue)) (region Colour Edge ("EdgesOfSide" "Side3") regionSiteType:Edge (colour Yellow)) (board Style Board) (board Colour Phase0 "BoardColour") (board Colour InnerEdges (colour 120 100 40 190) ) (board Colour OuterEdges (colour 120 100 40 190) ) (piece Scale .7) } ))