예제 #1
0
 public void cf()
 {
     Pg(); //子类可以访问父类的保护成员
     Pj += 200;
     Console.WriteLine("Child.cf()");
     Console.WriteLine("Parent.Pj=" + Pj.ToString());
 }
 public void Action(Pj pj, Server server)
 {
     ScheduleManager.Schedule(ANIMATION_DURATION, () =>
     {
         pj.SpawnInAnEmptyPosition(server.world.maze);
         server.TeleportPj(pj);
     });
 }
예제 #3
0
 public void Action(Pj pj, Server server)
 {
     foreach (Pj otherPj in server.world.Pjs.Values)
     {
         if (otherPj.ID != pj.ID && !otherPj.Immune)
         {
             server.AddBuff((int)BuffTypes.RelojBuff, otherPj);
         }
     }
 }
예제 #4
0
        public void Action(Pj pj, Server server)
        {
            float   angle = pj.rotation - MathHelper.PiOver2;
            Vector2 opositeDirectionOfThePlayer = new Vector2((float)Math.Sin(angle), -(float)Math.Cos(angle));
            int     dropDistance = 30;
            int     x            = (int)(pj.x + dropDistance * opositeDirectionOfThePlayer.X);
            int     y            = (int)(pj.y + dropDistance * opositeDirectionOfThePlayer.Y);

            server.AddDrop((int)DropTypes.BananaDrop, x, y);
        }
예제 #5
0
 public void Action(Pj pj, Server server)
 {
     for (int i = 0; i < SPLASHES; i++)
     {
         float displacementAngle = rng.Next(360);
         int   x        = (int)(pj.x + DISPLACEMENT_RADIUS * Math.Cos(displacementAngle));
         int   y        = (int)(pj.y + DISPLACEMENT_RADIUS * Math.Sin(displacementAngle));
         float rotation = (float)(rng.NextDouble() * Math.PI * 2);
         float duration = SPLASH_BASE_DURATION + (float)rng.NextDouble() * SPLASH_EXTRA_MAX_DURATION;
         server.AddTintaSplash(x, y, rotation, duration);
     }
 }
예제 #6
0
        static public bool CalculatePdataAndSij(ref Sij sij, Pj pj, PAkjl pakjl, ref Pdata pdata)
        {
            bool isFinished = false;

            pdata = new Pdata(++pdata.Time, pdata.Value);
            sij   = new Sij(++sij.Time);
            double[,] numerator = new double[Variable.Sentences.Count, (int)Math.Pow(2, Variable.LabelArray.Length)];
            for (int i = 0; i < Variable.Sentences.Count; ++i)
            {
                for (int j = 0; j < Math.Pow(2, Variable.LabelArray.Length); ++j)
                {
                    numerator[i, j] = 1;
                }
            }
            foreach (Sentence sentence in Variable.Sentences)
            {
                for (int j = 0; j < Math.Pow(2, Variable.LabelArray.Length); ++j) //正确标签
                {
                    foreach (Annotator annotator in Variable.Annotators)          //人
                    {
                        foreach (Annotation annotation in Variable.Data[annotator][sentence])
                        {
                            numerator[sentence.ID, j] *= pakjl.Value[annotator][new Labelset(Variable.LabelArray, j)][new Labelset(Variable.LabelArray, annotation.IntLabel)];
                        }
                    }
                    numerator[sentence.ID, j] *= pj.Value[new Labelset(Variable.LabelArray, j)];
                }
            }
            double[] denominator = new double[Variable.Sentences.Count];
            for (int i = 0; i < Variable.Sentences.Count; ++i)
            {
                for (int q = 0; q < Math.Pow(2, Variable.LabelArray.Length); ++q)
                {
                    denominator[i] += numerator[i, q];
                }
            }
            //计算Pdata和Sij
            foreach (Sentence sentence in Variable.Sentences)
            {
                for (int j = 0; j < Math.Pow(2, Variable.LabelArray.Length); ++j)
                {
                    sij.Value[sentence][new Labelset(Variable.LabelArray, j)] = numerator[sentence.ID, j] / denominator[sentence.ID];
                }
                pdata.Value += -Math.Log10(denominator[sentence.ID]);
            }
            if (pdata.MondifiedValue == 0 || pdata.Time == 10)
            {
                isFinished = true;
            }
            //Variable.OutputFile.WriteLine(pdata.ToString());
            //Variable.OutputFile.WriteLine(sij.ToString(DependentVariable.NumberOfIntlabel));
            return(isFinished);
        }
