-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathissues
42 lines (39 loc) · 2 KB
/
issues
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
originally the set_player_to_go_first method was public and
tested but now it's private so really shouldn't be tested. Might
be better to just test that current player is set to the player
that is white before any moves have been made.
Given that the move does not leave the players own king in check
and given that the destination is a valid square on the board
and given that the destination does not have a piece of the same colour
and given that there is no blocking piece on the path
Then move the piece to the destination square
Moving a piece:
- Game asks for player input
- Game validates, parses, and splits input in a set of Coordinates.
- Game ensures the Coordinates are legal:
* Game ensures the start coordinate contains one of player's pieces
* Game ensures the end coordinate DOES NOT contain player's pieces
* Game ensures the end coordinate is within player's piece's moveset
* Game ensures the path is not blocked
* Game ensures that player is not left in check
- Game updates board with player's move
- Game checks if opponent is checked
- Game displays the board
- Game repeats
- Game profits
Checking opponent AFTER a valid move, including a capture:
- MoveValidator checks for presence of King in MoveValidator.moves
* If King is present
* A @checked variable returns true
* If not, MoveValidtor checks for the presence of King beyond any blocking pieces
* If King is within player's piece's sights
* @checking << player's piece
* If there is > 1 piece between player's piece and opponent's King:
* End turn
* If there is only 1 piece blocking (e.g., B. Bishop)
* Opponent's king is marked at "imminent danger"
* Piece is prevented from moving on next turn, unless it removes check
- MoveValidator iterates through @checking at end of every turn to see if:
* Opponent's King is still within sights of player's pieces
* If not, remove that piece from @checking
* Opponent has moved blocking pieces.