2021-09-03 05:20:21 +02:00
|
|
|
require "spec"
|
2021-09-17 06:08:53 +02:00
|
|
|
|
|
|
|
require "../src/lx_chess/game"
|
|
|
|
require "../src/lx_chess/board"
|
|
|
|
require "../src/lx_chess/term_board"
|
|
|
|
|
2021-10-03 01:12:06 +02:00
|
|
|
def debug_board(board : LxChess::Board, moves : Array(String))
|
|
|
|
moves = moves.map { |m| board.index_of(m) }
|
|
|
|
debug_board(board, moves)
|
2021-09-17 06:08:53 +02:00
|
|
|
end
|
|
|
|
|
2021-10-03 01:12:06 +02:00
|
|
|
def debug_board(board : LxChess::Board, moves : Array(Int16) = [] of Int16)
|
2021-09-17 06:08:53 +02:00
|
|
|
puts
|
2021-10-03 01:12:06 +02:00
|
|
|
gb = LxChess::TermBoard.new(board)
|
2021-09-17 06:08:53 +02:00
|
|
|
gb.highlight(moves)
|
|
|
|
gb.draw
|
|
|
|
puts
|
|
|
|
end
|
|
|
|
|
|
|
|
def place(board : LxChess::Board, squares : Hash(String, Char))
|
|
|
|
squares.each do |cord, sym|
|
2021-09-18 18:54:04 +02:00
|
|
|
board[cord] = LxChess::Piece.from_fen(sym)
|
2021-09-17 06:08:53 +02:00
|
|
|
end
|
|
|
|
end
|