using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace Tas_Makas_Kagit { public partial class Form1 : Form { // Başlangıç skoru tanımlaması int sen = 0, program = 0; // Oyun içerisinde kullanacağımız mesajların tanımlanması string mesaj1 = "Taş makası kırar!"; string mesaj2 = "Makas kağıdı keser!"; string mesaj3 = "Kağıt taşı sarar!"; private int rastgeleSayiUret() { // 1 ya da 2 sayısının rastgele üretilmesi Random rnd = new Random(); int sayi = rnd.Next(1, 3); return sayi; } private void skorYaz() { // Skoru formda yazdırmak için kullandığımız metod label4.Text = Convert.ToString(sen) + " - " + Convert.ToString(program); } public Form1() { InitializeComponent(); // Başlangıç skorunun forma yazılması skorYaz(); } private void button5_Click(object sender, EventArgs e) { // Uygulamayı kapatır this.Close(); } private void button4_Click(object sender, EventArgs e) { MessageBox.Show("Bu program 8.2.2009 tarihinde, Oğuz ÖZKEROĞLU tarafından eğlence amaçlı yazılmıştır."); } private void button1_Click(object sender, EventArgs e) { panel1.Visible = false; panel2.Visible = false; panel3.Visible = false; int a = rastgeleSayiUret(); if (a == 1) { ++sen; panel2.Visible = true; label2.Text = mesaj1; skorYaz(); } else if (a == 2) { ++program; panel3.Visible = true; label2.Text = mesaj3; skorYaz(); } else return; } private void button2_Click(object sender, EventArgs e) { panel1.Visible = false; panel2.Visible = false; panel3.Visible = false; int b = rastgeleSayiUret(); if (b == 1) { ++sen; panel3.Visible = true; label2.Text = mesaj2; skorYaz(); } else if (b == 2) { ++program; panel1.Visible = true; label2.Text = mesaj1; skorYaz(); } else return; } private void button3_Click(object sender, EventArgs e) { panel1.Visible = false; panel2.Visible = false; panel3.Visible = false; int c = rastgeleSayiUret(); if (c == 1) { ++sen; panel1.Visible = true; label2.Text = mesaj3; skorYaz(); } else if (c == 2) { ++program; panel2.Visible = true; label2.Text = mesaj2; skorYaz(); } else return; } } }