Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace nested array of all moves with a move generator in each piece #132

Open
MarkZH opened this issue Nov 6, 2023 · 3 comments
Open

Comments

@MarkZH
Copy link
Owner

MarkZH commented Nov 6, 2023

Experiment

Instead of a large nested array of every possible move, each piece should have a method that generates all moves from a set of steps ((+-1, +-1) for bishops, for example). This will require if(is_pawn()) and if(is_king()) checks for special moves.

@MarkZH
Copy link
Owner Author

MarkZH commented Dec 29, 2023

No need for if(is_pawn()) or other checks. The step moves are just normal moves. Add an is_single_step() method to Move class to tell move creation iterator whether a move can be repeated (for long-range sliding moves like rook and bishop moves) or not (knight, king, pawn).

@MarkZH
Copy link
Owner Author

MarkZH commented Jan 21, 2024

Now that all moves are represented as one Move class [1], this should be easier to implement.

[1] 0e096a5, 3e4e7ff, 5294780, c1425d7, 8cca3f0, 276083c, d53457c

@MarkZH
Copy link
Owner Author

MarkZH commented May 2, 2024

Each piece should have two sets of moves: sliding moves that get repeated until the edge of the board is reached, and other moves (pawn moves, king moves, knight moves, castling, etc). The sliding moves are one-square moves that generate all other by repeating, and other moves are just added to the move list if they are legal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant