dimanche 30 septembre 2018

How to do multiple if conditions

I have searched for that problem and found no answers which solve my problem

    if (true) {
            [0][0] =! 0 [0][1] ==! 0 [0][2] ==! 0;
            }return true;
            if(true) {
            [1][0] =! 0 [1][1] ==! 0 [1][2] ==! 0;
            }return true;
            if(true) {
            [2][0] =! 0 [2][1] ==! 0 [2][2] ==! 0;
            }return true;
            if(true) {
            [0][0] =! 0 [1][1] ==! 0 [2][2] ==! 0;
            }return true;
            if(true) {
            [0][2] =! 0 [1][1] ==! 0 [2][0] ==! 0;
            }return true;
            if(true) {
            [0][0] =! 0 [1][0] ==! 0 [2][0] ==! 0;
            }return true;
            if(true) {
            [0][1] =! 0 [1][1] ==! 0 [2][1] ==! 0;
            }return true;
            if(true) {
            [0][2] =! 0 [1][2] ==! 0 [2][2] ==! 0;

            }return true;

                }else
                    return false;

This method is to find out if someone has a win in TicTactoe I try to check every win possibilities in an 2d-array but eclipse gives me the error "Syntax error on token "{", Expression expected after this token" for the "{" bracket after every if condition and writing another "{" doesnt help

I have no idea how to get this working Hope you could give me some tips im a java beginner Sorry for bad English

Aucun commentaire:

Enregistrer un commentaire