EntelectChallenge / 2017-Battleships

MIT License
22 stars 31 forks source link

Issue with rendering game rounds #40

Closed lebezee closed 7 years ago

lebezee commented 7 years ago

When I run the new engine v1.0.1 with option --pretty it fails to run. It seems there might be a hardcoded path in the code? See my run comman below with responses:

$ ./Battleships.exe --pretty -b "D:\My Space\entelect\Challenge 2017\Sample.Bot.-.Java\Java\SampleBot" "D:\My Space\entelect\Challenge 2017\Sample.Bot.-.Java\Java\SampleBot"
Starting new game
System.IO.IOException: The handle is invalid.

   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.Console.GetBufferInfo(Boolean throwOnNoConsole, Boolean& succeeded)
   at System.Console.Clear()
   at GameEngine.Renderers.ConsoleRender.RenderToConsolePretty(GameMap gameMap, PlayerType playerType) in W:\Projects\100k\2017\Github\2017-Batteships\GameEngine\Battleships\GameEngine\Renderers\ConsoleRender.cs:line 13
   at Battleships.BattleshipsGame.engine_RoundComplete(GameMap gameMap, Int32 round) in W:\Projects\100k\2017\Github\2017-Batteships\GameEngine\Battleships\Battleships\BattleshipsGame.cs:line 120
   at GameEngine.Engine.BattleshipEngine.RoundStartingHandler.Invoke(GameMap gameMap, Int32 round)
   at GameEngine.Engine.BattleshipEngine.PublishRoundStarting() in W:\Projects\100k\2017\Github\2017-Batteships\GameEngine\Battleships\GameEngine\Engine\BattleshipEngine.cs:line 216
   at GameEngine.Engine.BattleshipEngine.StartNewRound() in W:\Projects\100k\2017\Github\2017-Batteships\GameEngine\Battleships\GameEngine\Engine\BattleshipEngine.cs:line 207
   at GameEngine.Engine.BattleshipEngine.StartNewGame() in W:\Projects\100k\2017\Github\2017-Batteships\GameEngine\Battleships\GameEngine\Engine\BattleshipEngine.cs:line 65
   at Battleships.BattleshipsGame.StartNewGame(Options options) in W:\Projects\100k\2017\Github\2017-Batteships\GameEngine\Battleships\Battleships\BattleshipsGame.cs:line 91
EntelectChallenge commented 7 years ago

Hi Iebezee,

Are you running on Linux? It seems to be related to specifically calling the Console.Clear method, the error is not related to any directories. I suspect the .Net API is unable to obtain a handle to the windows console, and the handle that it does have for Linux does not support the clear method? That would be my suspicion anyways.

lebezee commented 7 years ago

You are spot on... I'm on a windows machine, but I was using gitBash to run. It worked fine with cmd.

Thanks for the help.