{# Copyright 2020-2021 Ian Jackson and contributors to Otter SPDX-License-Identifier: AGPL-3.0-or-later There is NO WARRANTY. #} format=2 {% macro vanilla_officers() -%} ["R","N","B","Q","K","B","N","R"] {% endmacro vanilla_officers %} {% macro fairy_pieces() -%} ["commoner","elephant","knight-king","mann","zebra", "ship","giraffe","cannon"] {% endmacro fairy_pieces -%} {% macro one_colour(x, y, colour) %} {% set colour_items = "K,1 Q,1 R,2 B,2 N,2 P,4" |split(pat=" ") %} {% for itemspec in colour_items %} {% set it = itemspec | split(pat=",") %} [[pieces]] pos = [{{ x + 10 * loop.index0 }}, {{ y }}] type = "Lib" lib = "wikimedia" item = "chess-{{colour}}-{{ it[0] }}" posd = [1,1] count = {{ it[1] }} {% endfor %} {% endmacro one_colour %} # -------------------- actual game spec -------------------- # board table_size = [300, 200] table_colour = "#bbd" # board and standard pieces, in starting places [[pieces]] pos = [150,100] type = "Lib" lib = "edited" item = "chess-board" pinned = true [[pieces]] pos = [115, 135] type = "LibList" lib = "wikimedia" prefix = "chess-w-" items = {{ m::vanilla_officers() }} posd = [10, 0] [[pieces]] pos = [115, 65] type = "LibList" lib = "wikimedia" prefix = "chess-b-" items = {{ m::vanilla_officers() }} posd = [10, 0] [[pieces]] pos = [115, 125] type = "Lib" lib = "wikimedia" item = "chess-w-P" posd = [10, 0] count = 8 [[pieces]] pos = [115, 75] type = "Lib" lib = "wikimedia" item = "chess-b-P" posd = [10, 0] count = 8 # geometric shapes [[pieces]] pos = [20, 75] type = "Disc" faces = ["#f88","#88f"] posd = [10, 0] diam = 7 count = 8 [[pieces]] pos = [20, 85] type = "Rect" faces = ["yellow","#f4f"] posd = [10, 0] size = [7,7] count = 8 [[pieces]] pos = [20, 95] type = "Rect" faces = ["#333"] posd = [10, 0] size = [9,1] count = 8 [[pieces]] pos = [20, 100] type = "Rect" faces = ["#333"] posd = [10, 0] size = [9,1] count = 8 [[pieces]] pos = [17, 110] type = "Rect" faces = ["#333"] posd = [5, 0] size = [1,9] count = 16 # spare vanilla pieces [[pieces]] pos = [20, 125] type = "LibList" lib = "wikimedia" prefix = "chess-w-" items = {{ m::vanilla_officers() }} posd = [10, 0] [[pieces]] pos = [20, 135] type = "LibList" lib = "wikimedia" prefix = "chess-b-" items = {{ m::vanilla_officers() }} posd = [10, 0] [[pieces]] pos = [20, 145] type = "Lib" lib = "wikimedia" item = "chess-w-P" posd = [5, 0] count = 8 [[pieces]] pos = [60, 145] type = "Lib" lib = "wikimedia" item = "chess-b-P" posd = [5, 0] count = 8 # exciting colours {{ m::one_colour(x=210, y=55, colour="blue" )}} {{ m::one_colour(x=210, y=65, colour="yellow" )}} {{ m::one_colour(x=210, y=75, colour="red" )}} {{ m::one_colour(x=210, y=45, colour="purple" )}} # fairy pieces [[pieces]] pos = [205, 125] type = "LibList" lib = "wikimedia" prefix = "chess-w-" items = {{ m::fairy_pieces() }} posd = [10, 0] [[pieces]] pos = [205, 135] type = "LibList" lib = "wikimedia" prefix = "chess-w-" items = {{ m::fairy_pieces() }} posd = [10, 0] [[pieces]] pos = [205, 145] type = "LibList" lib = "wikimedia" prefix = "chess-b-" items = {{ m::fairy_pieces() }} posd = [10, 0] [[pieces]] pos = [205, 155] type = "LibList" lib = "wikimedia" prefix = "chess-b-" items = {{ m::fairy_pieces() }} posd = [10, 0] [[pieces]] pos = [20, 60] type = "Hand" edge = "white" colour = "grey" shape.type = "Rect" shape.xy = [20,10] {% for pos in ["[50, 58]", "[60, 57]"] %} [[pieces]] pos = {{ pos }} shape.xy = [20,6] posd = [1,1] count = 5 type = "PlayerLabel" colour = "lightgrey" edge = "white" shape.type = "Rect" label.place = "BottomLeft" label.colour = "black" {% endfor %} [[pieces]] pos = [240, 100] type = "ChessClock" time = 900 per_move = 30