public virtual Command GenerateCommand(GameSetup gameSetup) { if (_random.NextDouble() > 0.5) { return Command.Fire(_random.Next(90) - 45, _random.Next(100) + 30); } else { return Command.Move(_random.NextDouble() > 0.5 ? -100 : 100); } }
private void PlayGame(GameSetup gameSetup, TanksClient client) { bool gameFinished = false; while (!gameFinished) { TurnResult result = client.SubmitMove(GenerateCommand(gameSetup)); gameFinished = result.last; } Console.WriteLine("game finished"); }
public virtual Command GenerateCommand(GameSetup gameSetup) { return NaiveBot.CurrentCommand; if (rand.NextDouble() > 0.5) { return Command.fire(rand.Next(90) - 45, rand.Next(100) + 30); } else { return Command.move(rand.NextDouble() > 0.5 ? -100 : 100); } }