Skip to content

PeterMilovcik/CodingArena2

Repository files navigation

CodingArena 2.0

A game for programmers to compete against each other to show best skills for creativity, fast writing, iterative implementation and more by implementing bot artificial intelligence to fight against other bots.

Current version will only support C# programming language.

How to implement own bot

  1. Create class assembly project for implementation of your bot.
  2. Reference latest NuGet package called CodingArena.AI.
  3. Implement abstract class BotAI.
  4. Build and upload assembly with bot implementation to server where the CodingArena game is hosted.

Here are few examples for implementing bot actions:

Find closest resource

var closestResource = battlefield.Resources.OrderBy(ownBot.DistanceTo).FirstOrDefault();

Pickup resource

return ownBot.DistanceTo(closestResource) < ownBot.Radius
   ? TurnAction.PickUpResource()
   : TurnAction.MoveTowards(closestResource);

Drop resource to the base

if (ownBot.HasResource)
{
   return ownBot.DistanceTo(ownBot.Home) > ownBot.Radius
      ? TurnAction.MoveTowards(ownBot.Home)
      : TurnAction.DropDownResource();
}

Attack enemy bot

if (battlefield.Bots.Contains(enemy))
{
   return ownBot.DistanceTo(enemy) < ownBot.EquippedWeapon.MaxRange
      ? TurnAction.ShootAt(enemy)
      : TurnAction.MoveTowards(enemy);
}

All possible actions are available by using TurnAction static factory class.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages