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); }); }
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); } } }
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); }
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); } }
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); }
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); }
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); }
public InvisibleBuff(Pj pj) : base(DURATION) { this.pj = pj; this.Activate(); }
static SPDSVariable() { TrainingSij = new Sij(0); TrainingPj = new Pj(0); }
public ImmuneBuff(Pj pj) : base(DURATION) { this.pj = pj; this.Activate(); }
public SprintBuff(Pj pj) : base(DURATION) { this.pj = pj; this.Activate(); }
//计算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)); }
public RelojBuff(Pj pj) : base(DURATION) { this.pj = pj; this.Activate(); }
public BananaStunBuff(Pj pj) : base(DURATION) { this.pj = pj; this.Activate(); }
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));; }
public void Action(Pj pj, Server server) { server.AddBuff((int)PowerUpTypes.SprintPowerUp, pj); }
public void Action(Pj pj, Server server) { server.AddBuff((int)BuffTypes.InvisibleBuff, pj); }
public TraverseWallsBuff(Pj pj) : base(DURATION) { this.pj = pj; this.Activate(); }
public void Action(Pj pj, Server server) { server.AddBuff((int)BuffTypes.TraverseWallsBuff, pj); }