File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff 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.
Original file line number Diff line number Diff 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 ( ) ;
You can’t perform that action at this time.
0 commit comments