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

VERDE: passa tryHigherRankStrategyTest

parent d452058a
No related branches found
No related tags found
No related merge requests found
......@@ -6,12 +6,18 @@ import it.unimi.di.sweng.briscola.Suit;
import org.jetbrains.annotations.NotNull;
public class TryHigherRankStrategy implements Strategy {
private final Strategy next;
public TryHigherRankStrategy(Strategy next) {
this.next = next;
}
@Override
public @NotNull Card chooseCard(@NotNull Player me, @NotNull Player other, @NotNull Suit briscola) {
return null;
for (Card card : me) {
if (card.getSuit().equals(other.playedCard().getSuit()) && card.getRank().points() > other.playedCard().getRank().points())
return card;
}
return next.chooseCard(me, other, briscola);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment