05-16-2020, 12:30 PM
Hi Remi,
I got inspired and implemented Ultimate Tic-Tac-Toe this morning. Nice game!
It will appear in our next interim release, or you can put the appended text into a .lud file and run it directly.
Regards,
Cameron
//=========================================================
(game "Ultimate Tic-Tac-Toe"
(players 2)
(equipment
{
(customBoard
(graph
vertices:{
{0 0} {1 0} {2 0} {3 0} {4 0} {5 0} {6 0} {7 0} {8 0}
{0 1} {1 1} {2 1} {3 1} {4 1} {5 1} {6 1} {7 1} {8 1}
{0 2} {1 2} {2 2} {3 2} {4 2} {5 2} {6 2} {7 2} {8 2}
{0 3} {1 3} {2 3} {3 3} {4 3} {5 3} {6 3} {7 3} {8 3}
{0 4} {1 4} {2 4} {3 4} {4 4} {5 4} {6 4} {7 4} {8 4}
{0 5} {1 5} {2 5} {3 5} {4 5} {5 5} {6 5} {7 5} {8 5}
{0 6} {1 6} {2 6} {3 6} {4 6} {5 6} {6 6} {7 6} {8 6}
{0 7} {1 7} {2 7} {3 7} {4 7} {5 7} {6 7} {7 7} {8 7}
{0 8} {1 8} {2 8} {3 8} {4 8} {5 8} {6 8} {7 8} {8 8}
{1 1} {4 1} {7 1} {1 4} {4 4} {7 4} {1 7} {4 7} {7 7}
}
edges:{
{ 0 1} { 1 2} { 9 10} {10 11} {18 19} {19 20}
{ 0 9} { 1 10} { 2 11} { 9 18} {10 19} {11 20}
{ 0 10} {10 20} { 2 10} {10 18}
{ 3 4} { 4 5} {12 13} {13 14} {21 22} {22 23}
{ 3 12} { 4 13} { 5 14} {12 21} {13 22} {14 23}
{ 3 13} {13 23} { 5 13} {13 21}
{ 6 7} { 7 8} {15 16} {16 17} {24 25} {25 26}
{ 6 15} { 7 16} { 8 17} {15 24} {16 25} {17 26}
{ 6 16} {16 26} { 8 16} {16 24}
{27 28} {28 29} {36 37} {37 38} {45 46} {46 47}
{27 36} {28 37} {29 38} {36 45} {37 46} {38 47}
{27 37} {37 47} {29 37} {37 45}
{30 31} {31 32} {39 40} {40 41} {48 49} {49 50}
{30 39} {31 40} {32 41} {39 48} {40 49} {41 50}
{30 40} {40 50} {32 40} {40 48}
{33 34} {34 35} {42 43} {43 44} {51 52} {52 53}
{33 42} {34 43} {35 44} {42 51} {43 52} {44 53}
{33 43} {43 53} {35 43} {43 51}
{54 55} {55 56} {63 64} {64 65} {72 73} {73 74}
{54 63} {55 64} {56 65} {63 72} {64 73} {65 74}
{54 64} {64 74} {56 64} {64 72}
{57 58} {58 59} {66 67} {67 68} {75 76} {76 77}
{57 66} {58 67} {59 68} {66 75} {67 76} {68 77}
{57 67} {67 77} {59 67} {67 75}
{60 61} {61 62} {69 70} {70 71} {78 79} {79 80}
{60 69} {61 70} {62 71} {69 78} {70 79} {71 80}
{60 70} {70 80} {62 70} {70 78}
// Super board: sites overlap centre of each sub-game
{81 82} {82 83} {84 85} {85 86} {87 88} {88 89}
{81 84} {82 85} {83 86} {84 87} {85 88} {86 89}
{81 85} {85 89} {83 85} {85 87}
}
)
)
(piece "Disc" P1)
(piece "DiscB" P1)
(piece "Cross" P2)
(piece "CrossB" P2)
(regions "SubGames" (sites { 0..80}))
(regions "SubGame0" (sites { 0..2 9..11 18..20}))
(regions "SubGame1" (sites { 3..5 12..14 21..23}))
(regions "SubGame2" (sites { 6..8 15..17 24..26}))
(regions "SubGame3" (sites {27..29 36..38 45..47}))
(regions "SubGame4" (sites {30..32 39..41 48..50}))
(regions "SubGame5" (sites {33..35 42..44 51..53}))
(regions "SubGame6" (sites {54..56 63..65 72..74}))
(regions "SubGame7" (sites {57..59 66..68 75..77}))
(regions "SubGame8" (sites {60..62 69..71 78..80}))
(regions "SuperGame" (sites {81..89}))
(map
"SubToSuper"
{0..80}
{
81 81 81 82 82 82 83 83 83
81 81 81 82 82 82 83 83 83
81 81 81 82 82 82 83 83 83
84 84 84 85 85 85 86 86 86
84 84 84 85 85 85 86 86 86
84 84 84 85 85 85 86 86 86
87 87 87 88 88 88 89 89 89
87 87 87 88 88 88 89 89 89
87 87 87 88 88 88 89 89 89
}
)
(map
"SubToSub"
{0..80}
{
0 1 2 0 1 2 0 1 2
3 4 5 3 4 5 3 4 5
6 7 8 6 7 8 6 7 8
0 1 2 0 1 2 0 1 2
3 4 5 3 4 5 3 4 5
6 7 8 6 7 8 6 7 8
0 1 2 0 1 2 0 1 2
3 4 5 3 4 5 3 4 5
6 7 8 6 7 8 6 7 8
}
)
}
)
(rules
(play
(priority
{
// Move at any empty cell in the designated subgame
// whose supergame is undecided
(add
(if (= (mover) P1) (id "Disc" P1) (id "Cross" P2))
to
if (= 0 (mapEntry "SubToSub" (lastTo)))
(sites "SubGame0")
(if (= 1 (mapEntry "SubToSub" (lastTo)))
(sites "SubGame1")
(if (= 2 (mapEntry "SubToSub" (lastTo)))
(sites "SubGame2")
(if (= 3 (mapEntry "SubToSub" (lastTo)))
(sites "SubGame3")
(if (= 4 (mapEntry "SubToSub" (lastTo)))
(sites "SubGame4")
(if (= 5 (mapEntry "SubToSub" (lastTo)))
(sites "SubGame5")
(if (= 6 (mapEntry "SubToSub" (lastTo)))
(sites "SubGame6")
(if (= 7 (mapEntry "SubToSub" (lastTo)))
(sites "SubGame7")
(if (= 8 (mapEntry "SubToSub" (lastTo)))
(sites "SubGame8")
)
)
)
)
)
)
)
)
)
if
and (is Empty at
to)) (is Empty at
mapEntry "SubToSuper" (to))))
)
// Move at any empty cell whose supergame is undecided
(add
(if (= (mover) P1) (id "Disc" P1) (id "Cross" P2))
to
intersection (sites "SubGames") (sites Empty))
if
and (is Empty at
to)) (is Empty at
mapEntry "SubToSuper" (to))))
)
}
(then
(if (is Line 3) // add a piece in the supergame
(add
(if (= (mover) P1) (id "DiscB" P1) (id "CrossB" P2))
at
mapEntry "SubToSuper" (lastTo))
)
)
)
)
)
(end
(if
(is Line 3 throughAny
sites "SuperGame") Mover)
(result Mover Win)
)
)
)
)
//------------------------------------------------------------------------------
(metadata
(info
{
(aliases {"Super Tic-Tac-Toe" "Strategic Tic-Tac-Toe" "Meta Tic-Tac-Toe" "Tic-Tac-Tic-Tac-Toe-Toe" "(Tic-Tac-Toe)^2"})
(rules "Each small 3x3 Tic-Tac-Toe board is referred to as a local board, and the larger 3x3 board is referred to as the global board. The game starts with X playing wherever they want in any of the 81 empty spots. This move 'sends' their opponent to its relative location. For example, if X played in the top right square of their local board, then O needs to play next in the local board at the top right of the global board. O can then play in any one of the nine available spots in that local board, each move sending X to a different local board. If a move is played so that it is to win a local board by the rules of normal Tic-Tac-Toe, then the entire local board is marked as a victory for the player in the global board. Once a local board is won by a player or it is filled completely, no more moves may be played in that board. If a player is sent to such a board, then that player may play in any other board. Game play ends when either a player wins the global board or there are no legal moves remaining, in which case the game is a draw.")
(source "https://en.wikipedia.org/wiki/Ultimate_tic-tac-toe")
(version "1.0.0")
(classification "board/space/line")
(credit "Cameron Browne 16/5/2020")
(origin "Observed by Ben Orlin in 2013: https://mathwithbaddrawings.com/2013/06/...c-tac-toe/")
}
)
(graphics
{
(pieceScale "DiscB" 2.5)
(pieceScale "CrossB" 2.7)
}
)
)
I got inspired and implemented Ultimate Tic-Tac-Toe this morning. Nice game!
It will appear in our next interim release, or you can put the appended text into a .lud file and run it directly.
Regards,
Cameron
//=========================================================
(game "Ultimate Tic-Tac-Toe"
(players 2)
(equipment
{
(customBoard
(graph
vertices:{
{0 0} {1 0} {2 0} {3 0} {4 0} {5 0} {6 0} {7 0} {8 0}
{0 1} {1 1} {2 1} {3 1} {4 1} {5 1} {6 1} {7 1} {8 1}
{0 2} {1 2} {2 2} {3 2} {4 2} {5 2} {6 2} {7 2} {8 2}
{0 3} {1 3} {2 3} {3 3} {4 3} {5 3} {6 3} {7 3} {8 3}
{0 4} {1 4} {2 4} {3 4} {4 4} {5 4} {6 4} {7 4} {8 4}
{0 5} {1 5} {2 5} {3 5} {4 5} {5 5} {6 5} {7 5} {8 5}
{0 6} {1 6} {2 6} {3 6} {4 6} {5 6} {6 6} {7 6} {8 6}
{0 7} {1 7} {2 7} {3 7} {4 7} {5 7} {6 7} {7 7} {8 7}
{0 8} {1 8} {2 8} {3 8} {4 8} {5 8} {6 8} {7 8} {8 8}
{1 1} {4 1} {7 1} {1 4} {4 4} {7 4} {1 7} {4 7} {7 7}
}
edges:{
{ 0 1} { 1 2} { 9 10} {10 11} {18 19} {19 20}
{ 0 9} { 1 10} { 2 11} { 9 18} {10 19} {11 20}
{ 0 10} {10 20} { 2 10} {10 18}
{ 3 4} { 4 5} {12 13} {13 14} {21 22} {22 23}
{ 3 12} { 4 13} { 5 14} {12 21} {13 22} {14 23}
{ 3 13} {13 23} { 5 13} {13 21}
{ 6 7} { 7 8} {15 16} {16 17} {24 25} {25 26}
{ 6 15} { 7 16} { 8 17} {15 24} {16 25} {17 26}
{ 6 16} {16 26} { 8 16} {16 24}
{27 28} {28 29} {36 37} {37 38} {45 46} {46 47}
{27 36} {28 37} {29 38} {36 45} {37 46} {38 47}
{27 37} {37 47} {29 37} {37 45}
{30 31} {31 32} {39 40} {40 41} {48 49} {49 50}
{30 39} {31 40} {32 41} {39 48} {40 49} {41 50}
{30 40} {40 50} {32 40} {40 48}
{33 34} {34 35} {42 43} {43 44} {51 52} {52 53}
{33 42} {34 43} {35 44} {42 51} {43 52} {44 53}
{33 43} {43 53} {35 43} {43 51}
{54 55} {55 56} {63 64} {64 65} {72 73} {73 74}
{54 63} {55 64} {56 65} {63 72} {64 73} {65 74}
{54 64} {64 74} {56 64} {64 72}
{57 58} {58 59} {66 67} {67 68} {75 76} {76 77}
{57 66} {58 67} {59 68} {66 75} {67 76} {68 77}
{57 67} {67 77} {59 67} {67 75}
{60 61} {61 62} {69 70} {70 71} {78 79} {79 80}
{60 69} {61 70} {62 71} {69 78} {70 79} {71 80}
{60 70} {70 80} {62 70} {70 78}
// Super board: sites overlap centre of each sub-game
{81 82} {82 83} {84 85} {85 86} {87 88} {88 89}
{81 84} {82 85} {83 86} {84 87} {85 88} {86 89}
{81 85} {85 89} {83 85} {85 87}
}
)
)
(piece "Disc" P1)
(piece "DiscB" P1)
(piece "Cross" P2)
(piece "CrossB" P2)
(regions "SubGames" (sites { 0..80}))
(regions "SubGame0" (sites { 0..2 9..11 18..20}))
(regions "SubGame1" (sites { 3..5 12..14 21..23}))
(regions "SubGame2" (sites { 6..8 15..17 24..26}))
(regions "SubGame3" (sites {27..29 36..38 45..47}))
(regions "SubGame4" (sites {30..32 39..41 48..50}))
(regions "SubGame5" (sites {33..35 42..44 51..53}))
(regions "SubGame6" (sites {54..56 63..65 72..74}))
(regions "SubGame7" (sites {57..59 66..68 75..77}))
(regions "SubGame8" (sites {60..62 69..71 78..80}))
(regions "SuperGame" (sites {81..89}))
(map
"SubToSuper"
{0..80}
{
81 81 81 82 82 82 83 83 83
81 81 81 82 82 82 83 83 83
81 81 81 82 82 82 83 83 83
84 84 84 85 85 85 86 86 86
84 84 84 85 85 85 86 86 86
84 84 84 85 85 85 86 86 86
87 87 87 88 88 88 89 89 89
87 87 87 88 88 88 89 89 89
87 87 87 88 88 88 89 89 89
}
)
(map
"SubToSub"
{0..80}
{
0 1 2 0 1 2 0 1 2
3 4 5 3 4 5 3 4 5
6 7 8 6 7 8 6 7 8
0 1 2 0 1 2 0 1 2
3 4 5 3 4 5 3 4 5
6 7 8 6 7 8 6 7 8
0 1 2 0 1 2 0 1 2
3 4 5 3 4 5 3 4 5
6 7 8 6 7 8 6 7 8
}
)
}
)
(rules
(play
(priority
{
// Move at any empty cell in the designated subgame
// whose supergame is undecided
(add
(if (= (mover) P1) (id "Disc" P1) (id "Cross" P2))
to

(sites "SubGame0")
(if (= 1 (mapEntry "SubToSub" (lastTo)))
(sites "SubGame1")
(if (= 2 (mapEntry "SubToSub" (lastTo)))
(sites "SubGame2")
(if (= 3 (mapEntry "SubToSub" (lastTo)))
(sites "SubGame3")
(if (= 4 (mapEntry "SubToSub" (lastTo)))
(sites "SubGame4")
(if (= 5 (mapEntry "SubToSub" (lastTo)))
(sites "SubGame5")
(if (= 6 (mapEntry "SubToSub" (lastTo)))
(sites "SubGame6")
(if (= 7 (mapEntry "SubToSub" (lastTo)))
(sites "SubGame7")
(if (= 8 (mapEntry "SubToSub" (lastTo)))
(sites "SubGame8")
)
)
)
)
)
)
)
)
)
if



)
// Move at any empty cell whose supergame is undecided
(add
(if (= (mover) P1) (id "Disc" P1) (id "Cross" P2))
to

if



)
}
(then
(if (is Line 3) // add a piece in the supergame
(add
(if (= (mover) P1) (id "DiscB" P1) (id "CrossB" P2))
at

)
)
)
)
)
(end
(if
(is Line 3 throughAny

(result Mover Win)
)
)
)
)
//------------------------------------------------------------------------------
(metadata
(info
{
(aliases {"Super Tic-Tac-Toe" "Strategic Tic-Tac-Toe" "Meta Tic-Tac-Toe" "Tic-Tac-Tic-Tac-Toe-Toe" "(Tic-Tac-Toe)^2"})
(rules "Each small 3x3 Tic-Tac-Toe board is referred to as a local board, and the larger 3x3 board is referred to as the global board. The game starts with X playing wherever they want in any of the 81 empty spots. This move 'sends' their opponent to its relative location. For example, if X played in the top right square of their local board, then O needs to play next in the local board at the top right of the global board. O can then play in any one of the nine available spots in that local board, each move sending X to a different local board. If a move is played so that it is to win a local board by the rules of normal Tic-Tac-Toe, then the entire local board is marked as a victory for the player in the global board. Once a local board is won by a player or it is filled completely, no more moves may be played in that board. If a player is sent to such a board, then that player may play in any other board. Game play ends when either a player wins the global board or there are no legal moves remaining, in which case the game is a draw.")
(source "https://en.wikipedia.org/wiki/Ultimate_tic-tac-toe")
(version "1.0.0")
(classification "board/space/line")
(credit "Cameron Browne 16/5/2020")
(origin "Observed by Ben Orlin in 2013: https://mathwithbaddrawings.com/2013/06/...c-tac-toe/")
}
)
(graphics
{
(pieceScale "DiscB" 2.5)
(pieceScale "CrossB" 2.7)
}
)
)