commit f4938cd3425c6a7856dceb84e86a6793502928f2
parent 52b785c031dff5223b648fff6ccfb424a82577aa
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Sat, 4 Jan 2025 17:26:22 -0800
remove unused code
Diffstat:
1 file changed, 2 insertions(+), 25 deletions(-)
diff --git a/pkg/web/handlers/interceptors/chess.go b/pkg/web/handlers/interceptors/chess.go
@@ -229,7 +229,6 @@ func (g *ChessGame) renderBoardHTML1(moveIdx int, position *chess.Position, isFl
last = moves[moveIdx-1]
}
}
- deadBoardMap := chess.NewGame().Position().Board().SquareMap()
pieceInCheck := func(p chess.Piece) bool {
return last != nil && p.Color() == position.Turn() && p.Type() == chess.King && last.HasTag(chess.Check)
@@ -307,26 +306,6 @@ func (g *ChessGame) renderBoardHTML1(moveIdx int, position *chess.Position, isFl
</style>
`
- allPieces := []chess.Square{
- chess.A8, chess.B8, chess.C8, chess.D8, chess.E8, chess.F8, chess.G8, chess.H8,
- chess.A7, chess.B7, chess.C7, chess.D7, chess.E7, chess.F7, chess.G7, chess.H7,
- chess.A2, chess.B2, chess.C2, chess.D2, chess.E2, chess.F2, chess.G2, chess.H2,
- chess.A1, chess.B1, chess.C1, chess.D1, chess.E1, chess.F1, chess.G1, chess.H1,
- }
- dead := make([]chess.Square, 0)
- for _, p := range allPieces {
- found := false
- for _, v := range g.piecesCache {
- if v == "piece_"+p.String() {
- found = true
- break
- }
- }
- if !found {
- dead = append(dead, p)
- }
- }
-
data := map[string]any{
"ImgB64": imgB64,
"Rows": []int{0, 1, 2, 3, 4, 5, 6, 7},
@@ -336,7 +315,6 @@ func (g *ChessGame) renderBoardHTML1(moveIdx int, position *chess.Position, isFl
"WhiteWon": game.Outcome() == chess.WhiteWon,
"BlackWon": game.Outcome() == chess.BlackWon,
"Draw": game.Outcome() == chess.Draw,
- "Dead": dead,
}
fns := template.FuncMap{
@@ -363,9 +341,8 @@ func (g *ChessGame) renderBoardHTML1(moveIdx int, position *chess.Position, isFl
boardMap := game.Position().Board().SquareMap()
return boardMap[sq]
},
- "DeadPieceFromSq": func(sq chess.Square) chess.Piece { return deadBoardMap[sq] },
- "css": func(s string) template.CSS { return template.CSS(s) },
- "cssUrl": func(s string) template.URL { return template.URL(s) },
+ "css": func(s string) template.CSS { return template.CSS(s) },
+ "cssUrl": func(s string) template.URL { return template.URL(s) },
}
var buf bytes.Buffer