public override KeyValuePair <MinesweeperActionType, Vector2Int> ChooseStep()
    {
        Vector2Int current;

        if (Open.Count == 0 && Safe.Count == 0 && Mine.Count == 0)
        {
            return(new KeyValuePair <MinesweeperActionType, Vector2Int>(MinesweeperActionType.Uncover, Guessor.Guess()));
        }
        else
        {
            if (OutOfTrivials)
            {
                FindMinesandSafeTiles();
            }

            if (OutOfTrivials)
            {
                Vector2Int v2i = Guessor.Guess();
                return(new KeyValuePair <MinesweeperActionType, Vector2Int>(MinesweeperActionType.Uncover, v2i));
            }
            else
            {
                if (Mine.Count != 0)
                {
                    current = Mine.First();
                    Mine.Remove(current);
                    return(new KeyValuePair <MinesweeperActionType, Vector2Int>(MinesweeperActionType.Flag, current));
                }
                else
                {
                    current = Safe.First();
                    Safe.Remove(current);
                    return(new KeyValuePair <MinesweeperActionType, Vector2Int>(MinesweeperActionType.Uncover, current));
                }
            }
        }
    }
    public override KeyValuePair <MinesweeperActionType, Vector2Int> ChooseStep()
    {
        Vector2Int current;

        if (Open.Count == 0 && Safe.Count == 0 && Mine.Count == 0)
        {
            return(new KeyValuePair <MinesweeperActionType, Vector2Int>(MinesweeperActionType.Uncover, Guessor.Guess()));
        }
        else
        {
            if (OutOfTrivials)
            {
                FindMinesandSafeTiles();
            }

            if (OutOfTrivials)
            {
                if (Open.Count <= MaxSolvingLength)
                {
                    recalculateOpenTiles();
                }
                else
                {
                    return(new KeyValuePair <MinesweeperActionType, Vector2Int>(MinesweeperActionType.Uncover, Guessor.Guess()));
                }
            }

            if (OutOfTrivials)
            {
                KeyValuePair <Vector2Int, float> first    = Open.First();
                KeyValuePair <Vector2Int, float> smallest = first;
                foreach (var item in Open)
                {
                    if (item.Value < smallest.Value)
                    {
                        smallest = item;
                    }
                }
                if (smallest.Value < uncoverMaxValue)
                {
                    Debug.Log("backtrack choose " + smallest.ToString());
                    Open.Remove(smallest.Key);
                    return(new KeyValuePair <MinesweeperActionType, Vector2Int>(MinesweeperActionType.Uncover, smallest.Key));
                }
                return(new KeyValuePair <MinesweeperActionType, Vector2Int>(MinesweeperActionType.Uncover, Guessor.Guess()));
            }
            else
            {
                if (Mine.Count != 0)
                {
                    current = Mine.First();
                    Mine.Remove(current);
                    return(new KeyValuePair <MinesweeperActionType, Vector2Int>(MinesweeperActionType.Flag, current));
                }
                else
                {
                    current = Safe.First();
                    Safe.Remove(current);
                    return(new KeyValuePair <MinesweeperActionType, Vector2Int>(MinesweeperActionType.Uncover, current));
                }
            }
        }
    }