diff --git a/socha-backend/State.cs b/socha-backend/State.cs index 30faf48..de6a157 100644 --- a/socha-backend/State.cs +++ b/socha-backend/State.cs @@ -103,7 +103,7 @@ private List GeneratePossibleMoveEndings(List pastActions, Ship cu List re = new(); - if (curShip.MovementPoints > 0 && pastActions.Last() is not Advance) + if (curShip.MovementPoints > 0 && (!pastActions.Any() || pastActions.Last() is not Advance)) { // Add advance action for (int i = 1; i < curShip.MovementPoints + 1; i++) @@ -124,7 +124,7 @@ private List GeneratePossibleMoveEndings(List pastActions, Ship cu } } - if ((curShip.Coal > 0 || curShip.FreeTurns > 0) && pastActions.Last() is not Backend.Turn) + if ((curShip.Coal > 0 || curShip.FreeTurns > 0) && (!pastActions.Any() || pastActions.Last() is not Backend.Turn)) { // Add turn action for (int i = 0; i < Enum.GetNames(typeof(Direction)).Length; i++)