Ludii是一個弈棋研發平臺,你只需要把弈棋規則寫成ludeme,就可以直接跑起來,不用再去找甚麼元素和運行平臺,非常方便。
前提是,你願意去學習它的規則語法。
比如,以下是一個遊戲的ludeme:
代码: 全选
(game "Pentomino"
(players <Players:numPlayers>)
(equipment {
(board (rectangle <Rows:num> <Columns:num>))
(tile "Z" Shared {F R F F L F})
(tile "Y" Shared {F R F R R F R F F})
(tile "X" Shared {F L F L L F F L L F R F})
(tile "W" Shared {F L F R F L F})
(tile "V" Shared {F F R F F})
(tile "U" Shared {F L F F L F})
(tile "T" Shared {F F R F R R F F})
(tile "P" Shared {F F R F R F})
(tile "N" Shared {F R F L F F})
(tile "L" Shared {F R F F F})
(tile "I" Shared {F F F F})
(tile "F" Shared {F L F L L F L F R F})
(hand Shared size:12)
})
(rules
(start {
(place "F" (handSite Shared 0))
(place "I" (handSite Shared 1))
(place "L" (handSite Shared 2))
(place "N" (handSite Shared 3))
(place "P" (handSite Shared 4))
(place "T" (handSite Shared 5))
(place "U" (handSite Shared 6))
(place "V" (handSite Shared 7))
(place "W" (handSite Shared 8))
(place "X" (handSite Shared 9))
(place "Y" (handSite Shared 10))
(place "Z" (handSite Shared 11))
})
(play (move (from (sites Hand Shared)) (to (sites Empty))))
(end ("NoMoves" <End:result>))
)
)
//------------------------------------------------------------------------------
(option "Players" <Players> args:{ <numPlayers> }
{
(item "2" <2> "The game is played by 2 players")*
(item "3" <3> "The game is played by 3 players")
}
)
(option "Rows" <Rows> args:{ <num> }
{
(item "1" <1> "The board has 1 row.")
(item "2" <2> "The board has 2 rows.")
(item "3" <3> "The board has 3 rows.")
(item "4" <4> "The board has 4 rows.")
(item "5" <5> "The board has 5 rows.")
(item "6" <6> "The board has 6 rows.")*
(item "7" <7> "The board has 7 rows.")
(item "8" <8> "The board has 8 rows.")
(item "9" <9> "The board has 9 rows.")
(item "10" <10> "The board has 10 rows.")
(item "11" <11> "The board has 11 rows.")
(item "12" <12> "The board has 12 rows.")
(item "13" <13> "The board has 13 rows.")
(item "14" <14> "The board has 14 rows.")
(item "15" <15> "The board has 15 rows.")
(item "16" <16> "The board has 16 rows.")
(item "17" <17> "The board has 17 rows.")
(item "18" <18> "The board has 18 rows.")
(item "19" <19> "The board has 19 rows.")
}
)
(option "Columns" <Columns> args:{ <num> }
{
(item "2" <2> "The board has 2 columns.")
(item "3" <3> "The board has 3 columns.")
(item "4" <4> "The board has 4 columns.")
(item "5" <5> "The board has 5 columns.")
(item "6" <6> "The board has 6 columns.")
(item "7" <7> "The board has 7 columns.")
(item "8" <8> "The board has 8 columns.")
(item "9" <9> "The board has 9 columns.")
(item "10" <10> "The board has 10 columns.")*
(item "11" <11> "The board has 11 columns.")
(item "12" <11> "The board has 12 columns.")
(item "13" <11> "The board has 13 columns.")
(item "14" <14> "The board has 14 columns.")
(item "15" <14> "The board has 15 columns.")
(item "16" <14> "The board has 16 columns.")
(item "17" <14> "The board has 17 columns.")
(item "18" <14> "The board has 18 columns.")
(item "19" <19> "The board has 19 columns.")
}
)
(option "End" <End> args:{ <result> }
{
(item "Normal" <Loss> "The Last player to play wins.")*
(item "Misere" <Win> "The Last player to play loses.")
}
)
//------------------------------------------------------------------------------
(metadata
(info
{
(description "Pentomino tiling puzzles and games are popular in recreational mathematics.")
(aliases {"Golomb's Game"})
(rules "Two players have a collection of dominoes which they place on the grid in turn, covering up squares. One player places tiles vertically, while the other places them horizontally. The first player who cannot move loses.")
(id "1664")
(source "<a href=\"https://en.wikipedia.org/wiki/Pentomino\" target=\"_blank\" class=\"style1\" style=\"color: #0000EE\" />Wikipedia</a>")
(version "1.3.10")
(classification "board/space/blocking")
(credit "Fabio Barbero")
}
)
(graphics {
(piece Colour "F" fillColour:(colour 221 187 153))
(piece Colour "I" fillColour:(colour 238 170 170))
(piece Colour "L" fillColour:(colour 204 204 136))
(piece Colour "N" fillColour:(colour 170 238 170))
(piece Colour "P" fillColour:(colour 187 221 153))
(piece Colour "T" fillColour:(colour 153 221 187))
(piece Colour "U" fillColour:(colour 136 204 204))
(piece Colour "V" fillColour:(colour 153 187 221))
(piece Colour "W" fillColour:(colour 170 170 238))
(piece Colour "X" fillColour:(colour 187 153 221))
(piece Colour "Y" fillColour:(colour 204 136 204))
(piece Colour "Z" fillColour:(colour 221 153 187))
})
(ai
"Pentomino_ai"
)
)