commit cfca86991dba9be77d592d798095eac8cb4642fb parent f43e6714799264ff420e71333a1e6e808c23f6fc Author: n0tr1v <n0tr1v@protonmail.com> Date: Wed, 31 May 2023 02:58:00 -0700 simplify code Diffstat:
| M | pkg/web/handlers/api/v1/chess.go | | | 5 | +++-- |
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/pkg/web/handlers/api/v1/chess.go b/pkg/web/handlers/api/v1/chess.go @@ -254,9 +254,10 @@ input[type=checkbox]:checked + label { func (g *ChessGame) renderBoardB64(isFlipped bool) string { position := g.Game.Position() + moves := g.Game.Moves() var last *chess.Move - if len(g.Game.Moves()) > 0 { - last = g.Game.Moves()[len(g.Game.Moves())-1] + if len(moves) > 0 { + last = moves[len(moves)-1] } var buf bytes.Buffer img := renderBoardPng(last, position, isFlipped)