private void button3_Click(object sender, EventArgs e) { HarfDegeri = 0; label1.Hide(); label2.Hide(); label3.Hide(); label4.Hide(); label5.Hide(); label6.Hide(); label7.Hide(); label8.Hide(); label9.Hide(); for (int i = 0; i <= 9; i++) { panel[i] = 2; } score1 = 0; score2 = 0; Berabere = 0; label13.Text = score1.ToString(); label14.Text = score2.ToString(); label15.Text = Berabere.ToString(); label1.ForeColor = Color.White; label2.ForeColor = Color.White; label3.ForeColor = Color.White; label4.ForeColor = Color.White; label5.ForeColor = Color.White; label6.ForeColor = Color.White; label7.ForeColor = Color.White; label8.ForeColor = Color.White; label9.ForeColor = Color.White; }
private void button3_Click(object sender, EventArgs e) { String pl1 = "Oyuncu", pl2 = "Bilgiseyar"; score1 = 0; score2 = 0; Berabere = 0; label13.Text = score1.ToString(); label14.Text = score2.ToString(); label15.Text = Berabere.ToString(); reset(); }
public void KazanananKontrol(int l, int m, int n) { if (HamleSayısı == 1) { turn = true; } if (HamleSayısı > 4) { if ((label[l, 0] + label[l, 1] + label[l, 2] == n * 3) || (label[0, m] + label[1, m] + label[2, m] == n * 3)) { HamleSayısı = n; } else { if ((label[0, 0] + label[1, 1] + label[2, 2] == n * 3) || (label[2, 0] + label[1, 1] + label[0, 2] == n * 3)) { HamleSayısı = n; } else { if (HamleSayısı == 9) { HamleSayısı = 0; } } } if (HamleSayısı == 1 || HamleSayısı == 0) { if (HamleSayısı == 1) { MessageBox.Show(pl1 + " Kazandı"); if (pl1 == "Bilgiseyar") { score1++; label13.Text = score1.ToString(); } else { score2++; label14.Text = score2.ToString(); } } if (HamleSayısı == 0) { MessageBox.Show("Beraberlik Kazandı"); Berabere++; label15.Text = Berabere.ToString(); } reset(); if (pl1 == "Bilgiseyar") { turn = false; OyunaBasla(HarfDegeri); } else { turn = false; } } else if (HamleSayısı == 4) { MessageBox.Show(pl2 + " Kazandı"); if (pl2 == "Bilgiseyar") { score1++; label13.Text = score1.ToString(); } else { score2++; label14.Text = score2.ToString(); } String temp = pl1; pl1 = pl2; pl2 = temp; reset(); if (pl1 == "Bilgiseyar") { OyunaBasla(HarfDegeri); } else { turn = false; } } } }
public void KazananKontrol() { if (panel[1] == panel[2] && panel[1] == panel[3] && panel[1] == 0) { label1.ForeColor = Color.Maroon; label2.ForeColor = Color.Maroon; label3.ForeColor = Color.Maroon; MessageBox.Show(" 1. Oyuncu Kazandı"); score1++; label13.Text = score1.ToString(); Continue(); } if (panel[1] == panel[4] && panel[1] == panel[7] && panel[1] == 0) { label1.ForeColor = Color.Maroon; label4.ForeColor = Color.Maroon; label7.ForeColor = Color.Maroon; MessageBox.Show(" 1. Oyuncu Kazandı"); score1++; label13.Text = score1.ToString(); Continue(); } if (panel[1] == panel[5] && panel[1] == panel[9] && panel[1] == 0) { label1.ForeColor = Color.Maroon; label5.ForeColor = Color.Maroon; label9.ForeColor = Color.Maroon; MessageBox.Show(" 1. Oyuncu Kazandı"); score1++; label13.Text = score1.ToString(); Continue(); } if (panel[4] == panel[5] && panel[4] == panel[6] && panel[4] == 0) { label5.ForeColor = Color.Maroon; label4.ForeColor = Color.Maroon; label6.ForeColor = Color.Maroon; MessageBox.Show(" 1. Oyuncu Kazandı"); score1++; label13.Text = score1.ToString(); Continue(); } if (panel[2] == panel[5] && panel[2] == panel[8] && panel[2] == 0) { label2.ForeColor = Color.Maroon; label5.ForeColor = Color.Maroon; label8.ForeColor = Color.Maroon; MessageBox.Show(" 1. Oyuncu Kazandı"); score1++; label13.Text = score1.ToString(); Continue(); } if (panel[3] == panel[5] && panel[3] == panel[7] && panel[3] == 0) { label3.ForeColor = Color.Maroon; label5.ForeColor = Color.Maroon; label7.ForeColor = Color.Maroon; MessageBox.Show(" 1. Oyuncu Kazandı"); score1++; label13.Text = score1.ToString(); Continue(); } if (panel[7] == panel[8] && panel[7] == panel[9] && panel[7] == 0) { label8.ForeColor = Color.Maroon; label9.ForeColor = Color.Maroon; label7.ForeColor = Color.Maroon; MessageBox.Show(" 1. Oyuncu Kazandı"); score1++; label13.Text = score1.ToString(); Continue(); } if (panel[3] == panel[6] && panel[3] == panel[9] && panel[3] == 0) { label3.ForeColor = Color.Maroon; label6.ForeColor = Color.Maroon; label9.ForeColor = Color.Maroon; MessageBox.Show(" 1. Oyuncu Kazandı"); score1++; label13.Text = score1.ToString(); Continue(); } if (panel[1] == panel[2] && panel[1] == panel[3] && panel[1] == 1) { label1.ForeColor = Color.Maroon; label2.ForeColor = Color.Maroon; label3.ForeColor = Color.Maroon; MessageBox.Show(" 2. Oyuncu Kazandı"); score2++; label14.Text = score2.ToString(); Continue(); } if (panel[1] == panel[4] && panel[1] == panel[7] && panel[1] == 1) { label1.ForeColor = Color.Maroon; label4.ForeColor = Color.Maroon; label7.ForeColor = Color.Maroon; MessageBox.Show(" 2. Oyuncu Kazandı"); score2++; label14.Text = score2.ToString(); Continue(); } if (panel[1] == panel[5] && panel[1] == panel[9] && panel[1] == 1) { label1.ForeColor = Color.Maroon; label5.ForeColor = Color.Maroon; label9.ForeColor = Color.Maroon; MessageBox.Show(" 2. Oyuncu Kazandı"); score2++; label14.Text = score2.ToString(); Continue(); } if (panel[4] == panel[5] && panel[4] == panel[6] && panel[4] == 1) { label5.ForeColor = Color.Maroon; label4.ForeColor = Color.Maroon; label6.ForeColor = Color.Maroon; MessageBox.Show(" 2. Oyuncu Kazandı"); score2++; label14.Text = score2.ToString(); Continue(); } if (panel[2] == panel[5] && panel[2] == panel[8] && panel[2] == 1) { label2.ForeColor = Color.Maroon; label5.ForeColor = Color.Maroon; label8.ForeColor = Color.Maroon; MessageBox.Show(" 2. Oyuncu Kazandı"); score2++; label14.Text = score2.ToString(); Continue(); } if (panel[3] == panel[5] && panel[3] == panel[7] && panel[3] == 1) { label3.ForeColor = Color.Maroon; label5.ForeColor = Color.Maroon; label7.ForeColor = Color.Maroon; MessageBox.Show(" 2. Oyuncu Kazandı"); score2++; label14.Text = score2.ToString(); Continue(); } if (panel[7] == panel[8] && panel[7] == panel[9] && panel[7] == 1) { label7.ForeColor = Color.Maroon; label9.ForeColor = Color.Maroon; label8.ForeColor = Color.Maroon; MessageBox.Show(" 2. Oyuncu Kazandı"); score2++; label14.Text = score2.ToString(); Continue(); } if (panel[3] == panel[6] && panel[3] == panel[9] && panel[3] == 1) { label3.ForeColor = Color.Maroon; label6.ForeColor = Color.Maroon; label9.ForeColor = Color.Maroon; MessageBox.Show(" 2. Oyuncu Kazandı"); score2++; label14.Text = score2.ToString(); Continue(); } else { if (panel[1] != 2 && panel[2] != 2 && panel[3] != 2 && panel[4] != 2 && panel[5] != 2 && panel[6] != 2 && panel[7] != 2 && panel[8] != 2 && panel[9] != 2) { MessageBox.Show(" Beraberlik Kazandı"); Berabere++; label15.Text = Berabere.ToString(); Continue(); } } }