Write a method to return true if tic-tac-toe winner
If anyone has the shortest solution for this, please share. I’m so new here, by the way.
You could use ternary looks somthing like this. int player1 = 1; int player2 = 0; boolean b = player1>player2?true:false; String result = b?"won":"lost"; System.out.println("you "+result+" this game");
i’m looking for a boolean method to return true if win, my way is to write all scenarios winning case of all rows and columns for each player, but i think there should be a shortest way