rudzen / ChessLib

C# chess library containing a complete data structure and move generation.
MIT License
81 stars 22 forks source link

State(State other) constructor doesn't work on a default State object #40

Closed apc518 closed 3 years ago

apc518 commented 3 years ago

The following produces a System.ArgumentNullException on the Array.Copy() line (currently line 81 in Chess/State.cs) in State's one-argument constructor.

State s = new State();
State s_cpy = new State(s);

I'm trying to code a rudimentary minimax algorithm with this library and in order to simulate moves I am trying to make copies of an inputted position and state so I can feed it into Position.MakeMove(Move m, State newState). Problem is, I can't copy the default state that gets generated at the start of a game, so I can't simulate the first move. I think I'll just go ahead and use GameFactor.Create() to do this.

Forgive me if this issue is badly written, this is the first github issue I've ever submitted lol Also I don't know if anyone is looking at these anymore...