fix play loop
This commit is contained in:
parent
6ceefe01ab
commit
6a0dc9395a
4 changed files with 48 additions and 24 deletions
|
|
@ -28,7 +28,7 @@ fn transpose(matrix: Vec<Vec<String>>) -> Vec<Vec<String>> {
|
|||
|
||||
impl CheckerMove {
|
||||
pub fn new(from: Field, to: Field) -> Result<Self, Error> {
|
||||
println!("from {} to {}", from, to);
|
||||
// println!("from {} to {}", from, to);
|
||||
// check if the field is on the board
|
||||
// we allow 0 for 'to', which represents the exit of a checker
|
||||
if from < 1 || 24 < from || 24 < to {
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ impl GameState {
|
|||
let (move1, move2): &(CheckerMove, CheckerMove) = moves.into();
|
||||
let dist1 = (move1.get_to() as i8 - move1.get_from() as i8).abs() as u8;
|
||||
let dist2 = (move2.get_to() as i8 - move2.get_from() as i8).abs() as u8;
|
||||
print!("{}, {}, {}, {}", dist1, dist2, dice1, dice2);
|
||||
// print!("{}, {}, {}, {}", dist1, dist2, dice1, dice2);
|
||||
// basic : same number
|
||||
if cmp::min(dist1, dist2) != cmp::min(dice1, dice2)
|
||||
|| cmp::max(dist1, dist2) != cmp::max(dice1, dice2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue