diff --git a/src/plugin/action/card.rs b/src/plugin/action/card.rs index 9c113c4..2cd24bb 100644 --- a/src/plugin/action/card.rs +++ b/src/plugin/action/card.rs @@ -3,7 +3,8 @@ use std::mem::swap; use pyo3::*; use crate::plugin::{ - errors::HUIError, field::Field, game_state::GameState, hare::Hare, rules_engine::RulesEngine, + constants::PluginConstants, errors::HUIError, field::Field, game_state::GameState, hare::Hare, + rules_engine::RulesEngine, }; use super::Action; @@ -80,10 +81,8 @@ impl Card { } Card::EatSalad => current.eat_salad(state)?, Card::SwapCarrots => { - let last_lettuce_position = 57; - - if current.position >= last_lettuce_position - || other.position >= last_lettuce_position + if current.position >= PluginConstants::LAST_LETTUCE_POSITION + || other.position >= PluginConstants::LAST_LETTUCE_POSITION { return Err(HUIError::new_err( "You can only play this card if both players are before the last lettuce field", diff --git a/src/plugin/constants.rs b/src/plugin/constants.rs index 2544680..c9e59a1 100644 --- a/src/plugin/constants.rs +++ b/src/plugin/constants.rs @@ -11,4 +11,6 @@ impl PluginConstants { pub const INITIAL_CARROTS: i32 = 68; pub const ROUND_LIMIT: usize = 30; + + pub const LAST_LETTUCE_POSITION: usize = 57; }