Beispiel #1
0
 private static Dictionary <CellSymbol, bool> Extend(CellSymbol symbol, bool value,
                                                     IDictionary <CellSymbol, bool> model)
 {
     return(new Dictionary <CellSymbol, bool>(model)
     {
         [symbol] = value
     });
 }
Beispiel #2
0
        public override bool Equals(object obj)
        {
            CellSymbol cellSymbol = obj as CellSymbol;

            if (cellSymbol == null)
            {
                return(false);
            }

            return(Equals(cellSymbol));
        }
Beispiel #3
0
        private static bool TTCheckAll(ILogicalExpression kb, ILogicalExpression query,
                                       IReadOnlyList <CellSymbol> symbols, IDictionary <CellSymbol, bool> model)
        {
            if (symbols.Count == 0)
            {
                if (PLTrue(kb, model))
                {
                    bool res = PLTrue(query, model);

                    return(res);
                }

                return(true);
            }

            CellSymbol p    = symbols[0];
            var        rest = new List <CellSymbol>(symbols);

            rest.RemoveAt(0);

            return(TTCheckAll(kb, query, rest, Extend(p, true, model)) &&
                   TTCheckAll(kb, query, rest, Extend(p, false, model)));
        }
Beispiel #4
0
 private bool Equals(CellSymbol other)
 {
     return(row == other.row &&
            col == other.col &&
            symbol == other.symbol);
 }