SebLague / Chess-Challenge

Create your own tiny chess bot!
https://www.youtube.com/watch?v=Ne40a5LkK6A
MIT License
1.78k stars 1.07k forks source link

why isn't Move.NullMove a constant #467

Open deadpdf opened 10 months ago

deadpdf commented 10 months ago

public string GetBestMove(Board board, int depth = 3, Move prvmove = Move.NullMove) I want the previous move made for each depth , but its giving the following error Default parameter value for prvmove must be a compile time constant?

ryanheath commented 10 months ago

You could try pass default instead public string GetBestMove(Board board, int depth = 3, Move prvmove = default) if you are lucky default could translate into the same state as Move.NullMove (it is not strictly the same!)

If that doesn't work, then save yourself the headache, remove the default value and pass Move.NullMove where appropiate.