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

VERDE: passa alwaysBriscolaStrategyTest

parent f2dbf022
No related branches found
No related tags found
No related merge requests found
......@@ -5,11 +5,22 @@ import it.unimi.di.sweng.briscola.Player;
import it.unimi.di.sweng.briscola.Suit;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
public class AlwaysBriscolaStrategy implements Strategy {
public AlwaysBriscolaStrategy(Strategy next) { }
private final Strategy next;
public AlwaysBriscolaStrategy(@NotNull 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(briscola))
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