I modified the code of the C# Starter bot which I found at
http://theaigames.com/competitions/warlight-ai-challenge-2/getting-started.
My change was in the attack system. I modiefied it to
var attackTransferMoves = new List<AttackTransferMove>();
var myName = state.MyName;
var armies = 1;
foreach (var superbonus in state.FullMap.SuperRegions){
var notownedregions = new List<Region> ();
var ownedregions = new List<Region> ();
foreach (var subregion in superbonus.SubRegions) {
if (subregion.OwnedByPlayer(myName)) {
ownedregions.Add(subregion);
} else {
notownedregions.Add(subregion);
}
}
foreach (var fromregion in ownedregions) {
var possibleToRegions = new List<Region>();
possibleToRegions.AddRange(fromregion.Neighbors);
var match = false;
foreach (var toregion in ownedregions) {
var matchtwo = false;
foreach (var notownedregion in notownedregions) {
if (toregion.Id == notownedregion.Id) {
matchtwo = true;
}
}
if (matchtwo) {
match = true;
attackTransferMoves.Add(new AttackTransferMove(myName, fromregion, toregion, armies));
}
}
if (match == false) {
foreach (var toregion in ownedregions) {
attackTransferMoves.Add(new AttackTransferMove(myName, fromregion, toregion, armies));
}
}
}
}
But
if (subregion.OwnedByPlayer(myName)) {
ownedregions.Add(subregion);
}
is never true. So I hope someone can tell me where my mistake is.