Skip to content
Snippets Groups Projects
Commit 342e0272 authored by giovanni.novati@studenti.unimi.it's avatar giovanni.novati@studenti.unimi.it
Browse files

REFACTORING: migliorato il metodo estabilishTurnWinner

parent a7014d03
No related branches found
No related tags found
No related merge requests found
......@@ -46,27 +46,14 @@ public class Briscola {
@NotNull // spostato a livello private package per facilitarne il testing
Player establishTurnWinner(@NotNull Card first, @NotNull Card second) {
// TODO identifica (e restituisce) il vincitore del turno applicando le regole alle due carte giocate
Suit briscola = getBriscola();
if (first.getSuit()==second.getSuit()){
if (first.getRank().compareTo(second.getRank())>0){
if (first.getRank().compareTo(second.getRank())>0)
return firstCardPlayer;
}
return otherPlayer(firstCardPlayer);
}
if(first.getSuit() == briscola){
if (second.getSuit() == briscola){
if (first.getRank().compareTo(second.getRank())>0){
return firstCardPlayer;
}
return otherPlayer(firstCardPlayer);
}
return firstCardPlayer;
}
if(second.getSuit()==briscola){
if(second.getSuit() == getBriscola())
return otherPlayer(firstCardPlayer);
}
return firstCardPlayer;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment