commit ad469cc117d3bb6a75bbad2a4eee20c07b2a9a56
parent 0bbac55463aba8affbffa2a418d92eebe634f3b9
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Sat, 17 Jun 2023 18:47:12 -0700
useless
Diffstat:
1 file changed, 0 insertions(+), 22 deletions(-)
diff --git a/pkg/web/handlers/interceptors/chess.go b/pkg/web/handlers/interceptors/chess.go
@@ -964,19 +964,6 @@ type AnalyzeResult struct {
}
func AnalyzeGame(pgn string, t int64) (out AnalyzeResult, err error) {
- // https://github.com/lichess-org/lila/blob/9204a337492c1be4b7b8dabd68941d8934439cbc/modules/analyse/src/main/AccuracyPercent.scala#L71
- // sbt 'testOnly lila.analyse.AccuracyPercentTest'
- // lichess: 86% 97% (game against stockfish)
- // Lila: 26.036024039104852 25.007112871751964
- // Ours: 28.07242196565701 25.629909658576725
- // 35, -29, 37, -42, 31, -15, 28, -16, 16, -4, 30, -24, 13, -14, 0, -17, 9, 6, -17, 8, -3, -5, -1, 5, -13, 20, -21, 90, -59, 77, -55, 70, -84, 116, -97, 68, -50, 46, -54, 93, -53, 57, -62, 61, -18, 11, -17, 41, -15, 13, -19, 8, 0, 22, -76, 44, -46, 87, -62, 62, -56, 59, -28, 69, -50, 70, -63, 63, -27, 30, -53, 14, -65, 43, -17, 398, -430, 565, -597, 793, -802, 837, -821, 908, -915, 957, -984, 1073, -981, 1285
- //pgn := "1. d4 Nf6 2. Nf3 e6 3. Bf4 { A46 Indian Defense: London System } c5 4. e3 d5 5. c3 Bd6 6. Bg3 O-O " +
- // "7. Bd3 Qc7 8. Bxd6 Qxd6 9. O-O Nbd7 10. Nbd2 e5 11. dxe5 Nxe5 12. Nxe5 Qxe5 13. Nf3 Qe7 14. b3 Rd8 " +
- // "15. Rc1 Bg4 16. Be2 Bf5 17. Bd3 Ne4 18. Qc2 Rd6 19. Rfd1 Re8 20. Bb5 Rc8 21. Bd3 Rcd8 22. Nd2 h6 " +
- // "23. Nxe4 dxe4 24. Bc4 b6 25. Rxd6 Qxd6 26. h3 a5 27. Qe2 Qd2 28. Qxd2 Rxd2 29. a4 Be6 30. Bxe6 fxe6 " +
- // "31. Rb1 Kf7 32. Kf1 Rc2 33. c4 h5 34. g4 hxg4 35. hxg4 Kf6 36. Kg2 Ke5 37. Kg3 Rd2 38. f3 Re2 39. f4+ Kf6 " +
- // "40. g5+ Kf5 41. Rh1 Rxe3+ 42. Kh4 Rxb3 43. g6 Kxf4 44. Kh5 Ra3 45. Rf1+ Rf3 46. Rxf3+ exf3 47. Kh4 f2 " +
- // "48. Kh3 Kf3 49. Kh2 f1=R 50. Kh3" // Rh1# { Black wins by checkmate. } 0-1"
pgnOpt, _ := chess.PGN(strings.NewReader(pgn))
g := chess.NewGame(pgnOpt)
positions := g.Positions()
@@ -1003,14 +990,6 @@ func AnalyzeGame(pgn string, t int64) (out AnalyzeResult, err error) {
cmdPos := uci.CmdPosition{Position: position}
cmdGo := uci.CmdGo{Depth: 24}
if err := eng.Run(cmdPos, cmdGo); err != nil {
- //if err.Error() == `chess: failed to decode long algebraic notation text "(none)" for position <nil>` {
- // cp := 0
- // mate := 1
- // mov := g.MoveHistory()[idx-1].Move
- // moveStr := chess.AlgebraicNotation{}.Encode(positions[idx-1], mov)
- // cps = append(cps, cp)
- // scores = append(scores, Score{Move: moveStr, BestMove: "", CP: cp, Mate: mate})
- //}
logrus.Error(err)
mov := g.MoveHistory()[idx-1].Move
moveStr := chess.AlgebraicNotation{}.Encode(positions[idx-1], mov)
@@ -1030,7 +1009,6 @@ func AnalyzeGame(pgn string, t int64) (out AnalyzeResult, err error) {
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)
}
//fmt.Println(strings.Join(s, ", "))