static void TestNumericOperation() { Console.WriteLine(to_integer(ADD(TWO)(THREE))); Console.WriteLine(to_integer(SUB(THREE)(TWO))); Console.WriteLine(to_integer(MUL(TWO)(THREE))); Console.WriteLine(to_integer(MOD(TEN)(SIX))); Console.WriteLine(to_integer(POW(TEN)(TWO))); Console.WriteLine(to_boolean(IS_LESS_OR_EQUAL(FOUR)(THREE))); Console.WriteLine(to_boolean(IS_LESS_OR_EQUAL(THREE)(THREE))); Console.WriteLine(to_boolean(IS_LESS_OR_EQUAL(TWO)(THREE))); }
public void Start() { cli1_1.text = ""; cli2_1.text = ""; cli1_2.text = ""; cli2_2.text = ""; cli1_3.text = ""; cli2_3.text = ""; cli1_4.text = ""; cli2_4.text = ""; cli1_5.text = ""; cli2_5.text = ""; F1.SetActive(false); H1.SetActive(false); H11.SetActive(false); F2.SetActive(false); H2.SetActive(false); H22.SetActive(false); F3.SetActive(false); H3.SetActive(false); H33.SetActive(false); F4.SetActive(false); H4.SetActive(false); H44.SetActive(false); F5.SetActive(false); H5.SetActive(false); H55.SetActive(false); }
static void Main(string[] args) { F1 f1 = new F1(); f1.print(); F2 f2 = new F2(); f2.print(); F3 f3 = new F3(); f3.print(); F4 f4 = new F4(); f4.print(); F5 f5 = new F5(); f5.print(); F6 f6 = new F6(); f6.print(); F7 f7 = new F7(); f7.print(); F8 f8 = new F8(); f8.print(); F9 f9 = new F9(); f9.print(); }
private void IniciarBotao(object sender, EventArgs e) { Contador1.Text = "0"; Contador2.Text = "0"; Contador3.Text = "0"; Contador4.Text = "0"; Contador5.Text = "0"; for (int i = 0; i < Garfo.Count(); i++) { Garfo[i].EmUso = false; Filosofo[i].Pensando = false; } ControleThread = true; F1.Abort(); F2.Abort(); F3.Abort(); F4.Abort(); F5.Abort(); { F1 = new Thread(Filosofo1); F1.Start(); } { F3 = new Thread(Filosofo3); F3.Start(); } { F5 = new Thread(Filosofo5); F5.Start(); } { F2 = new Thread(Filosofo2); F2.Start(); } { F4 = new Thread(Filosofo4); F4.Start(); } iniciar.Enabled = false; Finalizar.Enabled = true; }
private void button1_Click(object sender, EventArgs e) { count_f1.Text = "0"; count_f2.Text = "0"; count_f3.Text = "0"; count_f4.Text = "0"; count_f5.Text = "0"; for (int i = 0; i < Garfo.Count(); i++) { Garfo[i].EstaEmUso = false; Filosofos[i].EstaPensando = false; } controlaThreads = true; F1.Abort(); F2.Abort(); F3.Abort(); F4.Abort(); F5.Abort(); { F1 = new Thread(Filosofo1); F1.Start(); } { F3 = new Thread(Filosofo3); F3.Start(); } { F5 = new Thread(Filosofo5); F5.Start(); } { F2 = new Thread(Filosofo2); F2.Start(); } { F4 = new Thread(Filosofo4); F4.Start(); } button1.Enabled = false; button2.Enabled = true; }
protected virtual void OnTrackingFound() { if (mTrackableBehaviour) { var rendererComponents = mTrackableBehaviour.GetComponentsInChildren <Renderer>(true); var colliderComponents = mTrackableBehaviour.GetComponentsInChildren <Collider>(true); var canvasComponents = mTrackableBehaviour.GetComponentsInChildren <Canvas>(true); // Enable rendering: foreach (var component in rendererComponents) { component.enabled = true; } // Enable colliders: foreach (var component in colliderComponents) { component.enabled = true; } // Enable canvas': foreach (var component in canvasComponents) { component.enabled = true; } } if (mTrackableBehaviour.TrackableName == "E1") { F1.SetActive(true); F2.SetActive(true); F3.SetActive(true); F4.SetActive(true); } }
public void NextMinute() { if (Concluded) { throw new Exception("Fight already finished"); } int round = ++Minute / 3; Block block = new Block(this); var blockOutcome = block.Run(); FightStats blockStats = new FightStats(blockOutcome.Punches, block.Knockdowns[0], block.Knockdowns[1]); FightStats[round].Append(blockStats); Punches[round].AddRange(blockOutcome.Punches); if (blockOutcome.Stoppage != -1) { TimeOfStoppage = blockOutcome.Stoppage + Minute * 60; EndOfRound(); return; } F1.RecoverFor(60); F2.RecoverFor(60); if ((1 + Minute) % 3 == 0) { EndOfRound(); } }
public void SetUp() { f = new F(); s = new S(); f2 = new F2(); s2 = new S2(); }
public IntegerPolynomial ToIntegerPolynomial() { IntegerPolynomial i = F1.Multiply(F2.ToIntegerPolynomial()); i.Add(F3.ToIntegerPolynomial()); return(i); }
void EneUse() { List <SkillManager.Skill> sk = new List <SkillManager.Skill>(); for (int i = 0; i < 3; i++) { sk.Add(SkillManager.S.Find(m => m.Name == Rounds[0].BindMember.Magics[i])); } sk = sk.FindAll(m => m.MP <= Rounds[0].BindMember.MP); lSk = sk[Random.Range(0, sk.Count)]; List <FighterController> lt; if (lSk.Strength >= 0) { lt = F1.FindAll(m => m.BindMember.HP > 0); } else { lt = F2.FindAll(m => m.BindMember.HP > 0); } tar = lt[Random.Range(0, lt.Count)]; Msg.Add(Rounds[0].BindMember.Name + "对" + tar.BindMember.Name + "使用了“" + lSk.Name + "”!"); Rounds[0].State = FighterController.BattleState.Magic; BattleStep = 3; ttick = 0; }
private void A1_Tick(object sender, EventArgs e) { PS3.Extension.WriteString(0x004eb39c, "^5S^7pec Ops ^5M^7od Menu ^5B^7y ^5M^7rNiato - ^5M^7ain ^5M^7enu\n\n^2-->^5Host Menu\nClient 1 Menu\nReset Menu\nAccount Menu\nTeleport Menu\nVision Menu\nCredit Menu\n\n\n^3Client 0 : ^2" + textBox1.Text + "\n^3Client 1 : ^2" + textBox2.Text + "^5"); if (Key_IsDown((uint)0) == "X") { HostMenuMain.Stop(); B1.Start(); } if (Key_IsDown((uint)0) == "R1") { HostMenuMain.Stop(); Client1.Start(); } if (Key_IsDown((uint)0) == "R3 + L3") { HostMenuMain.Stop(); B1.Stop(); B2.Stop(); B3.Stop(); B4.Stop(); B5.Stop(); Client1.Stop(); C1.Stop(); C2.Stop(); C3.Stop(); C4.Stop(); ResetMenu.Stop(); D1.Stop(); D2.Stop(); D3.Stop(); D4.Stop(); D5.Stop(); AccountMenu.Stop(); E1.Stop(); E2.Stop(); E3.Stop(); E4.Stop(); E5.Stop(); TeleportMenu.Stop(); F1.Stop(); F2.Stop(); F3.Stop(); F4.Stop(); VisionMenu.Stop(); G1.Stop(); G2.Stop(); G3.Stop(); G4.Stop(); G5.Stop(); G6.Stop(); OtherMenu.Stop(); H1.Stop(); PS3.Extension.WriteString(0x004eb39c, "^5Menu ^1Closed"); simpleButton2.Enabled = true; toolStripStatusLabel2.Text = "Not Started !"; toolStripStatusLabel2.ForeColor = Color.Red; simpleButton3.Enabled = false; } }
public IntegerPolynomial Multiply(IntegerPolynomial b) { IntegerPolynomial c = F1.Multiply(b); c = F2.Multiply(c); c.Add(F3.Multiply(b)); return(c); }
public static void Run() { Func <int, string> F1 = f1; F2 f2 = new F2(f1); // Func<int, string> f3 = f2; /*不能转换类型*/ // Func<int, string> f3 = f2.Invoke(10); /*????*/ }
public BigIntPolynomial Multiply(BigIntPolynomial b) { BigIntPolynomial c = F1.Multiply(b); c = F2.Multiply(c); c.Add(F3.Multiply(b)); return(c); }
public new static G2 d(F2 f, d.a a, d.a a2) { Point point = f.A(a); Point point2 = f.A(a2); int num; return(g2.A(point, point2, out num)); }
private void Filosofo2() { int tempo = sorteio.Next(3000, 6000); int TempoComendo = tempo / Controlatempo; while (ControleThread) { if (Garfo[0].EmUso == true || Garfo[1].EmUso == true) { this.BeginInvoke((MethodInvoker) delegate { ListaTela.Items.Add(Filosofo[1].Nome + " está pensando"); Status2.Text = "Pensando"; }); Thread.Sleep(2000); } else { Semaforo.WaitOne(); { Filosofo[1].Pensando = false; Garfo[0].EmUso = true; Garfo[1].EmUso = true; this.BeginInvoke((MethodInvoker) delegate { ListaTela.Items.Add(Filosofo[1].Nome + " está comendo"); Status2.Text = "Comendo"; ContadorFilosofo2++; Contador2.Text = ContadorFilosofo2.ToString(); }); Thread.Sleep(TempoComendo); this.BeginInvoke((MethodInvoker) delegate { ListaTela.Items.Add(Filosofo[1].Nome + " está pensando"); Status2.Text = "Pensando"; }); Filosofo[1].Pensando = true; Garfo[0].EmUso = false; Garfo[1].EmUso = false; } Semaforo.Release(); if (ContadorFilosofo2 == 5) { F2.Abort(); return; } } } }
static void DoFizzBuzz() { var f = MAP(RANGE(ONE)(HUNDRED))((F1)(n => IF(IS_ZERO(MOD(n)(FIFTEEN)))( FIZZBUZZ )(IF(IS_ZERO(MOD(n)(THREE)))( FIZZ )(IF(IS_ZERO(MOD(n)(FIVE)))( BUZZ )( MAP(TO_DIGITS(n))(NUM2CHAR) ))))); List <dynamic> string_list = to_list(f); string_list .ToList() .ForEach(s => print_string(s)); }
public new G2 d(F2 f, bool flag) { G2 g = global::D.A.d(f, this.d(), this.G()); if (flag && !g2.A(g)) { throw new l1(); } return(g); }
public override int GetHashCode() { const int prime = 31; int result = 1; result = prime * result + ((F1 == null) ? 0 : F1.GetHashCode()); result = prime * result + ((F2 == null) ? 0 : F2.GetHashCode()); result = prime * result + ((F3 == null) ? 0 : F3.GetHashCode()); return(result); }
public void Drot(DoubleMatrix1D x, DoubleMatrix1D y, double c, double s) { x.CheckSize(y); DoubleMatrix1D tmp = x.Copy(); x.Assign(F1.Mult(c)); x.Assign(y, F2.PlusMult(s)); y.Assign(F1.Mult(c)); y.Assign(tmp, F2.MinusMult(s)); }
protected virtual void Start() { mTrackableBehaviour = GetComponent <TrackableBehaviour>(); if (mTrackableBehaviour) { mTrackableBehaviour.RegisterTrackableEventHandler(this); } F1.SetActive(false); F2.SetActive(false); F3.SetActive(false); F4.SetActive(false); }
public void AdjustWeight() { Neuron winnerNeuron = F2.Neurons(winningNeuronPos); double[] intersect = FuzzyLogicUtil. Intersect(InputData, winnerNeuron.Weights.ToArray(), InputSize); // Modify new art a weight. for (int i = 0; i < this.InputSize; ++i) { winnerNeuron.Weights[i] = (Beta * intersect[i]) + ((1 - Beta) * winnerNeuron.Weights[i]); } }
public byte[] ToBinary() { byte[] f1Bin = F1.ToBinary(); byte[] f2Bin = F2.ToBinary(); byte[] f3Bin = F3.ToBinary(); byte[] all = new byte[f1Bin.Length + f2Bin.Length + f3Bin.Length]; Array.Copy(f1Bin, all, f1Bin.Length); Array.Copy(f2Bin, 0, all, f1Bin.Length, f2Bin.Length); Array.Copy(f3Bin, 0, all, (f1Bin.Length + f2Bin.Length), f3Bin.Length); return(all); }
public override bool Equals(object obj) { if (this == obj) { return(true); } if (obj == null) { return(false); } if (GetType() != obj.GetType()) { return(false); } ProductFormPolynomial other = (ProductFormPolynomial)obj; if (F1 == null) { if (other.F1 != null) { return(false); } } else if (!F1.Equals(other.F1)) { return(false); } if (F2 == null) { if (other.F2 != null) { return(false); } } else if (!F2.Equals(other.F2)) { return(false); } if (F3 == null) { if (other.F3 != null) { return(false); } } else if (!F3.Equals(other.F3)) { return(false); } return(true); }
public static void Main(string[] args) { Console.WriteLine(eval(x => x * x, 3)); //Private Anonym F2 f2 = (a, b, c) => (a + b + c); Console.WriteLine(f2(1, 2, 3)); F3 f3 = (x, a, b) => a <= x && b >= x; Console.WriteLine(f3(2, 1, 4)); Console.WriteLine(f3(1, 2, 3)); }
/// <summary> /// Solves <i>A*X = B</i>; returns <i>X</i>. /// </summary> /// <param name="B">A Matrix with as many rows as <i>A</i> and any number of columns.</param> /// <returns><i>X</i> so that <i>L*L'*X = B</i>.</returns> /// <exception cref="ArgumentException">if <i>B.Rows != A.Rows</i>.</exception> /// <exception cref="ArgumentException">if <i>!isSymmetricPositiveDefinite()</i>.</exception> private DoubleMatrix2D XXXsolveBuggy(DoubleMatrix2D B) { var F = Cern.Jet.Math.Functions.functions; if (B.Rows != n) { throw new ArgumentException(Cern.LocalizedResources.Instance().Exception_MatrixRowDimensionsMustAgree); } if (!isSymmetricPositiveDefinite) { throw new ArgumentException(Cern.LocalizedResources.Instance().Exception_MatrixIsNotSymmetricPositiveDefinite); } // Copy right hand side. DoubleMatrix2D X = B.Copy(); int nx = B.Columns; // precompute and cache some views to avoid regenerating them time and again DoubleMatrix1D[] Xrows = new DoubleMatrix1D[n]; for (int k = 0; k < n; k++) { Xrows[k] = X.ViewRow(k); } // Solve L*Y = B; for (int k = 0; k < n; k++) { for (int i = k + 1; i < n; i++) { // X[i,j] -= X[k,j]*L[i,k] Xrows[i].Assign(Xrows[k], F2.MinusMult(mL[i, k])); } Xrows[k].Assign(F1.Div(mL[k, k])); } // Solve L'*X = Y; for (int k = n - 1; k >= 0; k--) { Xrows[k].Assign(F1.Div(mL[k, k])); for (int i = 0; i < k; i++) { // X[i,j] -= X[k,j]*L[k,i] Xrows[i].Assign(Xrows[k], F2.MinusMult(mL[k, i])); } } return(X); }
private void Process() { bool isSuccess = false; while (!isSuccess) { int max = FuzzyLogicUtil.FindMax(ChoiceValues.ToArray()); double normOfSimilarity = 0; if (max != -1) { normOfSimilarity = F2.Neurons(max).Output(); } else { // Indicate that there is no eligible neuron // as winner, so create a dummy neuron in F2 layer. max = F2.AddNeuron(FuzzyLogicUtil.MakeDummyNeuron(InputSize)); ChoiceValues.Add( FuzzyLogicUtil.ChoicingValue(normOfInputs, 1.0 * InputSize, Choice)); normOfSimilarity = normOfInputs; } // Calculate and compare with vigilance winningVigilance = normOfSimilarity / normOfInputs; if (winningVigilance >= Vigilance) { winningNeuronPos = max; isSuccess = true; } else { ChoiceValues[max] = 0; } } // Adjust neuron weight automatically. if it is set. if (AutoAdjustWeight) { AdjustWeight(); } // Calculate output. output = FuzzyLogicUtil.Intersect(F2.Neurons(WinningNeuronPos).Weights.ToArray(), InputData, InputSize); }
private void simpleButton3_Click(object sender, EventArgs e) { MainMenu.Stop(); HostMenuMain.Stop(); B1.Stop(); B2.Stop(); B3.Stop(); B4.Stop(); B5.Stop(); Client1.Stop(); C1.Stop(); C2.Stop(); C3.Stop(); C4.Stop(); ResetMenu.Stop(); D1.Stop(); D2.Stop(); D3.Stop(); D4.Stop(); D5.Stop(); AccountMenu.Stop(); E1.Stop(); E2.Stop(); E3.Stop(); E4.Stop(); E5.Stop(); TeleportMenu.Stop(); F1.Stop(); F2.Stop(); F3.Stop(); F4.Stop(); VisionMenu.Stop(); G1.Stop(); G2.Stop(); G3.Stop(); G4.Stop(); G5.Stop(); G6.Stop(); OtherMenu.Stop(); H1.Stop(); PS3.Extension.WriteString(0x004eb39c, "^5Menu ^1Closed"); toolStripStatusLabel2.Text = "Not Started !"; toolStripStatusLabel2.ForeColor = Color.Red; simpleButton2.Enabled = true; simpleButton3.Enabled = false; }
protected void Button2_Click(object sender, EventArgs e) { F1.SaveAs(Request.PhysicalApplicationPath + "./Product_img/" + F1.FileName.ToString()); F2.SaveAs(Request.PhysicalApplicationPath + "./Product_img/" + F2.FileName.ToString()); F3.SaveAs(Request.PhysicalApplicationPath + "./Product_img/" + F3.FileName.ToString()); F4.SaveAs(Request.PhysicalApplicationPath + ".//" + F4.FileName.ToString()); a = "Product_img/" + F1.FileName.ToString(); b = "Product_img/" + F2.FileName.ToString(); c = "Product_img/" + F3.FileName.ToString(); d = "" + F4.FileName.ToString(); con.Open(); SqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "insert into laptop values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "','" + TextBox6.Text + "','" + TextBox7.Text + "','" + TextBox8.Text + "','" + TextBox9.Text + "','" + TextBox10.Text + "','" + TextBox11.Text + "','" + TextBox12.Text + "','" + b.ToString() + "','" + c.ToString() + "','" + a.ToString() + "','" + d.ToString() + "')"; cmd.ExecuteNonQuery(); con.Close(); }
public MyApp() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; graphics.PreferredBackBufferWidth = 480; graphics.PreferredBackBufferHeight = 800; InitScreenSize(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight); graphics.IsFullScreen = true; defaultUIViewport = new Core.Viewport(F2.Zero(), screenSize); defaultGameViewport = new Core.Viewport(F2.Zero(), screenSize); TargetElapsedTime = TimeSpan.FromTicks(166666); InactiveSleepTime = TimeSpan.FromSeconds(1); }