1
0
mirror of https://github.com/tiyn/yeschess.git synced 2025-10-20 14:51:21 +02:00

lichess: added lichess integration

Lichess is a free and open source platform to play chess.
Connection is realized via the berserk python plugin that uses the lichess api.
This commit is contained in:
TiynGER
2021-04-29 01:15:54 +02:00
parent 7fb821254c
commit 91281d97a7
4 changed files with 90 additions and 1 deletions

View File

@@ -201,6 +201,19 @@ proc notationToMove*(notation: string, color: Color): Move =
move = getMove(start, dest, prom, color)
return move
proc moveToNotation*(move: Move): string =
## Convert and return a `move` object to simplified algebraic chess notation.
var res = ""
var start = indToField(move.start)
res.add(start)
var dest = indToField(move.dest)
res.add(dest)
var color = move.color
var prom = PieceChar[move.prom]
if (color == Color.White and dest[1] == '8') or (color == Color.Black and dest[1] == '1'):
res.add(prom)
return res
proc initBoard(): Board =
## Create and return a board with pieces in starting position.
let board = [