public override SuggestedMoves ChooseColor(Model.Color[,] board) { SuggestedMove move = new SuggestedMove(); foreach(Color color in Enum.GetValues(typeof(Color))) { if (!recentColors.Contains(color)) { move.AddSuggestion(color, 100); } } int index = 1; foreach (Color color in recentColors) { move.AddSuggestion(color, index++); } var moves = new SuggestedMoves(); moves.AddFirst(move); return moves; }
public override SuggestedMoves ChooseColor(Color[,] board) { MapNode head = MapBuilder.BuildMap(board); ISet<MapNode> firstLayer = head.GetNeighbors(); List<Color> possibleColorsToClear = firstLayer.Select(node => node.Color).ToList(); IEnumerator<MapNode> breathFirstSearch = head.BFS().GetEnumerator(); while(breathFirstSearch.MoveNext() && possibleColorsToClear.Count > 0) { MapNode currentNode = breathFirstSearch.Current; if (!firstLayer.Contains(currentNode)) { //can't wipe out that color, it is behind the first layer possibleColorsToClear.Remove(currentNode.Color); } } SuggestedMove move = new SuggestedMove(possibleColorsToClear); SuggestedMoves moves = new SuggestedMoves(); moves.AddFirst(move); return moves; }
internal void Intersect(SuggestedMove otherSuggestedMove) { suggestions.Intersect(otherSuggestedMove.suggestions); }
public void AddLast(SuggestedMove move) { Moves.AddLast(move); }