Exemplo n.º 1
0
        public BearContext(HTNAnimal body, BearDomain domain)
        {
            int length = System.Enum.GetValues(typeof(Facts)).Length;

            if (this._worldState == null || this._worldState.Length != length)
            {
                this._worldState         = new byte[length];
                this._previousWorldState = new byte[length];
                if (BearContext._worldStateChanges == null)
                {
                    BearContext._worldStateChanges = new Stack <WorldStateInfo> [length];
                    for (int index = 0; index < length; ++index)
                    {
                        BearContext._worldStateChanges[index] = new Stack <WorldStateInfo>(5);
                    }
                }
            }
            this._decompositionScore = int.MaxValue;
            this.Body      = body;
            this.Domain    = domain;
            this.PlanState = (PlanStateType)0;
            if (this.Memory != null && this.Memory.BearContext == this)
            {
                return;
            }
            this.Memory = new BearMemory(this);
        }
Exemplo n.º 2
0
        public BearContext(HTNAnimal body, BearDomain domain)
        {
            int length = Enum.GetValues(typeof(Facts)).Length;

            if (this._worldState == null || (int)this._worldState.Length != length)
            {
                this._worldState         = new byte[length];
                this._previousWorldState = new byte[length];
                if (BearContext._worldStateChanges == null)
                {
                    BearContext._worldStateChanges = new Stack <WorldStateInfo> [length];
                    for (int i = 0; i < length; i++)
                    {
                        BearContext._worldStateChanges[i] = new Stack <WorldStateInfo>(5);
                    }
                }
            }
            this._decompositionScore = 2147483647;
            this.Body      = body;
            this.Domain    = domain;
            this.PlanState = PlanStateType.NoPlan;
            if (this.Memory == null || this.Memory.BearContext != this)
            {
                this.Memory = new BearMemory(this);
            }
        }