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.
- Create class assembly project for implementation of your bot.
- Reference latest NuGet package called
CodingArena.AI
. - Implement abstract class BotAI.
- 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.