XOX Oyunu C#

XOX Oyunu C#

xox

[code language=”csharp”]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 WindowsFormsApplication6
{
public partial class Form1 : Form
{
int x;
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
textBox1.Enabled = false;
button1.Enabled = false;

if (x == 0)
{
textBox1.Text = "X";
x = 1;
if ((textBox1.Text == "X") & (textBox2.Text == "X") & (textBox3.Text == "X"))
MessageBox.Show("X’LeR Kazandı TEBRİKLER");
if ((textBox1.Text == "X") & (textBox5.Text == "X") & (textBox9.Text == "X"))
MessageBox.Show("X’LeR Kazandı TEBRİKLER");
if ((textBox1.Text == "X") & (textBox4.Text == "X") & (textBox7.Text == "X"))
MessageBox.Show("X’LeR Kazandı TEBRİKLER");

}
else
{
textBox1.Text = "O";
x = 0;
if ((textBox1.Text == "O") & (textBox2.Text == "O") & (textBox3.Text == "O"))
MessageBox.Show("O’LaR Kazandı TEBRİKLER");
if ((textBox1.Text == "O") & (textBox5.Text == "O") & (textBox9.Text == "O"))
MessageBox.Show("O’LaR Kazandı TEBRİKLER");
if ((textBox1.Text == "O") & (textBox4.Text == "O") & (textBox7.Text == "O"))
MessageBox.Show("O’LaR Kazandı TEBRİKLER");

}

}

private void pictureBox1_Click(object sender, EventArgs e)
{

}

private void textBox2_TextChanged(object sender, EventArgs e)
{

}

private void button2_Click(object sender, EventArgs e)
{
textBox2.Enabled = false;
button2.Enabled = false;

if (x == 0)
{
textBox2.Text = "X";
x = 1;
if ((textBox1.Text == "X") & (textBox2.Text == "X") & (textBox3.Text == "X"))
MessageBox.Show("X’LeR Kazandı TEBRİKLER");
if ((textBox2.Text == "X") & (textBox5.Text == "X") & (textBox8.Text == "X"))
MessageBox.Show("X’LeR Kazandı TEBRİKLER");
}
else
{

textBox2.Text = "O";

x = 0;
if ((textBox1.Text == "O") & (textBox2.Text == "O") & (textBox3.Text == "O"))
MessageBox.Show("O’LaR Kazandı TEBRİKLER");
if ((textBox2.Text == "0") & (textBox5.Text == "O") & (textBox8.Text == "O"))
MessageBox.Show("O’LaR Kazandı TEBRİKLER");

}

}

private void button3_Click(object sender, EventArgs e)
{
textBox3.Enabled = false;
button3.Enabled = false;

if (x == 0)
{
textBox3.Text = "X";
x = 1;
if ((textBox1.Text == "X") & (textBox2.Text == "X") & (textBox3.Text == "X"))
MessageBox.Show("X’LeR Kazandı TEBRİKLER");
if ((textBox3.Text == "X") & (textBox6.Text == "X") & (textBox9.Text == "X"))
MessageBox.Show("X’LeR Kazandı TEBRİKLER");
if ((textBox3.Text == "X") & (textBox5.Text == "X") & (textBox7.Text == "X"))
MessageBox.Show("X’LeR Kazandı TEBRİKLER");
}
else
{
textBox3.Text = "O";
x = 0;
if ((textBox1.Text == "O") & (textBox2.Text == "O") & (textBox3.Text == "O"))
MessageBox.Show("O’LaR Kazandı TEBRİKLER");
if ((textBox3.Text == "O") & (textBox6.Text == "O") & (textBox9.Text == "O"))
MessageBox.Show("O’LaR Kazandı TEBRİKLER");
if ((textBox3.Text == "O") & (textBox5.Text == "O") & (textBox7.Text == "O"))
MessageBox.Show("O’LaR Kazandı TEBRİKLER");

}

}

private void button4_Click(object sender, EventArgs e)
{
textBox4.Enabled = false;
button4.Enabled = false;

if (x == 0)
{
textBox4.Text = "X";
x = 1;
if ((textBox4.Text == "X") & (textBox5.Text == "X") & (textBox6.Text == "X"))
MessageBox.Show("X’LeR Kazandı TEBRİKLER");
if ((textBox1.Text == "X") & (textBox4.Text == "X") & (textBox7.Text == "X"))
MessageBox.Show("X’LeR Kazandı TEBRİKLER");
}
else
{
textBox4.Text = "O";

x = 0;
if ((textBox4.Text == "O") & (textBox5.Text == "O") & (textBox6.Text == "O"))
MessageBox.Show("O’LaR Kazandı TEBRİKLER");
if ((textBox1.Text == "O") & (textBox4.Text == "O") & (textBox7.Text == "O"))
MessageBox.Show("O’LaR Kazandı TEBRİKLER");

}
}

private void button5_Click(object sender, EventArgs e)
{
textBox5.Enabled = false;
button5.Enabled = false;

if (x == 0)
{
textBox5.Text = "X";
x = 1;
if ((textBox4.Text == "X") & (textBox5.Text == "X") & (textBox6.Text == "X"))
MessageBox.Show("X’LeR Kazandı TEBRİKLER");
if ((textBox2.Text == "X") & (textBox5.Text == "X") & (textBox8.Text == "X"))
MessageBox.Show("X’LeR Kazandı TEBRİKLER");
}
else
{
textBox5.Text = "O";
x = 0;
if ((textBox4.Text == "O") & (textBox5.Text == "O") & (textBox6.Text == "O"))
MessageBox.Show("O’LaR Kazandı TEBRİKLER");
if ((textBox2.Text == "O") & (textBox5.Text == "O") & (textBox8.Text == "O"))
MessageBox.Show("O’LaR Kazandı TEBRİKLER");

}
}

private void button6_Click(object sender, EventArgs e)
{
textBox6.Enabled = false;
button6.Enabled = false;

if (x == 0)
{
textBox6.Text = "X";
x = 1;
if ((textBox4.Text == "X") & (textBox5.Text == "X") & (textBox6.Text == "X"))
MessageBox.Show("X’LeR Kazandı TEBRİKLER");
if ((textBox3.Text == "X") & (textBox6.Text == "X") & (textBox9.Text == "X"))
MessageBox.Show("X’LeR Kazandı TEBRİKLER");
}
else
{
textBox6.Text = "O";
x = 0;
if ((textBox4.Text == "O") & (textBox5.Text == "O") & (textBox6.Text == "O"))
MessageBox.Show("O’LaR Kazandı TEBRİKLER");
if ((textBox3.Text == "O") & (textBox6.Text == "O") & (textBox9.Text == "O"))
MessageBox.Show("O’LaR Kazandı TEBRİKLER");

}

}

private void button7_Click(object sender, EventArgs e)
{
textBox7.Enabled = false;
button7.Enabled = false;

if (x == 0)
{
textBox7.Text = "X";
x = 1;
if ((textBox7.Text == "X") & (textBox8.Text == "X") & (textBox9.Text == "X"))
MessageBox.Show("X’LeR Kazandı TEBRİKLER");
if ((textBox1.Text == "X") & (textBox4.Text == "X") & (textBox7.Text == "X"))
MessageBox.Show("X’LeR Kazandı TEBRİKLER");
if ((textBox7.Text == "X") & (textBox5.Text == "X") & (textBox3.Text == "X"))
MessageBox.Show("X’LeR Kazandı TEBRİKLER");
}
else
{
textBox7.Text = "O";
x = 0;
if ((textBox7.Text == "O") & (textBox8.Text == "O") & (textBox9.Text == "O"))
MessageBox.Show("O’LaR Kazandı TEBRİKLER");
if ((textBox1.Text == "O") & (textBox4.Text == "O") & (textBox7.Text == "O"))
MessageBox.Show("O’LaR Kazandı TEBRİKLER");
if ((textBox7.Text == "O") & (textBox5.Text == "O") & (textBox3.Text == "O"))
MessageBox.Show("O’LaR Kazandı TEBRİKLER");

}

}

private void button8_Click(object sender, EventArgs e)
{
textBox8.Enabled = false;
button8.Enabled = false;

if (x == 0)
{
textBox8.Text = "X";
x = 1;
if ((textBox7.Text == "X") & (textBox8.Text == "X") & (textBox9.Text == "X"))
MessageBox.Show("X’LeR Kazandı TEBRİKLER");
if ((textBox2.Text == "X") & (textBox5.Text == "X") & (textBox8.Text == "X"))
MessageBox.Show("X’LeR Kazandı TEBRİKLER");
}
else
{
textBox8.Text = "O";
x = 0;
if ((textBox7.Text == "O") & (textBox8.Text == "O") & (textBox9.Text == "O"))
MessageBox.Show("O’LaR Kazandı TEBRİKLER");
if ((textBox2.Text == "O") & (textBox5.Text == "O") & (textBox8.Text == "O"))
MessageBox.Show("O’LaR Kazandı TEBRİKLER");

}
}

private void button9_Click(object sender, EventArgs e)
{ textBox9.Enabled = false;
button9.Enabled = false;

if (x == 0)
{
textBox9.Text = "X";
x = 1;
if ((textBox7.Text == "X") & (textBox8.Text == "X") & (textBox9.Text == "X"))
MessageBox.Show("X’LeR Kazandı TEBRİKLER");
if ((textBox3.Text == "X") & (textBox6.Text == "X") & (textBox9.Text == "X"))
MessageBox.Show("X’LeR Kazandı TEBRİKLER");
if ((textBox1.Text == "X") & (textBox5.Text == "X") & (textBox9.Text == "X"))
MessageBox.Show("X’LeR Kazandı TEBRİKLER");
}
else
{
textBox9.Text = "O";
x = 0;
if ((textBox7.Text == "O") & (textBox8.Text == "O") & (textBox9.Text == "O"))
MessageBox.Show("O’LaR Kazandı TEBRİKLER");
if ((textBox3.Text == "O") & (textBox6.Text == "O") & (textBox9.Text == "O"))
MessageBox.Show("O’LaR Kazandı TEBRİKLER");
if ((textBox1.Text == "O") & (textBox5.Text == "O") & (textBox9.Text == "O"))
MessageBox.Show("O’LaR Kazandı TEBRİKLER");

}

}

private void Form1_Load(object sender, EventArgs e)
{
x = 0;

}

private void textBox8_TextChanged(object sender, EventArgs e)
{

}

private void textBox9_TextChanged(object sender, EventArgs e)
{

}

private void button10_Click(object sender, EventArgs e)
{
x = 0;
textBox1.Enabled = true;
textBox2.Enabled = true;
textBox3.Enabled = true;
textBox4.Enabled = true;
textBox5.Enabled = true;
textBox6.Enabled = true;
textBox7.Enabled = true;
textBox8.Enabled = true;
textBox9.Enabled = true;

button1.Enabled = true;
button2.Enabled = true;
button3.Enabled = true;
button4.Enabled = true;
button5.Enabled = true;
button6.Enabled = true;
button7.Enabled = true;
button8.Enabled = true;
button9.Enabled = true;

textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
textBox5.Text = "";
textBox6.Text = "";
textBox7.Text = "";
textBox8.Text = "";
textBox9.Text = "";

}
}
}
[/code]

Projeyi İNDİR

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir