-
Notifications
You must be signed in to change notification settings - Fork 2
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
Create logic that will allow "en passant" captures #26
Comments
I THINK like to make the state of the type Piece
= King KingState
| Queen PieceState
| Rook PieceState
| Knight PieceState
| Bishop PieceState
| Pawn PawnState
type alias KingState =
{ team : Team
, check : Bool
, doubleCheck : Bool
}
type alias PieceState =
{ team : Team }
type alias PawnState =
{ team : Team
, onHomeTile : Bool
, movedTwoTiles : Bool
, capableOfEnPassentCap : Bool
} I don't know exactly why but this feels like the right approach (or at least a better approach than what I have currently). At the moment I have a I have realised that I think it is easier to reason about each The problem I am having with this idea is that at the moment I am not sure how to pass At the moment I am making type alias Tile =
{ status : TileStatus, piece : Maybe Piece } Before I could easily pass a I know that is can be done of course but for some reason it is tripping me up at the moment. |
After thinking about this a little more I think that it is better to just update the overall game state. One of the things that made me decide to leave this approach was the fact that For example if a Pawn can be captured It's also similar for the King. If a king is in check, then something needs to happen to take it out of check. That check isn't going to follow it around from turn to turn. Another reason is that having all those 'separate' states increases the chances of error. It could lead to multiple pawns having a state saying that they can be captured en passant for example. Of course I would have tried to minimise errors and could avoid this by 'being thorough' but if there is only the possibility for one pawn to ever have this option then it just completely removes that possibility for error. |
Need to create the logic that will allow "en passant" captures.
For this I will need to have something in the state that stores whether or if a pawns last move was a "two tile move" (I don't think that there is a name for this. If there is please comment with it 👍)
This will probably be best stored in each pawn.
At the moment the a piece is made up of the following...
The
PieceType
type is currently fairly simple. If I am going to store if a pawn is able to be captured "en passant" in each pawn I am likely going to have to update thePieceType
Pawn
.The text was updated successfully, but these errors were encountered: