public void TasYaz(Tas t) { Console.WriteLine("<Tas:{0} />", t.Numara); Console.WriteLine("<AltTaslar>"); UstNumarasi_X_OlanlariYerlestir(t.Numara); Console.WriteLine("</AltTaslar>"); }
protected override void Update(GameTime gameTime) { Tas.Update(); double millis = (gameTime.TotalGameTime - LastGameTime).TotalMilliseconds; LastGameTime = gameTime.TotalGameTime; TrueEllapse = TimeSpan.Zero; if (Tas.PlaySpeed <= 0) { if (Tas.ForceFrame) { Tas.ForceFrame = false; TrueUpdate(); } } else { AccumulatedTime += TimeSpan.FromMilliseconds(millis * Tas.PlaySpeed); while (AccumulatedTime >= TargetElapsedTime) { AccumulatedTime -= TargetElapsedTime; TrueUpdate(); if (Tas.ForceFrame) { Tas.ForceFrame = false; AccumulatedTime = TimeSpan.Zero; break; } } } }
void TasOlustur() { for (int i = 0; i < 8; i++) { for (int j = 1; j <= 13; j++) { Tas tas = new Tas { sayi = j, renk = renkler[i / 2] }; tasOlusturmaYeri++; okeyTaslari[tasOlusturmaYeri] = tas; } } tasOlusturmaYeri++; okeyTaslari[tasOlusturmaYeri] = new Tas(); okeyTaslari[tasOlusturmaYeri].isSahteOkey = true; tasOlusturmaYeri++; okeyTaslari[tasOlusturmaYeri] = new Tas(); okeyTaslari[tasOlusturmaYeri].isSahteOkey = true; }
private void TrueUpdate() { Tas.PreFrame(); TrueTime += TargetElapsedTime; TrueEllapse += TargetElapsedTime; orig_Update(new GameTime(TrueTime, TargetTimeStep));//yes this is a different value Tas.PostFrame(); }
void TaslariKaristir() { for (int i = 0; i < okeyTaslari.Length; i++) { Tas temp = okeyTaslari[i]; int randomNumber = Random.Range(i, okeyTaslari.Length); okeyTaslari[i] = okeyTaslari[randomNumber]; okeyTaslari[randomNumber] = temp; } }
protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.Entity <ProjectEntity>(pro => { pro.HasMany(p => p.Tasks).WithOne(t => t.Project).OnDelete(DeleteBehavior.Cascade); }); modelBuilder.Entity <TaskEntity>(Tas => { Tas.HasOne(d => d.Project).WithMany(c => c.Tasks).OnDelete(DeleteBehavior.Cascade); }); }
public void IstakayaDiz() { Array.Sort(playerTaslari, delegate(Tas tas1, Tas tas2) { return(tas1.sayi.CompareTo(tas2.sayi)); }); for (int i = 0; i < playerTaslari.Length; i++) { Tas tas_m = Instantiate(tas, transform.position, Quaternion.identity) as Tas; tas_m.transform.SetParent(gameObject.transform); tas_m.sayi = playerTaslari[i].sayi; tas_m.renk = playerTaslari[i].renk; tas_m.isGosterge = playerTaslari[i].isGosterge; tas_m.isOkey = playerTaslari[i].isOkey; tas_m.isSahteOkey = playerTaslari[i].isSahteOkey; } }
private void TasEkle(Konum k, Tas t) { ElemanBul(k).Tas = t; }
protected override void Draw(GameTime gameTime) { orig_Draw(new GameTime(TrueTime, TrueEllapse)); TrueEllapse = TimeSpan.Zero; Tas.Draw(); }
protected override void Initialize() { orig_Initialize(); Window.Title = "FEZ TAS"; Tas.Initialize(this); }
private void ProsesButton_Click(object sender, EventArgs e) { hasilGridView.ColumnCount = 7; hasilGridView.Columns[0].HeaderText = "Iterasi"; hasilGridView.Columns[1].HeaderText = "Berat"; hasilGridView.Columns[2].HeaderText = "Profit"; hasilGridView.Columns[3].HeaderText = "Cf"; hasilGridView.Columns[4].HeaderText = "Restart"; hasilGridView.Columns[5].HeaderText = "srb"; hasilGridView.Columns[6].HeaderText = "sgb"; //hasilGridView.RowCount = 100; int jumlahBarang = barangGridView.RowCount - 1; Barang[] barangArray = new Barang[jumlahBarang]; for (int i = 0; i < barangArray.Length; i++) { barangArray[i] = new Barang(Convert.ToString(barangGridView[0, i].Value), Convert.ToDouble(barangGridView[1, i].Value), Convert.ToDouble(barangGridView[2, i].Value)); } int jumlahTas = tasGridView.RowCount - 1; Tas[] tasArray = new Tas[jumlahTas]; for (int i = 0; i < jumlahTas; i++) { tasArray[i] = new Tas(Convert.ToString(tasGridView[0, i].Value), Convert.ToDouble(tasGridView[1, i].Value), jumlahBarang); } Array.Sort(barangArray); int jumlahSemut = Int32.Parse(jumlahSemutInput.Text); double[,] pheromone = new double[jumlahTas, jumlahBarang]; for (int i = 0; i < jumlahTas; i++) { for (int j = 0; j < jumlahBarang; j++) { pheromone[i, j] = 0.5; } } int jumlahIterasi = Int32.Parse(jumlahIterasiInput.Text); double evaporasi = Double.Parse(evaporasiInput.Text); bool restartPheromone = true; Iterasi[] iterasi = new Iterasi[jumlahIterasi]; for (int it = 0; it < iterasi.Length; it++) { iterasi[it] = new Iterasi(pheromone, evaporasi); Semut[] semutArray = new Semut[jumlahSemut]; Random random = new Random(); for (int i = 0; i < semutArray.Length; i++) { Tas[] tasArray1 = new Tas[jumlahTas]; for (int j = 0; j < jumlahTas; j++) { tasArray1[j] = new Tas(tasArray[j].namaTas, tasArray[j].kapasitasTas, jumlahBarang); } semutArray[i] = new Semut(tasArray1, barangArray, random); } for (int i = 0; i < semutArray.Length; i++) { semutArray[i].randomSolusiAwal(pheromone); } double profitMax = 0, tempMax; int semutMax = 0; for (int i = 0; i < semutArray.Length; i++) { tempMax = semutArray[i].repairOperator(); if (tempMax > profitMax) { profitMax = tempMax; semutMax = i; } } iterasi[it].sib = semutArray[semutMax]; if (it == 0) { iterasi[it].sgb = semutArray[semutMax]; } else { if (semutArray[semutMax].totalProfitSemut >= iterasi[it - 1].sgb.totalProfitSemut) { iterasi[it].sgb = semutArray[semutMax]; indexSgb = it; } else { iterasi[it].sgb = iterasi[it - 1].sgb; } } if (restartPheromone) { iterasi[it].srb = semutArray[semutMax]; indexRestart.Add(it); indexSrb.Add(it); restartPheromone = false; pheromone = iterasi[it].hitungPheromoneUpdate(restartPheromone); } else { if (semutArray[semutMax].totalProfitSemut >= iterasi[it - 1].srb.totalProfitSemut) { iterasi[it].srb = semutArray[semutMax]; indexSrb[indexSrb.Count - 1] = it; } else { iterasi[it].srb = iterasi[it - 1].srb; } double cf = iterasi[it].hitungCf(); if (cf >= 0.8) { restartPheromone = true; } pheromone = iterasi[it].hitungPheromoneUpdate(restartPheromone); } tampilkanHasil(iterasi[it], it); //detailIterasi(semutArray, it, semutMax, iterasi[it]); } updateCheck(); }