fog-of-chess

[toy] Chess, but with the fog of war.
Log | Files | Refs

commit 80e5491b793f16415924ed7963d74a36a2e026e8
parent 1943944ac89dddd1b5917412d1fed8f270a7095e
Author: Jack Mordaunt <jackmordaunt@gmail.com>
Date:   Thu, 26 Dec 2019 14:06:19 +1300

Feat: Queen movement.

Diffstat:
Msrc/main.rs | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/main.rs b/src/main.rs @@ -299,6 +299,18 @@ impl Game { .chain((1..8).map(|ii| (x - ii, y + ii))) .chain((1..8).map(|ii| (x + ii, y - ii))) .collect(), + // Queen moves in all eight directions. + Queen => vec![] + .into_iter() + .chain((1..8).map(|ii| (x + ii, y))) + .chain((1..8).map(|ii| (x - ii, y))) + .chain((1..8).map(|ii| (x, y + ii))) + .chain((1..8).map(|ii| (x, 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))) + .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![