diff --git a/MiniAiCup.Paperio.Core/Game.cs b/MiniAiCup.Paperio.Core/Game.cs index 0b91fa4..1f4cda4 100644 --- a/MiniAiCup.Paperio.Core/Game.cs +++ b/MiniAiCup.Paperio.Core/Game.cs @@ -109,10 +109,14 @@ public Direction GetNextDirection(GameState state) var nextState = GetNextState(bestState, currentState); nextDirection = nextState.Me.Direction.Value; } - else + else if (currentState.Me.PathToHome != null && currentState.Me.PathToHome.Length > 0) { nextDirection = currentState.Me.Position.GetDirectionTo(currentState.Me.PathToHome[0]); } + else + { + nextDirection = currentState.Me.Direction ?? Direction.Left; + } #if DEBUG stopwatch.Stop();