mardi 28 novembre 2017

Checking 3 values if are the same with If Statement

I am building a Tic Tac Toe game and I am wondering if this syntax could be valid. It seems the program sometimes is running correctly and sometimes not so i would like your opinion.

If ( (spacesArray[0] &&
      spacesArray[1] &&
      spacesArray[2] == (userDraw || compDraw))){
  }

So basically i am checcking positions 0,1,2 in an Array if they have the same value ("x" OR "o"). Is this syntax correct?

Aucun commentaire:

Enregistrer un commentaire