|
You last visited: Today at 16:29
Advertisement
Tic Tac Toe
Discussion on Tic Tac Toe within the .NET Languages forum part of the Coders Den category.
08/05/2013, 22:03
|
#1
|
elite*gold: 0
Join Date: Jun 2013
Posts: 8
Received Thanks: 0
|
Tic Tac Toe
Hey noobs,
here is my new Tic Tac Toe Game.
Downloads: ca. 50 !
Download:  VirusTotal:
I will add a Screen soon.
Have fun !
|
|
|
08/06/2013, 00:09
|
#2
|
elite*gold: 0
Join Date: Aug 2010
Posts: 880
Received Thanks: 113
|
Thats should be in the "Release" section. And you are the only "noob" here. Everybody can code a Tic Tac Toe
|
|
|
08/06/2013, 03:23
|
#3
|
elite*gold: 100
Join Date: Aug 2005
Posts: 595
Received Thanks: 208
|
Noobs .. realy man ?
Ok ..
1. Name your stuff properly
2.
Example Code:
Code:
private void Button6_Click(object sender, EventArgs e)
{
if (Operators.CompareString(this.Label2.Text, "X", false) == 0)
{
this.Button6.Text = "X";
this.Label2.Text = "0";
}
else
{
this.Button6.Text = "0";
this.Label2.Text = "X";
}
this.win();
this.Button6.Enabled = false;
}
private void Button7_Click(object sender, EventArgs e)
{
if (Operators.CompareString(this.Label2.Text, "X", false) == 0)
{
this.Button7.Text = "X";
this.Label2.Text = "0";
}
else
{
this.Button7.Text = "0";
this.Label2.Text = "X";
}
this.win();
this.Button7.Enabled = false;
etc...
}
The same code over and over again is bad style and a pain for maintaining, your Task, think about a way to solve this
3.
Example Code:
Code:
if (Operators.CompareString(this.Button1.Text, "X", false) == 0 & Operators.CompareString(this.Button2.Text, "X", false) == 0 & Operators.CompareString(this.Button3.Text, "X", false) == 0)
{
this.Label2.Text = "X wins";
this.Button1.Enabled = false;
this.Button2.Enabled = false;
this.Button3.Enabled = false;
this.Button4.Enabled = false;
this.Button5.Enabled = false;
this.Button6.Enabled = false;
this.Button7.Enabled = false;
this.Button8.Enabled = false;
this.Button9.Enabled = false;
}
if (Operators.CompareString(this.Button4.Text, "X", false) == 0 & Operators.CompareString(this.Button5.Text, "X", false) == 0 & Operators.CompareString(this.Button6.Text, "X", false) == 0)
{
this.Label2.Text = "X wins";
this.Button1.Enabled = false;
this.Button2.Enabled = false;
this.Button3.Enabled = false;
this.Button4.Enabled = false;
this.Button5.Enabled = false;
this.Button6.Enabled = false;
this.Button7.Enabled = false;
this.Button8.Enabled = false;
this.Button9.Enabled = false;
}
etc ..
Same again, think about an algorithm which is able to calculate who is the winner.
|
|
|
08/06/2013, 10:32
|
#4
|
elite*gold: 0
Join Date: Dec 2012
Posts: 1,140
Received Thanks: 229
|
Quote:
Originally Posted by dready
Noobs .. realy man ?
Ok ..
1. Name your stuff properly
2.
Example Code:
Code:
private void Button6_Click(object sender, EventArgs e)
{
if (Operators.CompareString(this.Label2.Text, "X", false) == 0)
{
this.Button6.Text = "X";
this.Label2.Text = "0";
}
else
{
this.Button6.Text = "0";
this.Label2.Text = "X";
}
this.win();
this.Button6.Enabled = false;
}
private void Button7_Click(object sender, EventArgs e)
{
if (Operators.CompareString(this.Label2.Text, "X", false) == 0)
{
this.Button7.Text = "X";
this.Label2.Text = "0";
}
else
{
this.Button7.Text = "0";
this.Label2.Text = "X";
}
this.win();
this.Button7.Enabled = false;
etc...
}
The same code over and over again is bad style and a pain for maintaining, your Task, think about a way to solve this
3.
Example Code:
Code:
if (Operators.CompareString(this.Button1.Text, "X", false) == 0 & Operators.CompareString(this.Button2.Text, "X", false) == 0 & Operators.CompareString(this.Button3.Text, "X", false) == 0)
{
this.Label2.Text = "X wins";
this.Button1.Enabled = false;
this.Button2.Enabled = false;
this.Button3.Enabled = false;
this.Button4.Enabled = false;
this.Button5.Enabled = false;
this.Button6.Enabled = false;
this.Button7.Enabled = false;
this.Button8.Enabled = false;
this.Button9.Enabled = false;
}
if (Operators.CompareString(this.Button4.Text, "X", false) == 0 & Operators.CompareString(this.Button5.Text, "X", false) == 0 & Operators.CompareString(this.Button6.Text, "X", false) == 0)
{
this.Label2.Text = "X wins";
this.Button1.Enabled = false;
this.Button2.Enabled = false;
this.Button3.Enabled = false;
this.Button4.Enabled = false;
this.Button5.Enabled = false;
this.Button6.Enabled = false;
this.Button7.Enabled = false;
this.Button8.Enabled = false;
this.Button9.Enabled = false;
}
etc ..
Same again, think about an algorithm which is able to calculate who is the winner.
|
Whats that shitty code?
Never heard from arrays/GDI+?
|
|
|
All times are GMT +1. The time now is 16:29.
|
|