public AStar(Board board) { OpenSet = new List<StarTile>(); CloseSet = new List<StarTile>(); IsGoalFound = false; Path = new List<string>(); bfs = new BreadthFirstSearch(board); }
static void Main(string[] args) { finished = false; Agents = InitializeAgents(NUM_AGENTS, NUM_START_TROOPS); Board = InitializeBoard(TERRITORY_FILE_PATH, CONTINENT_FILE_PATH); DistributeTerritoriesToAgents(Agents, (Board)Board.Clone()); UpdateBoard(Agents, Board); EquallyDistributeTroops(Agents); UpdateBoard(Agents, Board); BreadthFirstSearch bfs = new BreadthFirstSearch((Board)Board.Clone()); bfs.Start("alaska"); List<BfsTile> tiles = bfs.Tiles; foreach (BfsTile t in tiles) { Console.WriteLine(t.Id + " : " + t.Distance); } do { foreach (Agent a in Agents) { // continent bonus Mechanics.ApplyContinentBonus(a, (Board)Board.Clone()); // cash in cards, if possible Mechanics.ApplyCardBonus(a, Board); // not fully tested // collect territory reinforcements Mechanics.GetReinforcements(a); // place reinforcements (no intelligent mechanism for now) Mechanics.PlaceReinforcements(a); // update territories on board Mechanics.UpdateBoard(Agents, Board); // perform attacking // tactical move // end turn } } while (!finished); }