aboutsummaryrefslogtreecommitdiff
path: root/src/parser.rs
diff options
context:
space:
mode:
authortslil clingman <>2020-01-20 23:09:52 -0800
committertslil clingman <>2020-01-20 23:09:52 -0800
commitec4ae2a749315720cc12f3d71f0860e2a32f96d2 (patch)
tree36c884dbfc6f1e04e0a02d6a7be78a98d2930fd6 /src/parser.rs
parent42e504281ba8c36c0bf5c679dd767f04310655f3 (diff)
Move rules were incorrectly/incompletely implemented
Diffstat (limited to 'src/parser.rs')
-rw-r--r--src/parser.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/parser.rs b/src/parser.rs
index 346ecb2..a1d9a32 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -116,9 +116,11 @@ fn parse_place(player: Player, pl: &str) -> Result<Action, String> {
}
if (x < 'a') || (x > 'h') {
- return Err(String::from(
- "Placements must specify a valid position on the game board.",
- ));
+ return Err(if (x >= 'A') && (x <= 'Z') {
+ format!("Unrecognised stone type '{}' in placement.", x)
+ } else {
+ String::from("Placements must specify a valid position on the game board.")
+ });
}
let x: u8 = x as u8 - 'a' as u8;