private List <List <double> > CreatePotentialDataList() { List <double> radiusValueList = CreateRadiusValueList(); Potential potential = CreatePotential(); return(CreatePotentialValueList(potential, radiusValueList)); }
public JudgeSummary(Potential overall_potential, StatFlags best_ivs, Potential best_potential, StatFlags zero_ivs) { OverallPotential = overall_potential; BestIvs = best_ivs; BestPotential = best_potential; ZeroIvs = zero_ivs; }
public void AreIsomorphic_OnIsomorphicQuiversButNonIsomorphicPotentials_SameGroupSignaturesAndSameCounts() { var potential1 = new Potential <char>(new DetachedCycle <char>(new Path <char>('B', 'C', 'E', 'B')), +1) .AddCycle(new DetachedCycle <char>(new Path <char>('A', 'B', 'C', 'A')), -1) .AddCycle(new DetachedCycle <char>(new Path <char>('B', 'D', 'E', 'B')), -1); var potential2 = new Potential <char>(new DetachedCycle <char>(new Path <char>('B', 'C', 'E', 'B')), +1) .AddCycle(new DetachedCycle <char>(new Path <char>('A', 'B', 'C', 'A')), -1) .AddCycle(new DetachedCycle <char>(new Path <char>('C', 'E', 'F', 'C')), -1); var qp1 = new QuiverWithPotential <char>(potential1); var vertices2 = new char[] { 'A', 'B', 'C', 'D', 'E', 'F' }; var arrows2 = new Arrow <char>[] { new Arrow <char>('A', 'B'), new Arrow <char>('B', 'C'), new Arrow <char>('B', 'D'), new Arrow <char>('C', 'A'), new Arrow <char>('C', 'E'), new Arrow <char>('D', 'E'), new Arrow <char>('E', 'B'), new Arrow <char>('E', 'F'), new Arrow <char>('F', 'C'), }; var quiver2 = new Quiver <char>(vertices2, arrows2); var qp2 = new QuiverWithPotential <char>(quiver2, potential2); var checker = new QPIsomorphismChecker(); Assert.That(checker.AreIsomorphic(qp1, qp2), Is.False); }
public void Analyze_DoesNotTryToUnionTheSameClasses_2() { var potential = new Potential <int>(new Dictionary <DetachedCycle <int>, int> { { new DetachedCycle <int>(0, 1, 2, 3, 4, 0), +1 }, { new DetachedCycle <int>(0, 5, 4, 0), -1 }, { new DetachedCycle <int>(3, 4, 6, 3), -1 }, { new DetachedCycle <int>(2, 3, 7, 2), -1 }, { new DetachedCycle <int>(1, 2, 8, 1), -1 }, { new DetachedCycle <int>(0, 1, 9, 0), -1 }, { new DetachedCycle <int>(0, 5, 10, 0), +1 }, { new DetachedCycle <int>(4, 6, 11, 4), +1 }, { new DetachedCycle <int>(3, 7, 12, 3), +1 }, { new DetachedCycle <int>(2, 8, 13, 2), +1 }, { new DetachedCycle <int>(1, 9, 14, 1), +1 }, { new DetachedCycle <int>(0, 15, 5, 10, 0), -1 }, { new DetachedCycle <int>(4, 16, 6, 11, 4), -1 }, { new DetachedCycle <int>(3, 17, 7, 12, 3), -1 }, { new DetachedCycle <int>(2, 18, 8, 13, 2), -1 }, { new DetachedCycle <int>(1, 19, 9, 14, 1), -1 } }); var qp = new QuiverWithPotential <int>(potential); var analyzer = CreateAnalyzer(); var settings = CreateSettings(maxPathLength: 20, EarlyTerminationConditions.None); Assert.That(() => analyzer.Analyze(qp, settings), Throws.Nothing); }
public void CheckPath() { Path.Clear(); Potential.Clear(); PawnAttackTiles.Clear(); switch (Type) { case "Pawn": Pawn(); break; case "Rook": Rook(); break; case "Knight": Knight(); break; case "Bishop": Bishop(); break; case "Queen": Queen(); break; case "King": King(); break; } }
// This will add the referenced potential to the database. public void AddPotential(Potential p) { // Add the potential to the database. context.Potentials.Add(p); // Save the changes. context.SaveChanges(); }
public ActionResult DeleteConfirmed(Guid id) { Potential potential = db.Potentials.Find(id); db.Potentials.Remove(potential); db.SaveChanges(); return(RedirectToAction("Index")); }
private static double GetAlphaEff( QQFreeState freeState ) { Potential potential = (Potential)(new PrivateObject(freeState)).GetField("Potential_fm"); return(potential.AlphaEff); }
public void Charge_Multiplication_Then_ResultShouldBeExpected() { var testee = new Charge(3, x => x.Coulombs); var potential = new Potential(4, x => x.Volts); var result = testee * potential; result.Should().Be(12, "J", UnitFormat.Default); }
public void Potential_Add_Then_ResultShouldBeExpected() { var lhs = new Potential(5, units => units.Milli.Volts); var rhs = new Potential(5000, units => units.Micro.Volts); var result = lhs + rhs; result.Should().Be(10, "mV", UnitFormat.Default); }
public void AreIsomorphic_SmallQP1() { var potential1 = new Potential <int>(new DetachedCycle <int>(new Path <int>(1, 2, 3, 1)), +1); var potential2 = new Potential <int>(new DetachedCycle <int>(new Path <int>(3, 2, 1, 3)), +1); var qp1 = new QuiverWithPotential <int>(potential1); var qp2 = new QuiverWithPotential <int>(potential2); var checker = new QPIsomorphismChecker(); Assert.That(checker.AreIsomorphic(qp1, qp2), Is.True); }
public void AddPotential() { var p = new Potential("Sarah", "Bob", 1, 23, 9, 1, 1, 1, 1, "Some details"); var mockDataStorage = new Mock <IDataStorage>(); var potentialRepo = new PotentialRepository(mockDataStorage.Object); var result = potentialRepo.AddPotential(p); result.Should().BeTrue(); }
/// <summary> /// 插入潜力作品表数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public int InsertPotential(Potential model) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("INSERT INTO [db_xingzhi].[dbo].[TB_Potential] ([PersonID],[PersonName],[WorkName],[WorkType],[dy],[zy],[WorkInfo],[Release],[ImgPath],[CreatedTime])VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')", model._PersonID, model._PersonName, model._WorkName, model._WorkType, model._dy, model._zy, model._WorkInfo, model._Release, model._ImgPath, model._CreatedTime); DbCommand cmd = db.GetSqlStringCommond(sb.ToString()); int a = db.ExecuteNonQuery(cmd); return(a); }
public ActionResult Edit([Bind(Include = "Deal_ID,Deal_Name,Deal_Owner_ID,Created_by_ID,Modified_by_ID,Created_Time,Modified_Time,Amount,Closing_Date,Account_ID,Type,Stage,Probability____,Sales_Cycle_Duration,Overall_Sales_Duration,Expected_Revenue,Contact_ID")] Potential potential) { if (ModelState.IsValid) { db.Entry(potential).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Account_ID = new SelectList(db.Accounts, "Account_ID", "Account_Name", potential.Account_ID); return(View(potential)); }
/// <summary> /// 修改一条潜力作品数据 /// </summary> /// <param name="id">主键ID</param> /// <returns></returns> public int UpdatePotentialByID(Potential model, int id) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(@"update TB_Potential set PersonID='{0}',PersonName='{1}',WorkName='{2}',WorkType='{3}',dy='{4}',zy='{5}', WorkInfo='{6}',Release='{7}',ImgPath='{8}',CreatedTime='{9}'where ID={10}", model._PersonID, model._PersonName, model._WorkName, model._WorkType, model._dy, model._zy, model._WorkInfo, model._Release, model._ImgPath, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), id); DbCommand cmd = db.GetSqlStringCommond(sb.ToString()); int a = db.ExecuteNonQuery(cmd); return(a); }
public void AreIsomorphic_SmallQP4() { var potential1 = new Potential <int>(new DetachedCycle <int>(new Path <int>(1, 2, 3, 1)), +1) .AddCycle(new DetachedCycle <int>(new Path <int>(4, 5, 6, 4)), +1); var potential2 = new Potential <int>(new DetachedCycle <int>(new Path <int>(3, 2, 1, 3)), +1); var qp1 = new QuiverWithPotential <int>(potential1); var quiver2 = qp1.Quiver; var qp2 = new QuiverWithPotential <int>(quiver2, potential2); var checker = new QPIsomorphismChecker(); Assert.That(checker.AreIsomorphic(qp2, qp1), Is.False); }
/* * * --------------------------------------------------------------------------------- * Null State * */ void nullState() { if (overlord == null) { if (debugMode) { Debug.Log("Turret: Overlord not set. Searching for overlord!"); } overlord = GameObject.FindWithTag("master").GetComponent <Overlord>(); } else { barrel.transform.rotation = Quaternion.Euler(270, 0, 0); Player[] ps = overlord.actorCore.playerSlice.players; if (ps == null) { if (debugMode) { Debug.Log("Turret says players are null!"); } } else { targetUpdateTime = 0.25f; targetingRange = 5.0f; //Remember that tiles are 2x2 coolingTime = 0.25f; //Because scaled time is slower than real time gracePeriod = 0.5f; //Because scaled time is slower than real time cooldownTime = 2.5f / camp.tile.value; persistTime = 0.1f; maxTurnSpeed = 35f * camp.tile.value; maxTurnSpeedWhenTargetting = 720f; maxTargetAhead = 2.5f; stats.attack = 15f * camp.tile.value; stats.projectileSpeed = 0.5f * camp.tile.value; stats.attackDelay = 0; potentials = new Potential[ps.GetLength(0)]; foreach (Player p in ps) { potentials[p.playerID - 1] = new Potential(); Potential currentPotential = potentials[p.playerID - 1]; currentPotential.player = p; currentPotential.distance = (p.transform.position - this.transform.position).sqrMagnitude; currentPotential.timeInRange = 0.0f; currentPotential.lastTimeSeen = -10.0f; } waitingState(); } } }
public void ElectricCurrent_Multiplication_When_RhsIsIsPotential_Then_ResultShouldBeExpected( double lhs, double rhs, double expectedValue, string expectedUnit) { var testee = new ElectricCurrent(lhs, x => x.Milli.Amperes); var potential = new Potential(rhs, x => x.Milli.Volts); var result = testee * potential; result.Should().Be(expectedValue, expectedUnit, UnitFormat.Default); }
// GET: CRM/Potentials/Details/5 public ActionResult Details(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Potential potential = db.Potentials.Find(id); if (potential == null) { return(HttpNotFound()); } return(View(potential)); }
// GET: CRM/Potentials/Edit/5 public ActionResult Edit(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Potential potential = db.Potentials.Find(id); if (potential == null) { return(HttpNotFound()); } ViewBag.Account_ID = new SelectList(db.Accounts, "Account_ID", "Account_Name", potential.Account_ID); return(View(potential)); }
public Equip(int itemId, long expiration, string owner, short flags, short slots, short level, Dictionary <EquipStat.Id, short> stats, short itemLevel, short itemExp, int vicious) { _itemId = itemId; _expiration = expiration; _owner = owner; _flags = flags; _slots = slots; _level = level; _stats = stats; _itemLevel = itemLevel; _itemExp = itemExp; _vicious = vicious; _potRank = Potential.POT_NONE; _quality = EquipQuality.CheckQuality(itemId, level > 0, stats); }
public override int GetHashCode() { var hashCode = 1284525823; hashCode = hashCode * -1521134295 + base.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Nationality); hashCode = hashCode * -1521134295 + Age.GetHashCode(); hashCode = hashCode * -1521134295 + Position.GetHashCode(); hashCode = hashCode * -1521134295 + Height.GetHashCode(); hashCode = hashCode * -1521134295 + Price.GetHashCode(); hashCode = hashCode * -1521134295 + Salary.GetHashCode(); hashCode = hashCode * -1521134295 + SignedAt.GetHashCode(); hashCode = hashCode * -1521134295 + Potential.GetHashCode(); hashCode = hashCode * -1521134295 + IsHome.GetHashCode(); return(hashCode); }
public AtomType(string InputLine) { string[] words = StringReader.TrimWords(InputLine.Split(StringReader.StdSeps)); Name = words[0]; //get the name of the potential string potname = StringReader.GetLineParameter_s(words, "potential"); if (!Program.myPotentialTypes.ContainsKey(potname)) { throw new Exception("ERROR! Potential type " + potname + " is not coded."); } Type pottype = Program.myPotentialTypes[potname]; Pot = (Potential)Activator.CreateInstance(pottype, new object[] { words }); Pot.Initialize(); }
public void RemovePotential() { var tempSQLiteDatabase = new SqliteDataStore(); var p = new Potential("Sarah", "Bob", 1, 23, 9, 1, 1, 1, 1, "Some details"); var mockDataStorage = new Mock <IDataStorage>(); var potentialRepo = new PotentialRepository(mockDataStorage.Object); potentialRepo.AddPotential(p); //We are making a change here to see if continous integration works on azure. var rp = potentialRepo.GetASpecificId(1); //var firstName = rp.FirstName; //var thisResult = potentialRepo.RemovePotentialById((int)rp); //Assert.AreEqual("Potential Removed", thisResult); Assert.AreEqual("Sarah", p.FirstName); }
public void TryExtractQP_WorksOnClockwiseCycle(int cycleLength) { const double Radius = 1000; var vertices = Enumerable.Range(1, cycleLength); var arrows = vertices.Select(k => new Arrow <int>(k, k.Modulo(cycleLength) + 1)); double baseAngle = 2 * Math.PI / cycleLength; var vertexPositions = vertices.ToDictionary(k => k, k => new Point((int)(Radius * Math.Cos(-k * baseAngle)), (int)Math.Round(Radius * Math.Sin(-k * baseAngle)))); var quiverInPlane = new QuiverInPlane <int>(vertices, arrows, vertexPositions); var extractor = CreateQPExtractor(); var result = extractor.TryExtractQP(quiverInPlane, out var qp); var expectedQuiver = new Quiver <int>(vertices, arrows); var expectedPotential = new Potential <int>(new DetachedCycle <int>(vertices.AppendElement(1)), +1); var expectedQP = new QuiverWithPotential <int>(expectedQuiver, expectedPotential); Assert.That(result, Is.EqualTo(QPExtractionResult.Success)); Assert.That(qp, Is.EqualTo(expectedQP)); }
public string CalculateGridRating() { var result = default(string); if (IsBothPotentialAndPerformanceRatingAvailable()) { var combined = string.Concat(Potential, Performance); if (Potential.Contains("New") || Performance.Contains("New")) { result = "New"; } else { result = this._ratingsDictionary[combined]; } } return(result); }
/// <summary> /// 获取潜力值 /// </summary> /// <param name="config"></param> /// <returns></returns> public Potential GetPotentialValue(ConfigPotentialEntity config) { Potential p = new Potential(); p.Idx = config.PotentialId; p.Level = config.Level; if (config.BuffType == 2) //百分比 { var buff = RandomHelper.GetInt32((int)(config.MinBuff * 100), (int)(config.MaxBuff * 100)); p.Buff = (decimal)buff / 100; } else { p.Buff = RandomHelper.GetInt32((int)config.MinBuff, (int)config.MaxBuff); } return(p); }
public void AreIsomorphic_OnTriangleQPs() { var potential1 = new Potential <char>(new DetachedCycle <char>(new Path <char>('B', 'C', 'E', 'B')), +1) .AddCycle(new DetachedCycle <char>(new Path <char>('A', 'B', 'C', 'A')), -1) .AddCycle(new DetachedCycle <char>(new Path <char>('B', 'D', 'E', 'B')), -1) .AddCycle(new DetachedCycle <char>(new Path <char>('C', 'E', 'F', 'C')), -1); var potential2 = new Potential <char>(new DetachedCycle <char>(new Path <char>('B', 'C', 'F', 'B')), +1) .AddCycle(new DetachedCycle <char>(new Path <char>('C', 'F', 'E', 'C')), -1) .AddCycle(new DetachedCycle <char>(new Path <char>('B', 'C', 'D', 'B')), -1) .AddCycle(new DetachedCycle <char>(new Path <char>('A', 'F', 'B', 'A')), -1); var qp1 = new QuiverWithPotential <char>(potential1); var qp2 = new QuiverWithPotential <char>(potential2); var checker = new QPIsomorphismChecker(); Assert.That(checker.AreIsomorphic(qp1, qp2), Is.True); }
/// <remarks>Like <see cref="TryExecuteRecipe(PotentialRecipe, int, out QuiverWithPotential{int})"/> /// but with a boolean parameter for throwing.</remarks> private bool InternalExecuteRecipe(PotentialRecipe recipe, int initialCycleNumArrows, out QuiverWithPotential <int> qp, bool shouldThrow) { if (recipe == null) { throw new ArgumentNullException(nameof(recipe)); } if (initialCycleNumArrows <= 0) { throw new ArgumentOutOfRangeException(nameof(initialCycleNumArrows)); } qp = null; var startCycle = Utility.MakeCycle(0, initialCycleNumArrows); var startArrows = startCycle.CanonicalPath.Arrows; var boundaryTuples = startArrows.Select(a => (a, BoundaryArrowOrientation.Right)); var state = new RecipeExecutorState { Potential = new Potential <int>(startCycle, +1), NextVertex = initialCycleNumArrows, Boundary = new CircularList <(Arrow <int>, BoundaryArrowOrientation)>(boundaryTuples), PotentiallyProblematicArrows = new HashSet <Arrow <int> >(), }; foreach (var instruction in recipe.Instructions) { if (shouldThrow) { state = instruction.Execute(state); } else if (!instruction.TryExecute(state, out state)) { return(false); } } qp = new QuiverWithPotential <int>(state.Potential); return(true); }
/// <summary> /// 提交事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { filePhoto.Reset(); Potential p = new Potential(); p._PersonID = this.txtPersonid.Text; p._PersonName = this.txtPerson.Text; p._WorkName = this.txtWorkName.Text; p._WorkType = this.ddlWorkType.SelectedValue; p._dy = this.txtDy.Text; p._zy = this.txtZy.Text; p._WorkInfo = this.txtWorkInfo.Text; p._Release = this.txtRelease.Text; p._ImgPath = this.imgPhoto.ImageUrl; p._CreatedTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); int flag = 0; int id = RequestHelper.GetRequestInt("id", 0); if (id > 0) { flag = operate.UpdatePotentialByID(p, id); } else { flag = operate.InsertPotential(p); } if (flag > 0) { PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); Alert.ShowInParent("保存成功"); } else { Alert.ShowInParent("保存失败"); } }
/// <summary> /// Parses the potential happiness from the specified value. /// </summary> /// <param name="value">The value to parse.</param> /// <returns>The <see cref="Potential"/> representation of <paramref name="value"/>.</returns> private static Potential ParsePotentialHappiness(string value) { string[] split = value.Split(' '); Potential result = new Potential() { Name = split.First(), AdjacentName = split.Last().TrimEnd('.'), }; result.Happiness = ParseInt32(split[3]); if (split[2] == "lose") { result.Happiness *= -1; } return result; }