notnil / chess

chess package for go
MIT License
508 stars 126 forks source link

MoveHistory() panics regarding Comments when built programatically #106

Open barakmich opened 2 years ago

barakmich commented 2 years ago

To reproduce:

  func TestMoveHistory(t *testing.T) {
    game := chess.NewGame()
    game.MoveStr("e4")
    game.MoveStr("e5")
    game.Resign(chess.Black)
    history := game.MoveHistory() // Panics here
    if len(history) != 2 {
      t.Fatal("Didn't retrieve full history")
    }
  }

That there's also no way to make a move with comments.... well, I guess that's #89

mono424 commented 1 year ago

quick fixed here: https://github.com/mono424/chess