I'm making tic tac toe for a school project and have created a method called checkWin(char[][] board) that checks each combination of answers to see if there is a winning board. This runs after each turn and works perfectly, but totals 16 if statements, one for each potential win combination for each side. Because I'm checking combinations of different array elements, I can't use a switch, but is there any other way to avoid the large number of repetitive switch statements?
Aucun commentaire:
Enregistrer un commentaire