wip 2 pointifying

This commit is contained in:
2026-08-11 01:02:38 -05:00
parent 3b5bf21ac5
commit 38c58a2c5f
25 changed files with 163 additions and 309 deletions
+3 -3
View File
@@ -8,7 +8,7 @@ use crate::board::Board;
use crate::board::tests::open_board;
use crate::game::GameState;
use crate::portal::Portal;
use crate::utils::Direction;
use crate::utils::{Direction, Point};
use crate::world::World;
use std::cell::RefCell;
use std::collections::HashMap;
@@ -75,7 +75,7 @@ fn enter_board_places_player_at_arrival_portal() {
let mut game = GameState::from_world(two_board_world());
game.enter_board("b2", "from_b1");
// Arrival portal "from_b1" is at (1, 1) on b2.
assert_eq!(game.board().player_pos(), (1, 1));
assert_eq!(game.board().player_pos(), Point { x: 1, y: 1 });
}
#[test]
@@ -90,7 +90,7 @@ fn entering_a_board_leaves_exactly_one_player_on_it() {
let b = game.board();
let players = (0..b.height)
.flat_map(|y| (0..b.width).map(move |x| (x, y)))
.filter(|&(x, y)| b.get(x, y).as_ref().is_some_and(|t| t.player()))
.filter(|&(x, y)| b.get((x, y)).as_ref().is_some_and(|t| t.player()))
.count();
assert_eq!(players, 1, "arriving on a board must not duplicate the player");
}