dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 4d96365c845ab01b2400831d6594219f6108ef07
parent 21bb2722f0ab0f2491fabf039d2787bd2b73f82d
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Wed, 14 Jun 2023 16:15:58 -0700

fix bug

Diffstat:
Mpkg/web/handlers/interceptors/chess.go | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/pkg/web/handlers/interceptors/chess.go b/pkg/web/handlers/interceptors/chess.go @@ -489,7 +489,11 @@ func (g *ChessGame) drawPlayerCard(moveIdx int, key string, isBlack, isSpectator if moveIdx > 0 && moveIdx < len(g.Game.Positions()) { position := g.Game.Positions()[moveIdx] bestMoveStr := stats.Scores[moveIdx-1].BestMove - bestMove, _ = chess.AlgebraicNotation{}.Decode(position, bestMoveStr) + var err error + bestMove, err = chess.UCINotation{}.Decode(position, bestMoveStr) + if err != nil { + logrus.Error(err) + } } columnWidth = utils.MaxInt(graphWidth/len(stats.Scores), 1) } @@ -950,7 +954,7 @@ func AnalyseGame(pgn string, t int64) (out AnalyseResult, err error) { } mov := g.MoveHistory()[idx-1].Move moveStr := chess.AlgebraicNotation{}.Encode(positions[idx-1], mov) - bestMoveStr := chess.AlgebraicNotation{}.Encode(position, res.BestMove) + bestMoveStr := chess.UCINotation{}.Encode(position, res.BestMove) cps = append(cps, cp) scores = append(scores, Score{Move: moveStr, BestMove: bestMoveStr, CP: cp, Mate: mate}) //fmt.Printf("%d: %d/%d %d %d\n", idx/2, idx, len(positions), idx%2, cp)