예제 #1
0
    private int GetHits(BooleanTerm boolTerm)
    {
        int  hits    = 0;
        bool foundOs = false;

        for (int i = 0; i < _width; i++)
        {
            for (int j = 0; j < _height; j++)
            {
                KVelement temp = _grid.GetObjFromCoordinate(new Vector2Int(i, j)).GetComponent <KVelement>();
                if (temp)
                {
                    if (!temp.highlighted)
                    {
                        if (temp.Highlight(boolTerm.charges.x, boolTerm.charges.y) == 1)
                        {
                            hits++;
                        }
                        if (temp.Highlight(boolTerm.charges.x, boolTerm.charges.y) == 0)
                        {
                            foundOs = true;
                        }
                    }
                }
            }
        }
        if (!foundOs)
        {
            return(hits);
        }
        else
        {
            return(-1);
        }
    }
예제 #2
0
 public void AddExpressionToResult()
 {
     if (_currentSelectionNegative != 0 || _currentSelectionPositive != 0)
     {
         BooleanTerm temp = new BooleanTerm();
         temp.charges    = new Vector2Int(_currentSelectionPositive, _currentSelectionNegative);
         temp.expression = _booleanExpression.text;
         _booleanTerms.booleanTerms.Add(temp);
         UITableFiller.FillTable(_stageOnePanel, _booleanTerms.booleanTerms);
         _currentSelectionPositive = 0;
         _currentSelectionNegative = 0;
         SetText();
     }
 }