commit 802f81cf89752f81ebabd912fc9728bc7cc59a54
parent aa0be729b7b521ae37d3af83f3007fb6d3a6a99c
Author: = <=>
Date: Mon, 30 Dec 2019 13:18:57 +1300
Fix: Pawn cannot attack move with forward advance.
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/main.rs b/src/main.rs
@@ -283,7 +283,8 @@ impl Game {
}
if self.board.0[y as usize + 1][x as usize].is_none() {
moves.push((x, y + 1));
- if *moved == 0 {
+ if *moved == 0 && self.board.0[y as usize + 2][x as usize].is_none()
+ {
moves.push((x, y + 2));
}
}
@@ -297,7 +298,8 @@ impl Game {
}
if self.board.0[y as usize - 1][x as usize].is_none() {
moves.push((x, y - 1));
- if *moved == 0 {
+ if *moved == 0 && self.board.0[y as usize - 2][x as usize].is_none()
+ {
moves.push((x, y - 2));
}
}