Skip to content

Commit

Permalink
Fix GeneratePossibleMoveEndings()
Browse files Browse the repository at this point in the history
  • Loading branch information
jnccd committed Jan 22, 2024
1 parent fa16d8f commit c4e603f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions socha-backend/State.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private List<Move> GeneratePossibleMoveEndings(List<Action> pastActions, Ship cu

List<Move> 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++)
Expand All @@ -124,7 +124,7 @@ private List<Move> GeneratePossibleMoveEndings(List<Action> 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++)
Expand Down

0 comments on commit c4e603f

Please sign in to comment.