AIXI.CTWContextTreeFast.revert_node C# (CSharp) Method

revert_node() public method

public revert_node ( int index, int symbol ) : void
index int
symbol int
return void
        public void revert_node(int index, int symbol)
        {
            int thisSymbolCount = this.SymbolCount(index, symbol);
            if (thisSymbolCount > 1)
            {
                this.SetSymbolCount(index, symbol, thisSymbolCount - 1);
            }
            else
            {
                this.SetSymbolCount(index, symbol, 0);
            }

            int lchild = this.Nodes[index].Child1;
            int rchild = this.Nodes[index].Child0;

            if (symbol==1 && lchild != -1) {
                if (this.FreeIfUnvisited(lchild))
                {
                    this.Nodes[index].Child1 = -1;
                }
            }
            if (symbol==0 && rchild != -1)
            {
                if (this.FreeIfUnvisited(rchild))
                {
                    this.Nodes[index].Child0 = -1;
                }
            }

            this.Nodes[index].LogKt -= this.LogKtMultiplier(index, symbol);
            this.UpdateLogProbability(index);
        }