override protected string EvaluateFormula()
        {
            var cell = Cells.First();

            while (cell != null)
            {
                if (cell.Value != null)
                {
                    ResultValueType = cell.ValueType;

                    return(cell.Value);
                }

                if (cell.Formula != null && cell.Formula.Cells.Count() != 0)
                {
                    cell = cell.Formula.Cells.First();
                }
                else
                {
                    return(null);
                }
            }

            return(null);
        }
Example #2
0
        public double GetPColor(Cell.Type type)
        {
            int count = 0;

            for (int i = 1; i < 20; i++)
            {
                for (int j = 1; j < 20; j++)
                {
                    if (GetCells()[i, j].GetColor() == (int)type)
                    {
                        count++;
                    }
                }
            }
            return(Math.Round(((double)count / (double)emptyCounter * 100)));
        }
Example #3
0
        private void SetEditType(Cell.Type cellType)
        {
            switch (cellType)
            {
            case Cell.Type.Int:
                _input.contentType = InputField.ContentType.IntegerNumber;
                _setFunction       = SetInt;
                break;

            case Cell.Type.NullableInt:
                _input.contentType = InputField.ContentType.IntegerNumber;
                _setFunction       = SetNullableInt;
                break;

            case Cell.Type.UniqueInt:
                _input.contentType = InputField.ContentType.IntegerNumber;
                _setFunction       = SetUniqueInt;
                break;

            case Cell.Type.String:
                _input.contentType = InputField.ContentType.Standard;
                _setFunction       = SetString;
                break;

            case Cell.Type.NullableString:
                _input.contentType = InputField.ContentType.Standard;
                _setFunction       = SetNullableString;
                break;

            case Cell.Type.UniqueString:
                _input.contentType = InputField.ContentType.Standard;
                _setFunction       = SetUniqueString;
                break;

            case Cell.Type.Float:
                _input.contentType = InputField.ContentType.DecimalNumber;
                _setFunction       = SetFloat;
                break;

            case Cell.Type.NullableFloat:
                _input.contentType = InputField.ContentType.DecimalNumber;
                _setFunction       = SetNullableFloat;
                break;
            }
        }
Example #4
0
        public int CountOfMour(List <List <Cell> > place, int i, int j, Cell.Type type)
        {
            int size  = place.Count;
            int count = 0;

            if (i - 1 >= 0 && j - 1 >= 0 && place[i - 1][j - 1].State == type)
            {
                count++;
            }
            if (j - 1 >= 0 && place[i][j - 1].State == type)
            {
                count++;
            }
            if (i + 1 < size && j - 1 >= 0 && place[i + 1][j - 1].State == type)
            {
                count++;
            }
            if (i + 1 < size && place[i + 1][j].State == type)
            {
                count++;
            }
            if (i + 1 < size && j + 1 < size && place[i + 1][j + 1].State == type)
            {
                count++;
            }
            if (j + 1 < size && place[i][j + 1].State == type)
            {
                count++;
            }
            if (i - 1 >= 0 && j + 1 < size && place[i - 1][j + 1].State == type)
            {
                count++;
            }
            if (i - 1 >= 0 && place[i - 1][j].State == type)
            {
                count++;
            }

            return(count);
        }
Example #5
0
        private async Task FillArea(Cell currentCell, Cell.Type type)
        {
            currentCell.ChangeType((int)type);
            HowMuchEmpty--;
            Thread.Sleep(1000 / fps);

            List <Task> t = new List <Task>();
            await Task.Yield();

            if (currentCell.Row > 0) // Left
            {
                Cell leftCell = cell[currentCell.Row - 1, currentCell.Col];
                if (leftCell.GetColor() == (int)Cell.Type.empty)
                {
                    t.Add(FillArea(leftCell, type));
                }
                else
                {
                    Console.WriteLine("Stop Left");
                }
            }

            if (currentCell.Row < NUM_CELLS - 1) // Left
            {
                Cell rightCell = cell[currentCell.Row + 1, currentCell.Col];
                if (rightCell.GetColor() == (int)Cell.Type.empty)
                {
                    t.Add(FillArea(rightCell, type));
                }
                else
                {
                    Console.WriteLine("Stop Right");
                }
            }

            if (currentCell.Col > 0) // Top
            {
                Cell topCell = cell[currentCell.Row, currentCell.Col - 1];
                if (topCell.GetColor() == (int)Cell.Type.empty)
                {
                    t.Add(FillArea(topCell, type));
                }
                else
                {
                    Console.WriteLine("Stop Top");
                }
            }

            if (currentCell.Col < NUM_CELLS - 1) // Bottom
            {
                Cell bottomCell = cell[currentCell.Row, currentCell.Col + 1];
                if (bottomCell.GetColor() == (int)Cell.Type.empty)
                {
                    t.Add(FillArea(bottomCell, type));
                }
                else
                {
                    Console.WriteLine("Stop Bottom");
                }
            }
            await Task.WhenAll(t);

            await Task.Yield();
        }
Example #6
0
 bool CheckWin(Cell.Type symbol)
 {
     return(true);
     //TODO
 }
        protected override string EvaluateFormula()
        {
            ResultValueType = Cells[0].ValueType;

            return(Cells[0].Value);
        }