private void DrawSuggestedMoveArrow() { if (board.ActualWidth == 0) { return; } Point start = GetSquareMiddlePoint(SuggestedMove.GetFrom()); Point end = GetSquareMiddlePoint(SuggestedMove.GetTo()); double squareWidth = board.ActualWidth / 8; DrawArrow(start, end, squareWidth / 4); }
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); }