public StateAPI(AppConfiguaraion appConfig, GameConfig gameConfig, ErrorFunc ef, InvokeFunction invokefunc) { this.appConfig = appConfig; this.gameConfig = gameConfig; errFunc = ef; invokeFunction = invokefunc; dropBoxFolderWatcher = null; //currentPlayer = ""; }
private ISymbolicExpressionTreeNode ParseInvoke(Queue <Token> tokens) { Token invokeTok = tokens.Dequeue(); Debug.Assert(invokeTok.StringValue == "CALL"); InvokeFunction invokeSym = new InvokeFunction(tokens.Dequeue().StringValue); ISymbolicExpressionTreeNode invokeNode = invokeSym.CreateTreeNode(); return(invokeNode); }
public static void IsValid(ISymbolicExpressionTree tree) { int reportedSize = tree.Length; int actualSize = tree.IterateNodesPostfix().Count(); Assert.AreEqual(actualSize, reportedSize); foreach (var defunTreeNode in tree.Root.Subtrees.OfType <DefunTreeNode>()) { int arity = defunTreeNode.NumberOfArguments; foreach (var argTreenode in defunTreeNode.IterateNodesPrefix().OfType <ArgumentTreeNode>()) { Assert.IsTrue(argTreenode.SubtreeCount == 0); Assert.IsTrue(((Argument)argTreenode.Symbol).ArgumentIndex < arity); } foreach (var argSymbol in Enumerable.Range(0, defunTreeNode.NumberOfArguments).Select(x => new Argument(x))) { Assert.IsTrue(defunTreeNode.Grammar.ContainsSymbol(argSymbol)); Assert.IsTrue(defunTreeNode.Grammar.GetMaximumSubtreeCount(argSymbol) == 0); Assert.IsTrue(defunTreeNode.Grammar.GetMinimumSubtreeCount(argSymbol) == 0); } var invoke = new InvokeFunction(defunTreeNode.FunctionName); foreach (var otherRootNode in tree.Root.Subtrees) { if (otherRootNode.Grammar.ContainsSymbol(invoke)) { Assert.IsTrue(otherRootNode.Grammar.GetMinimumSubtreeCount(invoke) == arity); Assert.IsTrue(otherRootNode.Grammar.GetMaximumSubtreeCount(invoke) == arity); Assert.IsFalse(otherRootNode.Grammar.IsAllowedChildSymbol(invoke, invoke)); for (int i = 0; i < arity; i++) { Assert.IsFalse(otherRootNode.Grammar.IsAllowedChildSymbol(invoke, invoke, i)); } } } } foreach (var subtree in tree.Root.Subtrees) { if (tree.Root.Grammar.GetType().Name != "EmptySymbolicExpressionTreeGrammar") { Assert.AreNotSame(subtree.Grammar, tree.Root.Grammar); } IsValid(subtree.Grammar); } IsValid(tree.Root.Grammar); IsValid(tree.Root); }
public Function_Pair(InvokeFunction IF, InvokeFunctionDerivative IFD) { this.IF = IF; this.IFD = IFD; ; }
public static IEnumerator Invoke(InvokeFunction invokeFunction, float delay = 0) { yield return(new WaitForSeconds(delay)); invokeFunction(); }