bottom left is (0, 0)
This commit is contained in:
parent
18213278fd
commit
a50ca2c1b1
@ -713,24 +713,24 @@ mod tests {
|
||||
// replay of a test I did
|
||||
// TODO! make this as small of a test as possible
|
||||
let moves = vec![
|
||||
(Some((5, 4)), Piece::Black),
|
||||
(Some((5, 5)), Piece::White),
|
||||
(Some((5, 6)), Piece::Black),
|
||||
(Some((6, 4)), Piece::White),
|
||||
(Some((7, 3)), Piece::Black),
|
||||
(Some((7, 4)), Piece::White),
|
||||
(Some((7, 5)), Piece::Black),
|
||||
(Some((2, 4)), Piece::White),
|
||||
(Some((1, 4)), Piece::Black),
|
||||
(Some((1, 5)), Piece::White),
|
||||
(Some((1, 6)), Piece::Black),
|
||||
(Some((0, 6)), Piece::White),
|
||||
(Some((3, 2)), Piece::Black),
|
||||
(Some((1, 7)), Piece::White),
|
||||
(Some((5, 3)), Piece::Black),
|
||||
(Some((5, 2)), Piece::White),
|
||||
(Some((5, 1)), Piece::Black),
|
||||
(Some((6, 3)), Piece::White),
|
||||
(Some((7, 4)), Piece::Black),
|
||||
(Some((7, 3)), Piece::White),
|
||||
(Some((7, 2)), Piece::Black),
|
||||
(Some((2, 3)), Piece::White),
|
||||
(Some((1, 3)), Piece::Black),
|
||||
(Some((1, 2)), Piece::White),
|
||||
(Some((1, 1)), Piece::Black),
|
||||
(Some((0, 1)), Piece::White),
|
||||
(Some((3, 5)), Piece::Black),
|
||||
(Some((1, 0)), Piece::White),
|
||||
(None, Piece::Black), // black skips a move
|
||||
(Some((0, 4)), Piece::White),
|
||||
(Some((0, 3)), Piece::White),
|
||||
(None, Piece::Black), // black skips a move
|
||||
(Some((4, 2)), Piece::White),
|
||||
(Some((4, 5)), Piece::White),
|
||||
];
|
||||
|
||||
for (i, (coords, color)) in moves.into_iter().enumerate() {
|
||||
@ -775,10 +775,10 @@ mod tests {
|
||||
let mut b = Board::STARTING_POSITION;
|
||||
futm.update_from_board(&b);
|
||||
|
||||
b.place((4, 2).into(), Piece::White).unwrap();
|
||||
b.place((4, 5).into(), Piece::White).unwrap();
|
||||
|
||||
futm.arena.push(Move::new(
|
||||
Some((4, 2).into()),
|
||||
Some((4, 5).into()),
|
||||
b,
|
||||
Piece::White,
|
||||
Piece::White,
|
||||
@ -788,14 +788,14 @@ mod tests {
|
||||
|
||||
assert_eq!(
|
||||
futm.move_history(1),
|
||||
Some(vec![(Some((4, 2).into()), Piece::White)]),
|
||||
Some(vec![(Some((4, 5).into()), Piece::White)]),
|
||||
);
|
||||
assert_eq!(futm.get_board_from_idx(1), Some(b));
|
||||
|
||||
b.place((5, 4).into(), Piece::Black).unwrap();
|
||||
b.place((5, 3).into(), Piece::Black).unwrap();
|
||||
|
||||
futm.arena.push(Move::new(
|
||||
Some((5, 4).into()),
|
||||
Some((5, 3).into()),
|
||||
b,
|
||||
Piece::Black,
|
||||
Piece::White,
|
||||
@ -805,8 +805,8 @@ mod tests {
|
||||
assert_eq!(
|
||||
futm.move_history(2),
|
||||
Some(vec![
|
||||
(Some((4, 2).into()), Piece::White),
|
||||
(Some((5, 4).into()), Piece::Black)
|
||||
(Some((4, 5).into()), Piece::White),
|
||||
(Some((5, 3).into()), Piece::Black)
|
||||
]),
|
||||
);
|
||||
assert_eq!(futm.get_board_from_idx(2), Some(b));
|
||||
|
||||
@ -66,7 +66,7 @@ impl fmt::Display for Board {
|
||||
|
||||
// Print numbers at top so the board can be read more easier
|
||||
write!(f, "{}", SPACE_PADDING)?;
|
||||
for j in (0..Self::SIZE).rev() {
|
||||
for j in 0..Self::SIZE {
|
||||
write!(f, " {:0PADDING$}", j)?;
|
||||
}
|
||||
writeln!(f)?;
|
||||
@ -75,7 +75,7 @@ impl fmt::Display for Board {
|
||||
writeln!(f, "{}{}", SPACE_PADDING, HORIZ_SEP_LINE)?;
|
||||
|
||||
write!(f, "{:0PADDING$}|", i)?;
|
||||
for j in (0..Self::SIZE).rev() {
|
||||
for j in 0..Self::SIZE {
|
||||
write!(
|
||||
f,
|
||||
"{}|",
|
||||
@ -138,11 +138,11 @@ impl Board {
|
||||
let mut new = Self::new();
|
||||
let hf = Self::SIZE / 2;
|
||||
|
||||
new.place_unchecked(CoordPair::from_axes(hf - 1, hf - 1), Piece::White);
|
||||
new.place_unchecked(CoordPair::from_axes(hf, hf - 1), Piece::Black);
|
||||
new.place_unchecked(CoordPair::from_axes(hf - 1, hf - 1), Piece::Black);
|
||||
new.place_unchecked(CoordPair::from_axes(hf, hf - 1), Piece::White);
|
||||
|
||||
new.place_unchecked(CoordPair::from_axes(hf - 1, hf), Piece::Black);
|
||||
new.place_unchecked(CoordPair::from_axes(hf, hf), Piece::White);
|
||||
new.place_unchecked(CoordPair::from_axes(hf - 1, hf), Piece::White);
|
||||
new.place_unchecked(CoordPair::from_axes(hf, hf), Piece::Black);
|
||||
new
|
||||
};
|
||||
|
||||
@ -498,7 +498,7 @@ mod test {
|
||||
fn format_test() {
|
||||
assert_eq!(
|
||||
Board::STARTING_POSITION.to_string().as_str(),
|
||||
" 7 6 5 4 3 2 1 0
|
||||
" 0 1 2 3 4 5 6 7
|
||||
-----------------
|
||||
7| | | | | | | | |
|
||||
-----------------
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user