commit 1943944ac89dddd1b5917412d1fed8f270a7095e
parent 3117ddd23cab1a363df99ab1b678ccb61a177615
Author: Jack Mordaunt <jackmordaunt@gmail.com>
Date: Thu, 26 Dec 2019 14:01:38 +1300
Feat: Bishop movement.
Diffstat:
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/main.rs b/src/main.rs
@@ -291,7 +291,14 @@ impl Game {
.chain((1..8).map(|ii| (x, y + ii)))
.chain((1..8).map(|ii| (x, y - ii)))
.collect(),
- Bishop => vec![],
+ // Bishop moves all diagonal directions.
+ Bishop => vec![]
+ .into_iter()
+ .chain((1..8).map(|ii| (x + ii, y + ii)))
+ .chain((1..8).map(|ii| (x - ii, y - ii)))
+ .chain((1..8).map(|ii| (x - ii, y + ii)))
+ .chain((1..8).map(|ii| (x + ii, y - ii)))
+ .collect(),
// King can move to any adjacent cell that isn't occupied by
// a piece of the same player.
King => vec![