diff options
Diffstat (limited to 'src/game.rs')
| -rw-r--r-- | src/game.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/game.rs b/src/game.rs index 4a91755..6bc43dc 100644 --- a/src/game.rs +++ b/src/game.rs @@ -424,7 +424,7 @@ impl GameState { } let mut steps: usize = drops.len(); - let cap: bool = stack[0].stone == Stone::Capstone; + let cap: bool = stack[stack.len() - 1].stone == Stone::Capstone; let mut pos_new = Position { x: pos.x, y: pos.y }; while steps > 0 { @@ -453,7 +453,13 @@ impl GameState { )); } Stone::Standing => { - if (steps > 1) || (!cap) { + if cap { + if (steps > 1) || (drops[drops.len() - 1] > 1) { + return Err(String::from( + "A capstone move may not flatten a standing stone unless dropped on its own.", + )); + } + } else { return Err(String::from( "A move may not cover a standing stone.", )); |
