Skip to content

Commit af14c33

Browse files
authored
Merge branch 'master' into improve-piranhas-2026
2 parents b334535 + cf41140 commit af14c33

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

python/socha/_socha.pyi

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,18 @@ class GameState:
675675
"""
676676
...
677677

678+
def possible_moves_for(self, start: Coordinate) -> List[Move]:
679+
"""
680+
Berechnet alle Züge, die aus der aktuellen Spielposition für den Fisch an der Koordinate möglich sind.
681+
682+
Args:
683+
start (Coordinate): Die Position des gewählten Fisch.
684+
685+
Returns:
686+
List[Move]: Die Liste der Züge.
687+
"""
688+
...
689+
678690
def possible_moves(self) -> List[Move]:
679691
"""
680692
Berechnet alle Züge, die aus der aktuellen Spielposition für den aktuellen Spieler möglich sind.

src/plugin2026/game_state.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,19 @@ impl GameState {
6262
.collect()
6363
}
6464

65+
pub fn possible_moves_for(&self, start: &Coordinate) -> Vec<Move> {
66+
let mut moves: Vec<Move> = Vec::new();
67+
68+
for d in Direction::all_directions() {
69+
moves.push(Move { start: start.to_owned(), direction: d });
70+
}
71+
72+
moves
73+
.into_iter()
74+
.filter(|m| RulesEngine::can_execute_move(&self.board, m).is_ok())
75+
.collect()
76+
}
77+
6578
pub fn possible_moves(&self) -> Vec<Move> {
6679
let mut moves: Vec<Move> = Vec::new();
6780
let mut fish: Vec<Coordinate> = Vec::new();

0 commit comments

Comments
 (0)