aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortslil clingman <>2020-02-09 13:45:15 -0800
committertslil clingman <>2020-02-09 13:45:15 -0800
commit942c13ee26b180316f46921531c737fa8eb4197e (patch)
tree84f5ee55f7d923f1a213776c6015f69b1fa9c90e
parent84898338d0875c258a4325d517dd7b7f9d0f83e1 (diff)
Silly error in CPS implementation
-rw-r--r--src/game.rs6
-rw-r--r--src/main.rs4
-rw-r--r--src/parser.rs7
3 files changed, 10 insertions, 7 deletions
diff --git a/src/game.rs b/src/game.rs
index c851e3d..b49f626 100644
--- a/src/game.rs
+++ b/src/game.rs
@@ -729,7 +729,7 @@ impl StartType {
fn player_turnorder_at(&self, turn_num: usize) -> (Player, TurnOrder) {
match self {
StartType::CPS(c) => {
- if turn_num + 1 > (*c as usize) {
+ if turn_num * 2 > (*c as usize) {
if turn_num % 2 == 0 {
(Player::White, TurnOrder::Normal)
} else {
@@ -743,8 +743,8 @@ impl StartType {
}
}
}
- StartType::FCS => StartType::CPS(2).player_turnorder_at(turn_num),
- StartType::FES => StartType::CPS(2).player_turnorder_at(turn_num),
+ StartType::FCS => StartType::CPS(1).player_turnorder_at(turn_num),
+ StartType::FES => StartType::CPS(1).player_turnorder_at(turn_num),
StartType::TPS => match turn_num {
0 => (Player::White, TurnOrder::WhitePlacesBlack),
1 => (Player::White, TurnOrder::WhitePlacesBlack),
diff --git a/src/main.rs b/src/main.rs
index f88fee5..50bfcf4 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -48,7 +48,7 @@ fn main() {
&["-v", "--variant-start"],
Store,
"Select the rule variant for the start of play. Valid choices are CPSn, FCS, FES, TPS, and CZS.
- The default starting type, which matches the original rules, is CPS2.",
+ The default starting type, which matches the original rules, is CPS1.",
)
.metavar("VRNT");
@@ -89,7 +89,7 @@ fn main() {
Ok(st) => start_type = st,
}
} else {
- start_type = StartType::CPS(2);
+ start_type = StartType::CPS(1);
}
let call_proc;
diff --git a/src/parser.rs b/src/parser.rs
index c88d751..ba58b72 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -190,7 +190,9 @@ pub fn parse_start_type(st: &str) -> Result<StartType, String> {
if st.len() < 4 {
return Err(String::from(
- "Expecting CPSn as alternatives failed to match, but variant string was too short.",
+ "Expecting CPSn as
+ alternatives failed to match, but variant string was too
+ short.",
));
} else {
if st[..3] == String::from("CPS") {
@@ -198,7 +200,8 @@ pub fn parse_start_type(st: &str) -> Result<StartType, String> {
match num {
Err(e) => {
return Err(format!(
- "Failed to parse number, {}. CPS must be followed by a positive integer < 256, e.g., CPS2.",
+ "Failed to parse number, {}. CPS must be
+ immediately followed by a positive integer < 256, e.g., CPS1.",
e.to_string()
))
}