chore: add get_current_player_capture to game manager

This commit is contained in:
2026-08-14 13:06:35 +02:00
parent b015c61bd2
commit 96c7ca73bf
3 changed files with 17 additions and 4 deletions

View File

@@ -1,3 +1,3 @@
pub mod board;
mod field;
mod pawn;
pub mod pawn;

View File

@@ -1,5 +1,3 @@
use core::fmt;
use uuid::Uuid;
use crate::logic::{math::position::Position, player::Player};

View File

@@ -1,4 +1,7 @@
use crate::logic::{board::board::Board, player::Player};
use crate::logic::{
board::{board::Board, pawn::CapturePath},
player::Player,
};
struct PlayerList {
pub players: [Player; 2],
@@ -38,4 +41,16 @@ impl GameMaster {
GameMaster { players, board }
}
pub fn get_current_player_captures(&self) -> Vec<CapturePath> {
self.board
.get_player_pawns_positions(self.players.get_current_turn())
.into_iter()
.filter_map(|pos| {
self.board
.get_available_captures(pos, self.players.get_current_turn())
})
.flatten()
.collect()
}
}