diff --git a/src/Card.java b/src/Card.java old mode 100755 new mode 100644 index 9eed9a5..3fc295b --- a/src/Card.java +++ b/src/Card.java @@ -1,5 +1,100 @@ +import java.util.ArrayList; + public class Card { - // Create the rest of this class yourself + private int quantity; + private int color; + private int shading; + private int shape; + + public Card(int q, int c, int shd, int shp) { + if (q < 1 || q > 3) { + quantity = (((q % 3) + 3) % 3) + 1; + } + else { + quantity = q; + } + if (c < 1 || c > 3) { + color = (((c % 3) + 3) % 3) + 1; + } + else { + color = c; + } + if (shd < 1 || shd > 3) { + shading = (((shd % 3) + 3) % 3) + 1; + } + else { + shading = shd; + } + if (shp < 1 || shp > 3) { + shape = (((shp % 3) + 3) % 3) + 1; + } + else { + shape = shp; + } + } + + public int getQuantity() { + return quantity; + } + + public int getColor() { + return color; + } + + public int getShading() { + return shading; + } + + public int getShape() { + return shape; + } + + public boolean isSet(Card c1, Card c2) { + int quantityset = quantity + c1.getQuantity() + c2.getQuantity(); + int colorset = color + c1.getColor() + c2.getColor(); + int shadeset = shading + c1.getShading() + c2.getShading(); + int shapeset = shape + c1.getShape() + c2.getShape(); + if (quantityset % 3 == 0 && colorset % 3 == 0 && shadeset % 3 == 0 && shapeset % 3 == 0) { + return true; + } + else { + return false; + } + } + + public String toString() { + String string = ""; + ArrayList quant = new ArrayList(); + quant.add(""); + quant.add("1"); + quant.add("2"); + quant.add("3"); + + ArrayList col = new ArrayList(); + col.add(""); + col.add("R"); + col.add("G"); + col.add("P"); + + ArrayList shad = new ArrayList(); + shad.add(""); + shad.add("O"); + shad.add("T"); + shad.add("S"); + + ArrayList shap = new ArrayList(); + shap.add(""); + shap.add("O"); + shap.add("D"); + shap.add("S"); + + string += quant.get(getQuantity()); + string += col.get(getColor()); + string += shad.get(getShading()); + string += shap.get(getShape()); + + return string; + } public boolean equals(Object obj) { Card that = (Card)obj; diff --git a/src/CardTest.java b/src/CardTest.java new file mode 100644 index 0000000..a6907e2 --- /dev/null +++ b/src/CardTest.java @@ -0,0 +1,86 @@ +import junit.framework.TestCase; + +public class CardTest extends TestCase { + + public void testOneCard() { + Card c = new Card(1, 1, 1, 1); + + assertEquals(1, c.getQuantity()); + assertEquals(1, c.getColor()); + assertEquals(1, c.getShading()); + assertEquals(1, c.getShape()); + assertEquals("1ROO", c.toString()); + } + + public void testInvalidValues() { + Card c = new Card(-2, 4, 8, 0); + + assertEquals(2, c.getQuantity()); + assertEquals(2, c.getColor()); + assertEquals(3, c.getShading()); + assertEquals(1, c.getShape()); + assertEquals("2GSO", c.toString()); + } + + public void testMixedValidityValues() { + Card c = new Card(2, 1, 5, 0); + + assertEquals(2, c.getQuantity()); + assertEquals(1, c.getColor()); + assertEquals(3, c.getShading()); + assertEquals(1, c.getShape()); + assertEquals("2RSO", c.toString()); + } + + public void testNotSet() { + Card c1 = new Card(2, 1, 5, 0); + Card c2 = new Card(1, 1, 3, 2); + Card c3 = new Card(2, 1, 1, 1); + + assertEquals(2, c1.getQuantity()); + assertEquals(1, c1.getColor()); + assertEquals(3, c1.getShading()); + assertEquals(1, c1.getShape()); + assertEquals("2RSO", c1.toString()); + + assertEquals(1, c2.getQuantity()); + assertEquals(1, c2.getColor()); + assertEquals(3, c2.getShading()); + assertEquals(2, c2.getShape()); + assertEquals("1RSD", c2.toString()); + + assertEquals(2, c3.getQuantity()); + assertEquals(1, c3.getColor()); + assertEquals(1, c3.getShading()); + assertEquals(1, c3.getShape()); + assertEquals("2ROO", c3.toString()); + + assertFalse(c1.isSet(c2, c3)); + } + + public void testSet() { + Card c1 = new Card(2, 1, 2, 3); + Card c2 = new Card(2, 1, 3, 2); + Card c3 = new Card(2, 1, 1, 1); + + assertEquals(2, c1.getQuantity()); + assertEquals(1, c1.getColor()); + assertEquals(2, c1.getShading()); + assertEquals(3, c1.getShape()); + assertEquals("2RTS", c1.toString()); + + assertEquals(2, c2.getQuantity()); + assertEquals(1, c2.getColor()); + assertEquals(3, c2.getShading()); + assertEquals(2, c2.getShape()); + assertEquals("2RSD", c2.toString()); + + assertEquals(2, c3.getQuantity()); + assertEquals(1, c3.getColor()); + assertEquals(1, c3.getShading()); + assertEquals(1, c3.getShape()); + assertEquals("2ROO", c3.toString()); + + assertTrue(c1.isSet(c2, c3)); + } +} diff --git a/src/Deck.java b/src/Deck.java old mode 100755 new mode 100644 index ab3a2a3..05c7919 --- a/src/Deck.java +++ b/src/Deck.java @@ -2,11 +2,35 @@ import java.io.FileReader; import java.util.StringTokenizer; import java.util.ArrayList; +import java.util.Collections; public class Deck { - // Implement the rest of this class yourself + //Instrance variables must be cards and nextCardIndex for the provided constructor + //to work + public ArrayList cards; + public int nextCardIndex; + + public Deck() { + // Creates a deck with all standard 81 set cards, shuffled + //Usage (in test code, and in the later code); Deck d = new Deck() + cards = new ArrayList(81); + + for (int q = 1; q <= 3; q++) { + for (int c = 1; c <= 3; c++) { + for (int shd = 1; shd <= 3; shd++) { + for (int shp = 1; shp <= 3; shp++) { + cards.add(new Card (q, c, shd, shp)); + } + } + } + } + Collections.shuffle(cards); + nextCardIndex = 0; + } public Deck(String filename) { + //Creates a pre-defined deck from a file named filename and does not shuffle + //Usage (in test code, and in the later code); Deck d = new Deck("example.dat") cards = new ArrayList(81); try { @@ -42,4 +66,28 @@ public Deck(String filename) { throw new RuntimeException("Error while reading file: " + e.toString()); } } + + public boolean hasNext() { + //Returns true if any cards are left, false otherwise + if (nextCardIndex < cards.size()) { + return true; + } + else { + return false; + } + } + + public Card getNext() { + //Returns the next card in the deck if there is one, null otherwise + //You can call hasNext within this method to see if you should return + //a card or return null + if (hasNext() == false) { + return null; + } + else { + int cardIndex = nextCardIndex; + nextCardIndex += 1; + return cards.get(cardIndex); + } + } } diff --git a/src/DeckTest.java b/src/DeckTest.java new file mode 100644 index 0000000..7046695 --- /dev/null +++ b/src/DeckTest.java @@ -0,0 +1,41 @@ +import junit.framework.TestCase; + +public class DeckTest extends TestCase { + + public void testDeck() { + Deck d = new Deck(); + + int num = 0; + while (d.hasNext() == true) { + d.getNext(); + num += 1; + } + + assertEquals(81, num); + } + + public void testFile() { + Deck d = new Deck("deck.dat"); + + int num = 0; + while (d.hasNext() == true) { + num += 1; + d.getNext(); + } + + assertEquals(9, num); + } + + public void testEmpty() { + Deck d = new Deck("empty.dat"); + + int num = 0; + while (d.hasNext() == true) { + num += 1; + d.getNext(); + } + + assertFalse(d.hasNext()); + assertEquals(null, d.getNext()); + } +} diff --git a/src/Game.java b/src/Game.java new file mode 100644 index 0000000..0e88b4d --- /dev/null +++ b/src/Game.java @@ -0,0 +1,88 @@ +public class Game { + Table t; + Deck d; + + public Game() { + t = new Table(); + d = new Deck(); + + for (int a = 0; a < 12; a++) { + t.add(d.getNext()); + } + } + + public Game(String filename) { + t = new Table(); + d = new Deck(filename); + + while (d.hasNext()) { + t.add(d.getNext()); + if (t.numCards() > 11) { + return; + } + } + } + + public int numSets() { + return t.numSets(); + } + + public int numCards() { + return t.numCards(); + + } + + public void playRound() { + if (t.numSets() == 0 && d.hasNext() && t.numCards() > 11) { + for (int c = 0; c < 3; c++) { + if (d.hasNext()) { + t.add(d.getNext()); + } + } + return; + } + + if (t.numCards() == 0 && d.hasNext()) { + for (int c = 0; c < 12; c++) { + if (d.hasNext()) { + t.add(d.getNext()); + } + } + return; + } + + if (t.numSets() != 0) { + for (int i = 0; i < (t.numCards() - 2); i++) { + for (int j = i + 1; j < (t.numCards() - 1); j++) { + for (int k = j + 1; k < t.numCards(); k++) { + if (t.getCard(k).isSet(t.getCard(i), t.getCard(j))) { + t.removeSet(t.getCard(k), t.getCard(i), t.getCard(j)); + if (t.numCards() < 12 && d.hasNext()) { + for (int c = 0; c < 3; c++) { + if (d.hasNext()) { + t.add(d.getNext()); + } + else { + return; + } + } + } + return; + } + } + } + } + } + } + + public boolean isGameOver() { + if (!d.hasNext() && t.numSets() == 0) { + return true; + } + + else { + return false; + } + } +} + \ No newline at end of file diff --git a/src/MonteCarloSimulation.java b/src/MonteCarloSimulation.java new file mode 100644 index 0000000..6ea3292 --- /dev/null +++ b/src/MonteCarloSimulation.java @@ -0,0 +1,36 @@ +public class MonteCarloSimulation { + public static void main(String[] args) { + int numRounds = 0; + float avgNumRounds; + float avgCardsRemain; + float avgNumSets; + int gameRuns = 100000; + long numSets = 0; + int numCardsRemain = 0; + + for (int i = 0; i < gameRuns; i++) { + Game g = new Game(); + + while (!g.isGameOver()) { + g.playRound(); + numRounds += 1; + } + numCardsRemain += g.numCards(); + } + + for (int j = 0; j < gameRuns; j++) { + Game g = new Game(); + + g.playRound(); + + numSets += g.numSets(); + + } + avgCardsRemain = numCardsRemain / gameRuns; + avgNumSets = (float) numSets / gameRuns; + avgNumRounds = numRounds / gameRuns; + System.out.println("The average number of rounds per Set game: " + avgNumRounds); + System.out.println("The average number of cards remaining per Set game: " + avgCardsRemain); + System.out.println("The average number of sets per table dealt: " + avgNumSets); + } +} \ No newline at end of file diff --git a/src/Table.java b/src/Table.java new file mode 100644 index 0000000..5530e5a --- /dev/null +++ b/src/Table.java @@ -0,0 +1,116 @@ +public class Table { + private TableNode head; + + public Table() { + head = null; + } + + public void add(Card c) { + TableNode n = new TableNode(c); + n.setNext(head); + head = n; + } + + public void removeSet(Card c1, Card c2, Card c3) { + if (c1.isSet(c2, c3) == false) { + return; + } + + else { + boolean isRemove1 = false; + boolean isRemove2 = false; + boolean isRemove3 = false; + + TableNode temp = head; + + while (temp != null) { + if (c1.equals(temp.getCard())) { + isRemove1 = true; + } + if (c2.equals(temp.getCard())) { + isRemove2 = true; + } + if (c3.equals(temp.getCard())) { + isRemove3 = true; + } + temp = temp.getNext(); + } + + if (isRemove1 && isRemove2 && isRemove3) { + temp = head; + TableNode prev = null; + + while (temp != null) { + if (c1.equals(temp.getCard()) || c2.equals(temp.getCard()) || c3.equals(temp.getCard())) { + if (temp == head) { + temp = temp.getNext(); + head = head.getNext(); + } + else { + prev.setNext(temp.getNext()); + temp = temp.getNext(); + } + } + else { + prev = temp; + temp = temp.getNext(); + } + } + } + } + } + + public int numCards() { + TableNode temp = head; + int num = 0; + while (temp != null) { + num += 1; + temp = temp.getNext(); + } + return num; + } + + public Card getCard(int index) { + if (index > numCards() - 1) { + return null; + } + + TableNode temp = head; + if (temp == null) { + return null; + } + + else { + for (int i = 0; i < index; i++) { + temp = temp.getNext(); + } + return temp.getCard(); + } + } + + public int numSets() { + int num = 0; + if (numCards() < 3) { + return 0; + } + else { + TableNode n1 = head; + while (n1 != null && n1.getNext().getNext() != null) { + TableNode n2 = n1.getNext(); + while (n2 != null && n2.getNext() != null) { + TableNode n3 = n2.getNext(); + while (n3 != null) { + if (n3.getCard().isSet(n2.getCard(), n1.getCard()) == true) { + num += 1; + } + n3 = n3.getNext(); + } + n2 = n2.getNext(); + } + n1 = n1.getNext(); + + } + return num; + } + } +} \ No newline at end of file diff --git a/src/TableNode.java b/src/TableNode.java new file mode 100644 index 0000000..318dea8 --- /dev/null +++ b/src/TableNode.java @@ -0,0 +1,21 @@ +public class TableNode { + public Card card; + public TableNode next; + + public TableNode(Card c) { + card = c; + next = null; + } + + public void setNext(TableNode n) { + next = n; + } + + public TableNode getNext() { + return next; + } + + public Card getCard() { + return card; + } +} \ No newline at end of file diff --git a/src/TableTest.java b/src/TableTest.java new file mode 100644 index 0000000..847356d --- /dev/null +++ b/src/TableTest.java @@ -0,0 +1,59 @@ +import junit.framework.TestCase; + +public class TableTest extends TestCase { + + public void testEmptyTable() { + Table t = new Table(); + + assertEquals(0, t.numCards()); + assertEquals(null, t.getCard(0)); + assertEquals(0, t.numSets()); + + } + + public void testOneCardTable() { + Table t = new Table(); + Card c1 = new Card(1, 1, 1, 1); + + t.add(c1); + + assertEquals(1, t.numCards()); + assertEquals(c1, t.getCard(0)); + assertEquals(0, t.numSets()); + + } + + public void testTwoCardTable() { + Table t = new Table(); + Card c1 = new Card(1, 1, 1, 1); + Card c2 = new Card(2, 2, 2, 2); + + t.add(c1); + t.add(c2); + + assertEquals(2, t.numCards()); + assertEquals(c1, t.getCard(1)); + assertEquals(c2, t.getCard(0)); + assertEquals(0, t.numSets()); + + } + + public void testOneSetCardTable() { + Table t = new Table(); + Card c1 = new Card(1, 1, 1, 1); + Card c2 = new Card(2, 2, 2, 2); + Card c3 = new Card(3, 3, 3, 3); + + t.add(c2); + t.add(c1); + t.add(c3); + + assertEquals(3, t.numCards()); + assertEquals(c1, t.getCard(1)); + assertEquals(c2, t.getCard(2)); + assertEquals(c3, t.getCard(0)); + assertEquals(1, t.numSets()); + + } + +} diff --git a/src/TestGame.java b/src/TestGame.java new file mode 100644 index 0000000..65dfea9 --- /dev/null +++ b/src/TestGame.java @@ -0,0 +1,89 @@ +import junit.framework.TestCase; + +public class TestGame extends TestCase { + + public void testAutoTable() { + Game g = new Game(); + + assertEquals(12, g.numCards()); + } + + public void testFileTableUnderTwelveOneSet() { + Game g = new Game("newDeck.dat"); + + assertEquals(5, g.numCards()); + assertEquals(1, g.numSets()); + + g.playRound(); + + assertEquals(2, g.numCards()); + assertEquals(0, g.numSets()); + assertTrue(g.isGameOver()); + } + + public void testFileTableTwelveOneSet() { + Game g = new Game("deck1.dat"); + + assertEquals(12, g.numCards()); + assertEquals(1, g.numSets()); + + g.playRound(); + + assertEquals(9, g.numCards()); + assertEquals(0, g.numSets()); + assertTrue(g.isGameOver()); + } + + public void testFileTableOverTwelveOneSet() { + Game g = new Game("datDeck.dat"); + + assertEquals(12, g.numCards()); + assertEquals(1, g.numSets()); + + g.playRound(); + + assertEquals(10, g.numCards()); + assertEquals(0, g.numSets()); + assertTrue(g.isGameOver()); + } + + public void testFileTableTwelveTwoSet() { + Game g = new Game("dick.dat"); + + assertEquals(12, g.numCards()); + assertEquals(2, g.numSets()); + + g.playRound(); + + assertEquals(9, g.numCards()); + assertEquals(1, g.numSets()); + assertFalse(g.isGameOver()); + } + + public void testFileTableOverTwelveTwoSet() { + Game g = new Game("dick2.dat"); + + assertEquals(12, g.numCards()); + assertEquals(2, g.numSets()); + + g.playRound(); + + assertEquals(10, g.numCards()); + assertEquals(1, g.numSets()); + assertFalse(g.isGameOver()); + } + + public void testFileTwoOverlappingSets() { + Game g = new Game("overlap.dat"); + + assertEquals(5, g.numCards()); + assertEquals(2, g.numSets()); + + g.playRound(); + + assertEquals(2, g.numCards()); + assertEquals(0, g.numSets()); + assertTrue(g.isGameOver()); + } + +} diff --git a/src/TestTable.java b/src/TestTable.java new file mode 100644 index 0000000..e9bc3ec --- /dev/null +++ b/src/TestTable.java @@ -0,0 +1,211 @@ +import junit.framework.TestCase; + +public class TestTable extends TestCase { + + public void testEmptyTable() { + Table t = new Table(); + + assertEquals(0, t.numCards()); + assertEquals(null, t.getCard(0)); + assertEquals(0, t.numSets()); + + } + + public void testOneCardTable() { + Table t = new Table(); + Card c1 = new Card(1, 1, 1, 1); + + t.add(c1); + + assertEquals(1, t.numCards()); + assertEquals(c1, t.getCard(0)); + assertEquals(0, t.numSets()); + + } + + public void testTwoCardTable() { + Table t = new Table(); + Card c1 = new Card(1, 1, 1, 1); + Card c2 = new Card(2, 2, 2, 2); + + t.add(c1); + t.add(c2); + + assertEquals(2, t.numCards()); + assertEquals(c1, t.getCard(1)); + assertEquals(c2, t.getCard(0)); + assertEquals(0, t.numSets()); + + } + + public void testOneSetCardTable() { + Table t = new Table(); + Card c1 = new Card(1, 1, 1, 2); + Card c2 = new Card(2, 1, 1, 1); + Card c3 = new Card(3, 1, 1, 3); + + t.add(c2); + t.add(c1); + t.add(c3); + + assertEquals(3, t.numCards()); + assertEquals(c1, t.getCard(1)); + assertEquals(c2, t.getCard(2)); + assertEquals(c3, t.getCard(0)); + assertEquals(1, t.numSets()); + + } + + public void testNoSetCardTable() { + Table t = new Table(); + Card c1 = new Card(1, 2, 1, 2); + Card c2 = new Card(2, 1, 1, 1); + Card c3 = new Card(3, 1, 1, 3); + + t.add(c2); + t.add(c1); + t.add(c3); + + assertEquals(3, t.numCards()); + assertEquals(c1, t.getCard(1)); + assertEquals(c2, t.getCard(2)); + assertEquals(c3, t.getCard(0)); + assertEquals(0, t.numSets()); + + } + + public void testOneSetFiveCardsCardTable() { + Table t = new Table(); + Card c1 = new Card(1, 2, 1, 2); + Card c2 = new Card(2, 1, 1, 1); + Card c3 = new Card(3, 3, 1, 3); + Card c4 = new Card(3, 2, 1, 1); + Card c5 = new Card(2, 2, 3, 2); + + t.add(c1); + t.add(c2); + t.add(c3); + t.add(c4); + t.add(c5); + + assertEquals(5, t.numCards()); + assertEquals(c1, t.getCard(4)); + assertEquals(c2, t.getCard(3)); + assertEquals(c3, t.getCard(2)); + assertEquals(c4, t.getCard(1)); + assertEquals(c5, t.getCard(0)); + assertEquals(null, t.getCard(5)); + assertEquals(1, t.numSets()); + + } + + public void testNoSetRemove() { + Table t = new Table(); + Card c1 = new Card(1, 1, 1, 1); + Card c2 = new Card(2, 1, 1, 1); + Card c3 = new Card(3, 1, 1, 1); + Card c4 = new Card(3, 2, 1, 1); + Card c5 = new Card(2, 2, 3, 2); + + t.add(c1); + t.add(c2); + t.add(c3); + t.add(c4); + t.add(c5); + + assertEquals(5, t.numCards()); + assertEquals(c1, t.getCard(4)); + assertEquals(c2, t.getCard(3)); + assertEquals(c3, t.getCard(2)); + assertEquals(c4, t.getCard(1)); + assertEquals(c5, t.getCard(0)); + assertEquals(null, t.getCard(5)); + assertEquals(1, t.numSets()); + + t.removeSet(c1, c2, c4); + + assertEquals(5, t.numCards()); + assertEquals(1, t.numSets()); + } + + public void testOneSetRemove() { + Table t = new Table(); + Card c1 = new Card(1, 1, 1, 1); + Card c2 = new Card(2, 1, 1, 1); + Card c3 = new Card(3, 1, 1, 1); + Card c4 = new Card(3, 2, 1, 1); + Card c5 = new Card(2, 2, 3, 2); + + t.add(c1); + t.add(c2); + t.add(c3); + t.add(c4); + t.add(c5); + + assertEquals(5, t.numCards()); + assertEquals(c1, t.getCard(4)); + assertEquals(c2, t.getCard(3)); + assertEquals(c3, t.getCard(2)); + assertEquals(c4, t.getCard(1)); + assertEquals(c5, t.getCard(0)); + assertEquals(null, t.getCard(5)); + assertEquals(1, t.numSets()); + + t.removeSet(c1, c2, c3); + + assertEquals(2, t.numCards()); + assertEquals(0, t.numSets()); + } + + public void testAddOneAtATime() { + Table t = new Table(); + Card c1 = new Card(1, 1, 1, 1); + Card c2 = new Card(2, 1, 1, 1); + Card c3 = new Card(3, 1, 1, 1); + Card c4 = new Card(3, 2, 1, 1); + Card c5 = new Card(2, 2, 3, 2); + + t.add(c1); + assertEquals(1, t.numCards()); + assertEquals(c1, t.getCard(0)); + assertEquals(0, t.numSets()); + + t.add(c2); + assertEquals(2, t.numCards()); + assertEquals(c2, t.getCard(0)); + assertEquals(c1, t.getCard(1)); + assertEquals(0, t.numSets()); + + t.add(c3); + assertEquals(3, t.numCards()); + assertEquals(c1, t.getCard(2)); + assertEquals(c2, t.getCard(1)); + assertEquals(c3, t.getCard(0)); + assertEquals(1, t.numSets()); + + t.add(c4); + assertEquals(4, t.numCards()); + assertEquals(c1, t.getCard(3)); + assertEquals(c2, t.getCard(2)); + assertEquals(c3, t.getCard(1)); + assertEquals(c4, t.getCard(0)); + assertEquals(1, t.numSets()); + + t.add(c5); + assertEquals(5, t.numCards()); + assertEquals(c1, t.getCard(4)); + assertEquals(c2, t.getCard(3)); + assertEquals(c3, t.getCard(2)); + assertEquals(c4, t.getCard(1)); + assertEquals(c5, t.getCard(0)); + assertEquals(1, t.numSets()); + + t.removeSet(c1, c3, c4); + assertEquals(5, t.numCards()); + assertEquals(1, t.numSets()); + + t.removeSet(c1, c2, c3); + assertEquals(2, t.numCards()); + assertEquals(0, t.numSets()); + } +} diff --git a/src/TestTableNode.java b/src/TestTableNode.java new file mode 100644 index 0000000..ef32759 --- /dev/null +++ b/src/TestTableNode.java @@ -0,0 +1,27 @@ +import junit.framework.TestCase; + +public class TestTableNode extends TestCase { + + public void testSingleTableNode() { + Card c = new Card(1, 1, 1, 1); + TableNode node = new TableNode(c); + + assertEquals(null, node.getNext()); + assertEquals(c, node.getCard()); + + } + + public void testTwoTableNodes() { + Card c1 = new Card(1, 1, 1, 1); + Card c2 = new Card(2, 2, 2, 2); + TableNode n1 = new TableNode(c1); + TableNode n2 = new TableNode(c2); + + assertEquals(null, n1.getNext()); + assertEquals(c1, n1.getCard()); + assertEquals(null, n2.getNext()); + assertEquals(c2, n2.getCard()); + + } + +} diff --git a/src/datDeck.dat b/src/datDeck.dat new file mode 100644 index 0000000..8da63d9 --- /dev/null +++ b/src/datDeck.dat @@ -0,0 +1,13 @@ +1 1 1 1 +1 1 1 2 +1 1 1 3 +3 1 1 1 +3 1 1 2 +3 1 2 3 +3 1 3 3 +3 3 3 3 +3 3 2 2 +3 3 1 3 +3 3 3 2 +1 2 2 2 +1 2 1 2 \ No newline at end of file diff --git a/src/deck.dat b/src/deck.dat new file mode 100644 index 0000000..219af50 --- /dev/null +++ b/src/deck.dat @@ -0,0 +1,11 @@ +#Deck of Set Cards + +1 1 1 1 +1 1 1 2 +1 1 1 3 +1 3 2 1 +2 1 3 1 +2 3 2 3 +3 2 1 1 +3 3 2 1 +3 3 3 3 \ No newline at end of file diff --git a/src/deck1.dat b/src/deck1.dat new file mode 100644 index 0000000..0215970 --- /dev/null +++ b/src/deck1.dat @@ -0,0 +1,12 @@ +1 1 1 1 +1 1 1 2 +1 1 1 3 +3 1 1 1 +3 1 1 2 +3 1 2 3 +3 3 3 3 +3 3 2 2 +3 3 1 3 +3 3 3 2 +1 2 2 2 +1 2 1 2 \ No newline at end of file diff --git a/src/dick.dat b/src/dick.dat new file mode 100644 index 0000000..693ed0f --- /dev/null +++ b/src/dick.dat @@ -0,0 +1,12 @@ +1 1 1 1 +1 1 1 2 +1 1 1 3 +3 1 1 1 +3 1 1 2 +3 1 2 3 +3 3 3 1 +3 3 2 2 +3 3 1 3 +3 3 3 2 +1 2 2 2 +1 2 1 2 \ No newline at end of file diff --git a/src/dick2.dat b/src/dick2.dat new file mode 100644 index 0000000..a71984a --- /dev/null +++ b/src/dick2.dat @@ -0,0 +1,13 @@ +1 1 1 1 +1 1 1 2 +1 1 1 3 +1 2 2 2 +1 2 1 2 +1 2 2 3 +3 1 1 1 +3 1 1 2 +3 1 2 3 +3 3 3 1 +3 3 2 2 +3 3 1 3 +3 3 3 2 \ No newline at end of file diff --git a/src/empty.dat b/src/empty.dat new file mode 100644 index 0000000..907d8a4 --- /dev/null +++ b/src/empty.dat @@ -0,0 +1 @@ +#Empty Deck \ No newline at end of file diff --git a/src/newDeck.dat b/src/newDeck.dat new file mode 100644 index 0000000..afe6f87 --- /dev/null +++ b/src/newDeck.dat @@ -0,0 +1,13 @@ +1 2 3 3 +2 2 2 2 +1 1 2 2 +1 1 1 1 +3 2 1 1 +# 2 3 3 3 +# 1 2 2 1 +# 3 3 1 2 +# 2 3 3 1 +# 3 3 3 3 +# 1 2 3 3 +# 3 2 1 1 +# 3 2 1 3 \ No newline at end of file diff --git a/src/overlap.dat b/src/overlap.dat new file mode 100644 index 0000000..ed8ed30 --- /dev/null +++ b/src/overlap.dat @@ -0,0 +1,5 @@ +1 1 1 1 +1 2 2 1 +1 3 3 1 +2 1 3 3 +3 2 3 2 \ No newline at end of file