Module:Chessboard/Makruk Explained

local p =

function p.dims return 8, 8end

function p.letters return end

function p.image_board(size) return string.format('', 8 * size, 8 * size)end

function p.image_square(pc, row, col, size) local colornames = local piecenames = local symnames = local colchar = local color = mw.ustring.gsub(pc, '^.*(%w)(%w).*$', '%2') or local piece = mw.ustring.gsub(pc, '^.*(%w)(%w).*$', '%1') or local alt = colchar[col] .. row .. ' '

if colornames[color] and piecenames[piece] then alt = alt .. colornames[color][piecenames[piece]['gender']] .. ' ' .. piecenames[piece]['name'] else alt = alt .. (symnames[piece .. color] or piece .. ' ' .. color) end

fn =

if pc

'll' then fn = 'Khun_white' elseif pc

'ld' then fn = 'Khun_black' elseif pc

'sl' then fn = 'Met_white' elseif pc

'sd' then fn = 'Met_black' elseif pc

'nl' then fn = 'Khon_white' elseif pc

'nd' then fn = 'Khon_black' elseif pc

'hl' then fn = 'Ma_white' elseif pc

'hd' then fn = 'Ma_black' elseif pc

'bl' then fn = 'Ruea_white' elseif pc

'bd' then fn = 'Ruea_black' elseif pc

'cl' then fn = 'Bia_white' elseif pc

'cd' then fn = 'Bia_black' elseif pc

'ol' then fn = 'Biangai_white' elseif pc

'od' then fn = 'Biangai_black' end

return string.format('', fn, size, size, alt, alt)

end

return p