Buradan indirebilirsiniz
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 WindowsFormsApplication11 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } Button btn,btn1; int puan = 10; private void dogrumu(Button parButton) { if (btn1 != null) { btn.Text = "#"; btn1.Text = "#"; btn = null; btn1 = null; if(puan!=0) puan = puan - 1; } if (btn == null || btn==parButton) { btn = parButton; parButton.Text = parButton.Tag.ToString(); } else { parButton.Text = parButton.Tag.ToString(); if (parButton.Text == btn.Text) { btn.Enabled = false; parButton.Enabled = false; btn1 = null; btn = null; label2.Text = Convert.ToString(puan + Convert.ToInt32(label2.Text)); puan = 10; } else { parButton.Text = parButton.Tag.ToString(); btn1 = parButton; } } } private void button1_Click(object sender, EventArgs e) { dogrumu(button1); } private void button7_Click(object sender, EventArgs e) { dogrumu(button7); } private void button2_Click(object sender, EventArgs e) { dogrumu(button2); } private void button8_Click(object sender, EventArgs e) { dogrumu(button8); } private void button3_Click(object sender, EventArgs e) { dogrumu(button3); } private void button4_Click(object sender, EventArgs e) { dogrumu(button4); } private void button5_Click(object sender, EventArgs e) { dogrumu(button5); } private void button6_Click(object sender, EventArgs e) { dogrumu(button6); } private void button9_Click(object sender, EventArgs e) { dogrumu(button9); } private void button12_Click(object sender, EventArgs e) { dogrumu(button12); } private void button11_Click(object sender, EventArgs e) { dogrumu(button11); } private void button10_Click(object sender, EventArgs e) { dogrumu(button10); } private void Form1_Load(object sender, EventArgs e) { } private void button16_Click(object sender, EventArgs e) { } private void Form1_Load_1(object sender, EventArgs e) { int[] sayi = new int[16]; Random r = new Random(); int sayac = 0; int rastgele = 0; while (sayac < 16) { rastgele = r.Next(1, 17); if (Array.IndexOf(sayi, rastgele) == -1) { sayi[sayac++] = rastgele; } } for (int i = 0; i < 16; i++) { if (sayi[i] > sayi[i] = sayi[i] - 8; } int sayim = 0; foreach (Control c in this.Controls) { if (c is Button) { ((Button)c).Tag = sayi[sayim].ToString(); sayim++; } } } private void button13_Click(object sender, EventArgs e) { dogrumu(button13); } private void button14_Click(object sender, EventArgs e) { dogrumu(button14); } private void button15_Click(object sender, EventArgs e) { dogrumu(button15); } private void button16_Click_1(object sender, EventArgs e) { dogrumu(button16); } private void label3_Click(object sender, EventArgs e) { int[] sayi = new int[16]; Random r = new Random(); int sayac = 0; int rastgele = 0; while (sayac < 16) { rastgele = r.Next(1, 17); if (Array.IndexOf(sayi, rastgele) == -1) { sayi[sayac++] = rastgele; } } for (int i = 0; i < 16; i++) { if (sayi[i] > sayi[i] = sayi[i] - 8; } int sayim = 0; foreach (Control c in this.Controls) { if (c is Button) { ((Button)c).Tag = sayi[sayim].ToString(); ((Button)c).Text = "#"; ((Button)c).Enabled = true; sayim++; } } label2.Text = "0"; puan = 10; } } }