Hi I’m having a problem trying to shorten an if statement using a for loop
at the minute I have an array which holds 6 elements, each of these elements change depending on a series of 6 buttons pressed on stage
I have a ‘if’ statement that checks if certain elements in the array have change, there are 4 different combinations that I want to trace as correct. I can do this fine, but I will need to develop this to be able to accept 90+ different combinations and I dont want to write out a massive if statement listing all the possiblites, can anyone help me write the current ‘if’ statment I have it to neater code that I can then expend in the future
row0 = [0,0,0,0,0,0,0];
onEnterFrame = function(){
if(row0[0]==1 && row0[1]==1 && row0[2]==1 && row0[3]==1 ||
row0[1]==1 && row0[2]==1 && row0[3]==1 && row0[4]==1 ||
row0[2]==1 && row0[3]==1 && row0[4]==1 && row0[5]==1 ||
row0[3]==1 && row0[4]==1 && row0[5]==1 && row0[6]==1){
player1 = "winner"
} else {
player1 = "loser"
}
}