0
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.
2 Antworten
+ 4
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");
0
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