opponentActions) {
+
+ }
+
+ public void reset() {
+
+ }
+
+ @Override
+ public int getScore() {
+ int point = 0;
+ for (int i = 0; i < myCards.size(); i++) {
+ point += myCards.get(i).getPointValue();
+ }
+ return point;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/cardgame/PlayerStrategy.java b/src/main/java/cardgame/PlayerStrategy.java
new file mode 100644
index 0000000..75f209d
--- /dev/null
+++ b/src/main/java/cardgame/PlayerStrategy.java
@@ -0,0 +1,109 @@
+package cardgame;
+
+import java.util.List;
+
+/*
+ * =======================
+ * DO NOT MODIFY THIS FILE
+ * =======================
+ */
+
+/**
+ * A contract for how a Crazy8's player will interact with a Crazy8's game
+ * engine.
+ *
+ * A game engine would call these methods to interact with implementors of this
+ * interface in order
+ * to orchestrate a game of Crazy8's.
+ */
+public interface PlayerStrategy {
+
+ /**
+ * Gives the player their assigned id, as well as a list of the opponents'
+ * assigned ids.
+ *
+ * This method will be called by the game engine once at the very beginning
+ * (before any games
+ * are started), to allow the player to set up any initial state.
+ *
+ * @param playerId The id for this player, assigned by the game engine
+ * @param opponentIds A list of ids for this player's opponents
+ */
+ void init(int playerId, List opponentIds);
+
+ /**
+ * Called once at the beginning of o game to deal the player their initial
+ * cards.
+ *
+ * @param cards The initial list of cards dealt to this player
+ */
+ void receiveInitialCards(List cards);
+
+ /**
+ * Called to ask whether the player wants to draw this turn. Gives this player
+ * the top card of
+ * the discard pile at the beginning of their turn, as well as an optional suit
+ * for the pile in
+ * case a "8" was played, and the suit was changed.
+ *
+ * By having this return true, the game engine will then call receiveCard() for
+ * this player.
+ * Otherwise, playCard() will be called.
+ *
+ * @param topPileCard The card currently at the top of the pile
+ * @param changedSuit The suit that the pile was changed to as the result of an
+ * "8" being
+ * played. Will be null if no "8" was played.
+ * @return whether or not the player wants to draw
+ */
+ boolean shouldDrawCard(Card topPileCard, Card.Suit changedSuit);
+
+ /**
+ * Called when this player has chosen to draw a card from the deck.
+ *
+ * @param drawnCard The card that this player has drawn
+ */
+ void receiveCard(Card drawnCard);
+
+ /**
+ * Called when this player is ready to play a card (will not be called if this
+ * player drew on
+ * their turn).
+ *
+ * This will end this player's turn.
+ *
+ * @return The card this player wishes to put on top of the pile
+ */
+ Card playCard();
+
+ /**
+ * Called if this player decided to play a "8" card to ask the player what suit
+ * they would like
+ * to declare.
+ *
+ * This player should then return the Card.Suit enum that it wishes to set for
+ * the discard
+ * pile.
+ */
+ Card.Suit declareSuit();
+
+ /**
+ * Called at the very beginning of this player's turn to give it context of what
+ * its opponents
+ * chose to do on each of their turns.
+ *
+ * @param opponentActions A list of what the opponents did on each of their
+ * turns
+ */
+ void processOpponentActions(List opponentActions);
+
+ /**
+ * Returns the score of each player
+ */
+ int getScore();
+
+ /**
+ * Called before a game begins, to allow for resetting any state between games.
+ */
+ void reset();
+}
diff --git a/src/main/java/cardgame/PlayerTurn.java b/src/main/java/cardgame/PlayerTurn.java
new file mode 100644
index 0000000..dfe440a
--- /dev/null
+++ b/src/main/java/cardgame/PlayerTurn.java
@@ -0,0 +1,59 @@
+package cardgame;
+
+/*
+ * ========================
+ * DO NOT MODIFY THIS FILE.
+ * ========================
+ */
+
+import java.util.Objects;
+
+/**
+ * Represents an player's action on their turn: either they drew a card or they played a card.
+ */
+public class PlayerTurn {
+
+ /**
+ * The ID of the player that this action corresponds to
+ */
+ public int playerId;
+
+ /**
+ * If the player drew a card on their turn
+ */
+ public boolean drewACard;
+
+ /**
+ * The card the player played on their turn, or null if the player didn't play a card.
+ */
+ public Card playedCard;
+
+ /**
+ * When a player plays an "8", they can declare what suit the next player must play to.
+ *
+ * If the player played an "8", this is the suit that they declared. Otherwise, this is null.
+ */
+ public Card.Suit declaredSuit;
+
+ // Convenience methods; you might or might not need these.
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ PlayerTurn that = (PlayerTurn) o;
+ return playerId == that.playerId &&
+ drewACard == that.drewACard &&
+ Objects.equals(playedCard, that.playedCard) &&
+ declaredSuit == that.declaredSuit;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(playerId, drewACard, playedCard, declaredSuit);
+ }
+}
diff --git a/src/test/java/cardgame/CardTest.java b/src/test/java/cardgame/CardTest.java
new file mode 100644
index 0000000..db435c6
--- /dev/null
+++ b/src/test/java/cardgame/CardTest.java
@@ -0,0 +1,119 @@
+package cardgame;
+
+import static cardgame.Card.Rank;
+import static cardgame.Card.Suit;
+import static cardgame.Card.getDeck;
+import static org.junit.Assert.assertEquals;
+
+import java.util.Arrays;
+import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
+
+/*
+ * =======================================================
+ * DO NOT PUT YOUR TESTS IN THIS FILE!
+ *
+ * Write your own test classes for any classes you create.
+ * =======================================================
+ */
+
+public class CardTest {
+
+ private List deck;
+
+ @Before
+ public void setUp() {
+ deck = getDeck();
+ }
+
+ @Test
+ public void faceCardsWorthTenPoints() {
+ List faceCards = Arrays.asList(
+ new Card(Suit.DIAMONDS, Rank.JACK),
+ new Card(Suit.HEARTS, Rank.QUEEN),
+ new Card(Suit.SPADES, Rank.KING)
+ );
+
+ for (Card card : faceCards) {
+ assertEquals(10, card.getPointValue());
+ }
+ }
+
+ @Test
+ public void eightsWorthFiftyPoints() {
+ List eights = Arrays.asList(
+ new Card(Suit.DIAMONDS, Rank.EIGHT),
+ new Card(Suit.HEARTS, Rank.EIGHT),
+ new Card(Suit.SPADES, Rank.EIGHT),
+ new Card(Suit.CLUBS, Rank.EIGHT)
+ );
+
+ for (Card card : eights) {
+ assertEquals(50, card.getPointValue());
+ }
+ }
+
+ @Test
+ public void acesWorthOnePoint() {
+ List aces = Arrays.asList(
+ new Card(Suit.DIAMONDS, Rank.ACE),
+ new Card(Suit.HEARTS, Rank.ACE),
+ new Card(Suit.SPADES, Rank.ACE),
+ new Card(Suit.CLUBS, Rank.ACE)
+ );
+
+ for (Card card : aces) {
+ assertEquals(1, card.getPointValue());
+ }
+ }
+
+ @Test
+ public void numericCardsWorthNumericPoints() {
+ assertEquals(2, new Card(Suit.DIAMONDS, Rank.TWO).getPointValue());
+ assertEquals(3, new Card(Suit.HEARTS, Rank.THREE).getPointValue());
+ assertEquals(4, new Card(Suit.SPADES, Rank.FOUR).getPointValue());
+ assertEquals(5, new Card(Suit.CLUBS, Rank.FIVE).getPointValue());
+ assertEquals(6, new Card(Suit.DIAMONDS, Rank.SIX).getPointValue());
+ assertEquals(7, new Card(Suit.HEARTS, Rank.SEVEN).getPointValue());
+ assertEquals(9, new Card(Suit.SPADES, Rank.NINE).getPointValue());
+ assertEquals(10, new Card(Suit.CLUBS, Rank.TEN).getPointValue());
+ }
+
+ @Test
+ public void deckHasFiftyTwoCards() {
+ assertEquals(52, deck.size());
+ }
+
+ @Test
+ public void deckHasThirteenOfEachSuit() {
+ int numDiamonds = 0;
+ int numHearts = 0;
+ int numSpades = 0;
+ int numClubs = 0;
+
+ for (Card card : deck) {
+ switch (card.getSuit()) {
+ case DIAMONDS:
+ numDiamonds++;
+ break;
+ case HEARTS:
+ numHearts++;
+ break;
+ case SPADES:
+ numSpades++;
+ break;
+ case CLUBS:
+ numClubs++;
+ break;
+ default:
+ break;
+ }
+ }
+
+ assertEquals(13, numDiamonds);
+ assertEquals(13, numHearts);
+ assertEquals(13, numSpades);
+ assertEquals(13, numClubs);
+ }
+}
diff --git a/target/classes/cardgame/Card$Rank.class b/target/classes/cardgame/Card$Rank.class
new file mode 100644
index 0000000..3d4d4a0
Binary files /dev/null and b/target/classes/cardgame/Card$Rank.class differ
diff --git a/target/classes/cardgame/Card$Suit.class b/target/classes/cardgame/Card$Suit.class
new file mode 100644
index 0000000..e6ec179
Binary files /dev/null and b/target/classes/cardgame/Card$Suit.class differ
diff --git a/target/classes/cardgame/Card.class b/target/classes/cardgame/Card.class
new file mode 100644
index 0000000..055ba41
Binary files /dev/null and b/target/classes/cardgame/Card.class differ
diff --git a/target/classes/cardgame/Play.class b/target/classes/cardgame/Play.class
new file mode 100644
index 0000000..568fcff
Binary files /dev/null and b/target/classes/cardgame/Play.class differ
diff --git a/target/classes/cardgame/Player1.class b/target/classes/cardgame/Player1.class
new file mode 100644
index 0000000..2d15674
Binary files /dev/null and b/target/classes/cardgame/Player1.class differ
diff --git a/target/classes/cardgame/Player2.class b/target/classes/cardgame/Player2.class
new file mode 100644
index 0000000..3e6c1a3
Binary files /dev/null and b/target/classes/cardgame/Player2.class differ
diff --git a/target/classes/cardgame/PlayerStrategy.class b/target/classes/cardgame/PlayerStrategy.class
new file mode 100644
index 0000000..335d767
Binary files /dev/null and b/target/classes/cardgame/PlayerStrategy.class differ
diff --git a/target/classes/cardgame/PlayerTurn.class b/target/classes/cardgame/PlayerTurn.class
new file mode 100644
index 0000000..5079cdc
Binary files /dev/null and b/target/classes/cardgame/PlayerTurn.class differ
diff --git a/target/test-classes/cardgame/CardTest.class b/target/test-classes/cardgame/CardTest.class
new file mode 100644
index 0000000..9da4ee6
Binary files /dev/null and b/target/test-classes/cardgame/CardTest.class differ