Skip to content

C# connect four help

Tony Temme

Asked Apr 25, 2014, 6:00 AM EDT2 answers
Share
LinkedInX
no matter what i try i can not get a winner, i can get each click to shower red/yellow pending whose go it it. once block has ben clicked it can not change colour.
TypeScript
privateoid allbtn_click(object sender, EventArgs e)
 {

if (((Button)sender).BackColor == Color.Transparent) // if btn colour is transparent then allows colour to change
 {


if (color == true) //starts if statement
 {
 ((

Button)sender).BackColor = Color.Red; //sets button to red
 }


else // else statement
 {
 ((

 

Button)sender).BackColor = Color.Yellow; //sets button to yellow

Code
 }
 color = !color;

// when colour is true, sets colour to false
 }
 }

 

Thats for the colour to correspond to clicks, i can not figure out a winner
PLEASE HELP ASAP!!!!

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    first of all, what is "color"? what type is it? second, what is your question? please be more specific
    0
  • 0
    color is to set the colour of the squares to red or yellow, what im after is how to set the code to allow identification of the 'four in a row' scenario
    0