예제 #7
0
 public RulesEngine(Condition condition)
 {
     Condition      = condition;
     _footware      = new Footware(condition);
     _pj            = new Pj(condition);
     _headwear      = new Headwear(condition);
     _socks         = new Socks(condition);
     _shirt         = new Shirt(condition);
     _jacket        = new Jacket(condition);
     _pants         = new Pants(condition);
     _leaveTheHouse = new LeaveTheHouse(condition);
 }
예제 #8
0
        public void Action(Pj pj, Server server)
        {
            List <int> buffsToBeRemoved = new List <int>();

            foreach (KeyValuePair <int, Buff> kvp in pj.Buffs)
            {
                if (kvp.Value.ShouldBeRemovedWhenPjGoesImmune())
                {
                    buffsToBeRemoved.Add(kvp.Key);
                }
            }
            foreach (int buffId in buffsToBeRemoved)
            {
                server.RemoveBuff(pj, buffId);
            }

            server.AddBuff((int)BuffTypes.ImmuneBuff, pj);
        }
예제 #9
0
 public InvisibleBuff(Pj pj) : base(DURATION)
 {
     this.pj = pj;
     this.Activate();
 }
예제 #10
0
 static SPDSVariable()
 {
     TrainingSij = new Sij(0);
     TrainingPj  = new Pj(0);
 }
예제 #11
0
 public ImmuneBuff(Pj pj) : base(DURATION)
 {
     this.pj = pj;
     this.Activate();
 }
예제 #12
0
 public SprintBuff(Pj pj) : base(DURATION)
 {
     this.pj = pj;
     this.Activate();
 }
예제 #13
0
 //计算Pj的后验概率
 static public IDictionary <Tuple <Labelset, Labelset>, double> CalculateConditionalPj(Pj pj, IDictionary <Tuple <Labelset, Labelset>, double> LabelsetFrequency)
 {
     return(calculateConditional(LabelsetFrequency, pj.Value, Variable.Sentences.Count));
 }
예제 #14
0
 public RelojBuff(Pj pj) : base(DURATION)
 {
     this.pj = pj;
     this.Activate();
 }
예제 #15
0
 public BananaStunBuff(Pj pj) : base(DURATION)
 {
     this.pj = pj;
     this.Activate();
 }
예제 #16
0
 static public IDictionary <Tuple <Labelset, Labelset>, double> CalculateIndependentConditionalPj(Pj pj, IDictionary <Label, IDictionary <Tuple <Labelset, Labelset>, double> > independentLabelsetPairFrequency)
 {
     return(calculateIndependentConditional(independentLabelsetPairFrequency, pj.Value, Variable.Sentences.Count));;
 }
예제 #17
0
 public void Action(Pj pj, Server server)
 {
     server.AddBuff((int)PowerUpTypes.SprintPowerUp, pj);
 }
예제 #18
0
 public void Action(Pj pj, Server server)
 {
     server.AddBuff((int)BuffTypes.InvisibleBuff, pj);
 }
 public TraverseWallsBuff(Pj pj) : base(DURATION)
 {
     this.pj = pj;
     this.Activate();
 }
예제 #20
0
 public void Action(Pj pj, Server server)
 {
     server.AddBuff((int)BuffTypes.TraverseWallsBuff, pj);
 }