dkforest

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

commit 024e51a2fe358911a81173e763866a442b2fb123
parent 907d2aabcaceaebf3e8976db1fafdcfdfff79f04
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Sat, 17 Jun 2023 18:09:19 -0700

fix mate

Diffstat:
Mpkg/web/handlers/chess.go | 2+-
Mpkg/web/handlers/interceptors/chess.go | 1-
2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/pkg/web/handlers/chess.go b/pkg/web/handlers/chess.go @@ -257,7 +257,7 @@ func ChessGameStatsHandler(c echo.Context) error { absV = utils.MinInt(absV, maxV) absV = absV * maxH / maxV if v.CP == 0 && v.Mate != 0 { - if (color == "white" && v.Mate < 0) || (color == "black" && v.Mate > 0) { + if (color == "white" && v.Mate > 0) || (color == "black" && v.Mate < 0) { absV = maxH } } diff --git a/pkg/web/handlers/interceptors/chess.go b/pkg/web/handlers/interceptors/chess.go @@ -1026,7 +1026,6 @@ func AnalyzeGame(pgn string, t int64) (out AnalyzeResult, err error) { mate := res.Info.Score.Mate if idx%2 != 0 { cp *= -1 - } else { mate *= -1 } mov := g.MoveHistory()[idx-1].Move