/*Conditional*/ public int AddBasicAI(int num, int innerRange, int outerRange, int centerX, int centerY, RelationEnum relation, TeamRole teamRole, int[] teamMember) { int rval = -1;//return the first pilot index Random random = new Random(); for (int i = 0; i < num; i++) { Vector3 location = game.utilities.RandomRingArea(innerRange, outerRange) + new Vector3(centerX, centerY, 0); Pilot newAI = new AIBasic1(game); newAI.Initialize(teamRole, teamMember); newAI.AddAircraft(new AircraftXwing(game), location, relation, pilots); if (rval == -1) { rval = newAI.PilotIndex; } } //game.uICombat.controlInformation.AddText("Basic AI added!", Color.White); return(rval); }
private void pictureBox1_Click(object sender, EventArgs eventargs) { MouseEventArgs e = (MouseEventArgs)eventargs; if (e.Button == MouseButtons.Left) { if (stripChoice == ToolStripChoice.DrawFigure) { Figure fig = collection.GetExtendingFigure(); fig.AddPoint(new Vertice(e.X, e.Y)); } if (stripChoice == ToolStripChoice.AddPoint) { Edge edge = collection.GetEdgeFromPoint(new Vertice(e.X, e.Y)); if (edge != null) { Figure fig = collection.GetFigure(edge); fig.AddPointOnEdge(edge); } } if (stripChoice == ToolStripChoice.RemovePoint) { Vertice point = collection.GetPoint(new Vertice(e.X, e.Y)); if (point != null) { Figure fig = collection.GetFigure(point); fig.RemovePoint(point); } } if (stripChoice == ToolStripChoice.RemoveFigure) { Figure figure = collection.GetFigureFromClickOnBorder(new Vertice(e.X, e.Y)); collection.figures.Remove(figure); pictureBox1.Invalidate(); } if (stripChoice == ToolStripChoice.AddRelation) { Edge edge = collection.GetEdgeFromPoint(new Vertice(e.X, e.Y)); if (edge != null) { Figure fig = collection.GetFigure(edge); Edge edge1 = fig.GetSelectedEdge(); if (edge1 != null) { var formPopup = new RelationPopup(); formPopup.ShowDialog(this); RelationEnum relation = formPopup.GetChoosenRelation(); if (relation != RelationEnum.None) { fig.AddRelation(edge, edge1, relation, this); collection.RemoveSelection(); } } else { collection.RemoveSelection(); edge.SetSelected(); } } } if (stripChoice == ToolStripChoice.RemoveRelation) { Edge edge = collection.GetEdgeFromPoint(new Vertice(e.X, e.Y)); if (edge != null) { Figure fig = collection.GetFigure(edge); fig.RemoveRelation(edge); } } } }
/// <summary> /// Returns <c>true</c> if the statistical strength result is greater than or equal to the p parameter with the specified statistical significance (alpha). /// </summary> /// <returns><c>true</c> if if the statistical strength result is greater than or equal to the p parameter with the specified statistical significance (alpha).</returns> /// <remarks> /// <para>It computes the following condition:</para> /// <para><c>Sum[i = a..x] x! / (i! * (x - i)!) * p^i * (1 - p)^(x - i) <= (or >=) alpha</c>, /// where <c>x = (a + b + c)</c>.</para> /// <para>lower ~ relation == LessThanOrEqual</para> /// <para>upper ~ relation == GreaterThanOrEqual</para> /// </remarks> public bool DoubleCriticalImplicationValidity(double p, double alpha, RelationEnum relation) { return Compare(DoubleCriticalImplicationSumMinusAlpha(p, alpha), relation, 0); }
/// <summary> /// Returns <c>true</c> if the statistical strength result is greater than or equal to the p parameter with the specified statistical significance (alpha). /// </summary> /// <returns><c>true</c> if if the statistical strength result is greater than or equal to the p parameter with the specified statistical significance (alpha).</returns> /// <remarks> /// <para>It computes the following condition:</para> /// <para><c>Sum[i = a..n] n! / (i! * (n - i)!) * p^i * (1 - p)^(n - i) <= (or >=) alpha</c>.</para> /// <para>lower ~ relation == LessThanOrEqual</para> /// <para>upper ~ relation == GreaterThanOrEqual</para> /// </remarks> public bool CriticalEquivalenceValidity(double p, double alpha, RelationEnum relation) { return Compare(CriticalEquivalenceSumMinusAlpha(p, alpha), relation, 0); }
/// <summary> /// 增加条件 /// </summary> /// <param name="filedName"></param> /// <param name="value"></param> /// <param name="value1"></param> /// <param name="condition"></param> /// <returns></returns> public DataBaseAction SqlWhere(string filedName, object value, object value1, ConditionEnum condition, RelationEnum relation) { if (!AppCons.IsParmes || relation == RelationEnum.In) { QueryField wherestr = new QueryField() { FiledName = filedName, Value = value, Value2 = value1, Condition = condition, Relation = relation }; wherestr.Value = GetValueRelation(value, relation); _whereStr.Append(Sqlcom.CreateWhere(wherestr)); } else { string parmeterName = DbHelper.GetParameterName(filedName); string parmeterName1 = string.Empty; if (value1 != null) { parmeterName1 = DbHelper.GetParameterName(filedName + "_1"); } QueryField wherestr = new QueryField() { FiledName = filedName, Value = parmeterName, Value2 = parmeterName1, Condition = condition, Relation = relation }; AddParmarms(parmeterName, Sqlcom.ConvertToDbType(value), GetValueRelation(value, relation)); if (value1 != null) { AddParmarms(parmeterName1, _dbHelper.ConvertToDbType(value1), value1); } _whereStr.Append(Sqlcom.CreateWhere(wherestr)); } return(this); }
/// <summary> /// 增加条件,特殊的类似 in,不等于,大于 /// </summary> /// <param name="filedName"></param> /// <param name="value"></param> /// <param name="relation"></param> /// <param name="condition"></param> /// <returns></returns> public DataBaseAction SqlWhere(string filedName, object value, ConditionEnum condition = ConditionEnum.And, RelationEnum relation = RelationEnum.Equal) { return(SqlWhere(filedName, value, null, condition, relation)); }