feat: implement get_current_player_moves for game_master and move_path struct

This commit is contained in:
2026-08-14 13:40:25 +02:00
parent 96c7ca73bf
commit d6fa72ae38
3 changed files with 77 additions and 8 deletions

View File

@@ -1,5 +1,9 @@
use crate::logic::{
board::{board::Board, pawn::CapturePath},
board::{
board::Board,
pawn::{CapturePath, MovePath},
},
math::position::Position,
player::Player,
};
@@ -53,4 +57,16 @@ impl GameMaster {
.flatten()
.collect()
}
pub fn get_current_player_moves(&self) -> Vec<MovePath> {
self.board
.get_player_pawns_positions(self.players.get_current_turn())
.into_iter()
.filter_map(|pos| {
self.board
.get_available_moves(pos, self.players.get_current_turn())
})
.flatten()
.collect()
}
}