![]() Generating pseudo-legal moves is a lot faster than just generating legal moves because calculating checks and pins is hard. When using a psuedo-legal move generator you have to check that the board is still valid after making a move, and then void the move if it was invalid - like moving the king into check in the move above. It simply looks at the board and sees what squares are empty (pushes) or have enemy pieces on (captures).įor example, in the following position, a pseudo-legal move generator would generate the move for black king to f8, even though it puts the king in check from white’s rook. A pseudo-legal move generator does not consider checks or pins when generating moves. This is the simplest way of generating moves. There are two approaches to generating moves in a chess engine, dubbed “legal” and “psuedo-legal” Pseudo-legal move generation In this article I’ll talk about how to generate moves for a chess position efficiently, as well as some common ‘gotchas’ that can lead to bugs. This is a method that takes a chess position, and returns a list of all the moves that can be made from that position for a given side.įor example: At the starting position there are 20 moves for white: each of the pawns can move forward one or two spaces (16 moves total), and the knights have two moves each (4 moves total). One of the foundations for a decent chess engine is a reasonably fast move generation function. ![]() If there is one thing to say about building chess engine it’s don’t do it - it becomes an addiction, and it’s never finished. My go-to project for learning systems-y languages has always been chess engines. Recently I’ve been spending some time in the evening playing around with Rust.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |