 
   if(p1.X >= maxX || p1.X <= minX || p1.Y >= maxY || p1.Y <= minY)
   {
-    gameRunning = false; 
+    EndGame();
   }
 
   //Check if hit tail

    {
      p1.Len += 1;
    }
    
    score += 1;
    LogMove();
    GenerateFood();

        {
        if(p1.Moves[i].X == p1.X && p1.Moves[i].Y == p1.Y)
        {
          EndGame();
        }
      }
  }
