Same turn kill shot: Loss or Draw?

Hey guys,

Just curious. Rules states:

If both players are killed at the same time, the following will be used to determine a winner:

This makes me believe that both players CAN be killed at the same time.

I just had a case where both my bots (Player 1 as well as Player 2) should have ended the game the next round. But my Player 1 killed my Player 2 before he could shoot his end shot. I am not sure if rounds are meant to run “At the same time” or if player 1 is meant to have a slight advantage.

There is a chance that this was a bug in my code. But I am fairly sure it was not. If anyone has time they could confirm this. My bot is random in nature. I will keep an eye out for it when I get the chance.

Hi Willie,

There should be no advantage to either player, did the state file show that both players were killed? The logic is that both player’s commands are evaluated first before killing off any of the players. If you find that the above is not happening please let me know.

Thanks.

Good Day. There does seem to be some kind of issue.

I just ran some tests and noticed the following error:

Failed to process command FireShotCommand for player NAME GameEngine.Exceptions.InvalidCommandException: Sequence contains no matching element

Is it possible that the ship gets destroyed before the fireshot command is issued? And because all my ships are destroyed I can no longer use the Fireshot command? It looks like my ships gets killed before they can kill the opponent.
I confirm that this behavior does not exist for player A. So I believe the issue is not in the evaluation of players dying, But rather ships being destroyed. But im merely speculating. Since both my player 1 and player 2 bots are the same code.

Out of curiosity I ran the C# reference bot as Player 2 just to make sure its not my bot. And the same error appeared for the last move of player 2:

Failed to process command FireShotCommand for player JohnGameEngine.Exceptions.InvalidCommandException: Sequence contains no matching element
at GameEngine.Commands.PlayerCommands.FireShotCommand.PerformCommand(GameMap gameMap, BattleshipPlayer player) in W:\Projects\100k\2017\Github\2017-Batteships\GameEngine\Battleships\GameEngine\Commands\PlayerCommands\FireShotCommand.cs:line 45
at GameEngine.Engine.GameRoundProcessor.ProcessPlayerCommands() in W:\Projects\100k\2017\Github\2017-Batteships\GameEngine\Battleships\GameEngine\Engine\GameRoundProcessor.cs:line 113

Hope this helps. With this years challenge every single move is important. Even the last one.

Hi Willie,

Thanks for the input, this does seem like an issue, I will have a look at it and let you know how it goes.

Thanks for all the help

Hey guys, I just tested this in the Game Harness version 1.0.2, It seems that this error still exists.

The scenario I find (Same Turn):
Player A Sinks Player B’s last ship
Player B cannot use SingleShot because he has no more Ships that can use Single Shot

The same scenario reversed becomes
Player A fires last shot to Player B
Player B Sinks Player A’s last ship

This creates a slight problem in turns where Player A and Player B would have both landed kill shot same turn player A would get a shot and player B would lose.

I also believe this is going to become a larger bug once (if) different shots are added as it will mean that player B might miss his shots as he thinks his ships are still “Alive”.

This is also not a limitation that I see with Player A, which leads me to believe that ship weapons are somehow deactivated the moment the ship is destroyed instead of at round end when players are killed off.

Some logs that might help

My log for second last turn Player A:
28-05-2017 11:34:08:596 - I: Added Command FireShotCommand for Player Player A
28-05-2017 11:34:08:908 - I: Added Command FireShotCommand for Player Player B
28-05-2017 11:34:08:910 - D: Beginning round processing
28-05-2017 11:34:08:910 - D: Processing Player Commands
28-05-2017 11:34:08:910 - D: Killing off players who have no ships left
28-05-2017 11:34:08:912 - D: Killed player Player A
28-05-2017 11:34:08:915 - D: Round processing complete

My second last turn for Player B reversed scenario:
28-05-2017 11:38:30:917 - I: Added Command FireShotCommand for Player Player A
28-05-2017 11:38:31:224 - I: Added Command FireShotCommand for Player Player B
28-05-2017 11:38:31:226 - D: Beginning round processing
28-05-2017 11:38:31:226 - D: Processing Player Commands
28-05-2017 11:38:31:227 - E: Failed to process command FireShotCommand for player Player BGameEngine.Exceptions.InvalidCommandException: Player has no active ships capable of firing weapon SingleShot —> System.ArgumentException: Player has no active ships capable of firing weapon SingleShot
at Domain.Players.BattleshipPlayer.GetWeapon(WeaponType weaponType) in W:\Projects\100k\2017\Github\2017-Batteships\GameEngine\Battleships\Domain\Players\BattleshipPlayer.cs:line 122
at Domain.Games.GameMap.Shoot(PlayerType player, Point target, WeaponType weaponType) in W:\Projects\100k\2017\Github\2017-Batteships\GameEngine\Battleships\Domain\Games\GameMap.cs:line 77
at GameEngine.Commands.PlayerCommands.FireShotCommand.PerformCommand(GameMap gameMap, BattleshipPlayer player) in W:\Projects\100k\2017\Github\2017-Batteships\GameEngine\Battleships\GameEngine\Commands\PlayerCommands\FireShotCommand.cs:line 26
— End of inner exception stack trace —
at GameEngine.Commands.PlayerCommands.FireShotCommand.PerformCommand(GameMap gameMap, BattleshipPlayer player) in W:\Projects\100k\2017\Github\2017-Batteships\GameEngine\Battleships\GameEngine\Commands\PlayerCommands\FireShotCommand.cs:line 47
at GameEngine.Engine.GameRoundProcessor.ProcessPlayerCommands() in W:\Projects\100k\2017\Github\2017-Batteships\GameEngine\Battleships\GameEngine\Engine\GameRoundProcessor.cs:line 114

28-05-2017 11:38:31:316 - D: Killing off players who have no ships left
28-05-2017 11:38:31:320 - D: Killed player Player B
28-05-2017 11:38:31:324 - D: Round processing complete

This causes a slight advantage to Player A…

Hi Willie,

This is definitely a bug. I will have a look at this and fix it before the next battle. The moves are supposed to happen at the same time same as last year. I’ve created a new issue on the Github page.

Hi Willie,

The latest version of the game engine addresses this issue. Can you please confirm?

Hey Wackymax,

I confirm that this is working 100% now. Thanks.

My last shots before death on player 2 slips through.