jordanbray / chess

A rust library to manage chess move generation
https://jordanbray.github.io/chess/
MIT License
243 stars 55 forks source link

Two ways to generate moves #3

Closed jordanbray closed 5 years ago

jordanbray commented 7 years ago

At present, there are two ways to generate legal moves. The first is to use board.enumerate_moves(...), which is the fastest, but requires you to pass in an empty array of 256 ChessMove's to mutate, and also does not give you an iterator or anything nice to work with. The second way is to use the MoveGen object, which has a lot of nice features, but is slightly slower for raw perft tests (it's actually probably faster in a chess engine, though, which is the only time performance will really matter). So, the question is, do I delete enumerate_moves(...) and just let other people be faster, or do I leave in the code duplication for the sake of speed? It's an open question for now.

jordanbray commented 7 years ago

Current results of cargo bench, which compares the performance of movegen and board methods of enumerate moves.

https://github.com/jordanbray/chess/wiki

jordanbray commented 5 years ago

MoveGen is now replacing enumerate_moves. enumerate_moves still exists, but has been marked as deprecated, and simply uses the MoveGen structure internally.

MoveGen is now faster in almost all test cases.