diff --git a/.idea/intellij-javadocs-4.0.1.xml b/.idea/intellij-javadocs-4.0.1.xml
new file mode 100644
index 0000000..90d3347
--- /dev/null
+++ b/.idea/intellij-javadocs-4.0.1.xml
@@ -0,0 +1,204 @@
+
+
+
+
+ UPDATE
+ false
+ true
+
+ FIELD
+ METHOD
+ TYPE
+
+
+ PUBLIC
+ PROTECTED
+ DEFAULT
+
+
+
+
+
+ ^.*(public|protected|private)*.+interface\s+\w+.*
+ /**\n
+ * The interface ${name}.\n
+<#if element.typeParameters?has_content> * \n
+</#if>
+<#list element.typeParameters as typeParameter>
+ * @param <${typeParameter.name}> the type parameter\n
+</#list>
+ */
+
+
+ ^.*(public|protected|private)*.+enum\s+\w+.*
+ /**\n
+ * The enum ${name}.\n
+ */
+
+
+ ^.*(public|protected|private)*.+class\s+\w+.*
+ /**\n
+ * The type ${name}.\n
+<#if element.typeParameters?has_content> * \n
+</#if>
+<#list element.typeParameters as typeParameter>
+ * @param <${typeParameter.name}> the type parameter\n
+</#list>
+ */
+
+
+ .+
+ /**\n
+ * The type ${name}.\n
+ */
+
+
+
+
+ .+
+ /**\n
+ * Instantiates a new ${name}.\n
+<#if element.parameterList.parameters?has_content>
+ *\n
+</#if>
+<#list element.parameterList.parameters as parameter>
+ * @param ${parameter.name} the ${paramNames[parameter.name]}\n
+</#list>
+<#if element.throwsList.referenceElements?has_content>
+ *\n
+</#if>
+<#list element.throwsList.referenceElements as exception>
+ * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
+</#list>
+ */
+
+
+
+
+ ^.*(public|protected|private)*\s*.*(\w(\s*<.+>)*)+\s+get\w+\s*\(.*\).+
+ /**\n
+ * Gets ${partName}.\n
+<#if element.typeParameters?has_content> * \n
+</#if>
+<#list element.typeParameters as typeParameter>
+ * @param <${typeParameter.name}> the type parameter\n
+</#list>
+<#if element.parameterList.parameters?has_content>
+ *\n
+</#if>
+<#list element.parameterList.parameters as parameter>
+ * @param ${parameter.name} the ${paramNames[parameter.name]}\n
+</#list>
+<#if isNotVoid>
+ *\n
+ * @return the ${partName}\n
+</#if>
+<#if element.throwsList.referenceElements?has_content>
+ *\n
+</#if>
+<#list element.throwsList.referenceElements as exception>
+ * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
+</#list>
+ */
+
+
+ ^.*(public|protected|private)*\s*.*(void|\w(\s*<.+>)*)+\s+set\w+\s*\(.*\).+
+ /**\n
+ * Sets ${partName}.\n
+<#if element.typeParameters?has_content> * \n
+</#if>
+<#list element.typeParameters as typeParameter>
+ * @param <${typeParameter.name}> the type parameter\n
+</#list>
+<#if element.parameterList.parameters?has_content>
+ *\n
+</#if>
+<#list element.parameterList.parameters as parameter>
+ * @param ${parameter.name} the ${paramNames[parameter.name]}\n
+</#list>
+<#if isNotVoid>
+ *\n
+ * @return the ${partName}\n
+</#if>
+<#if element.throwsList.referenceElements?has_content>
+ *\n
+</#if>
+<#list element.throwsList.referenceElements as exception>
+ * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
+</#list>
+ */
+
+
+ ^.*((public\s+static)|(static\s+public))\s+void\s+main\s*\(\s*String\s*(\[\s*\]|\.\.\.)\s+\w+\s*\).+
+ /**\n
+ * The entry point of application.\n
+
+ <#if element.parameterList.parameters?has_content>
+ *\n
+</#if>
+ * @param ${element.parameterList.parameters[0].name} the input arguments\n
+<#if element.throwsList.referenceElements?has_content>
+ *\n
+</#if>
+<#list element.throwsList.referenceElements as exception>
+ * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
+</#list>
+ */
+
+
+ .+
+ /**\n
+ * ${name}<#if isNotVoid> ${return}</#if>.\n
+<#if element.typeParameters?has_content> * \n
+</#if>
+<#list element.typeParameters as typeParameter>
+ * @param <${typeParameter.name}> the type parameter\n
+</#list>
+<#if element.parameterList.parameters?has_content>
+ *\n
+</#if>
+<#list element.parameterList.parameters as parameter>
+ * @param ${parameter.name} the ${paramNames[parameter.name]}\n
+</#list>
+<#if isNotVoid>
+ *\n
+ * @return the ${return}\n
+</#if>
+<#if element.throwsList.referenceElements?has_content>
+ *\n
+</#if>
+<#list element.throwsList.referenceElements as exception>
+ * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
+</#list>
+ */
+
+
+
+
+ ^.*(public|protected|private)*.+static.*(\w\s\w)+.+
+ /**\n
+ * The constant ${element.getName()}.\n
+ */
+
+
+ ^.*(public|protected|private)*.*(\w\s\w)+.+
+ /**\n
+ <#if element.parent.isInterface()>
+ * The constant ${element.getName()}.\n
+<#else>
+ * The ${name}.\n
+</#if> */
+
+
+ .+
+ /**\n
+ <#if element.parent.isEnum()>
+ *${name} ${typeName}.\n
+<#else>
+ * The ${name}.\n
+</#if>*/
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Card.java b/src/Card.java
index 58facc2..08190b9 100644
--- a/src/Card.java
+++ b/src/Card.java
@@ -1,12 +1,12 @@
public class Card {
- int number;
- Suit suit;
+ final int number;
+ final Suit suit;
enum Suit {
CLUBS,
SPADES,
HEARTS,
DIAMONDS
- };
+ }
public Card(int number, Suit suit) {
this.number = number;
diff --git a/src/CardGame.java b/src/CardGame.java
index e2e3e10..4191a65 100644
--- a/src/CardGame.java
+++ b/src/CardGame.java
@@ -1,13 +1,13 @@
import java.util.ArrayList;
public class CardGame {
- public Player[] players;
- Pile pot = new Pile();
- Pile draws = new Pile();
- int numberOfPlayers;
+ Player[] players;
+ final Pile pot = new Pile();
+ final Pile draws = new Pile();
+ final int numberOfPlayers;
/**
- * @param numberOfCards Total number of cards
+ * @param numberOfCards Total number of cards
* @param numberOfPlayers Total number of players
*/
public CardGame(int numberOfCards, int numberOfPlayers) {
@@ -59,14 +59,13 @@ public class CardGame {
private boolean noWinner() {
ArrayList activePlayers = new ArrayList<>();
- for (int i = 0; i < players.length; i++) {
- if (players[i].cardsCount() > 0) {
- activePlayers.add(players[i]);
+ for (Player player : players) {
+ if (player.cardsCount() > 0) {
+ activePlayers.add(player);
}
}
if (activePlayers.size() == 1) {
Out.println(String.format("Player %s wins the game!", activePlayers.get(0).name));
- Out.println();
return false;
}
return true;
diff --git a/src/Out.java b/src/Out.java
index 53a5a6c..e11b0aa 100644
--- a/src/Out.java
+++ b/src/Out.java
@@ -1,5 +1,5 @@
public class Out {
- static String[] output = new String[50000];
+ static final String[] output = new String[50000];
static int line = 0;
public static void println(String string) {
diff --git a/src/Player.java b/src/Player.java
index 910adc1..6b5b312 100644
--- a/src/Player.java
+++ b/src/Player.java
@@ -1,7 +1,7 @@
public class Player {
- String name;
- Pile drawPile;
- Pile discardPile;
+ final String name;
+ final Pile drawPile;
+ final Pile discardPile;
public Player(String name, Pile drawPile) {
this.name = name;
diff --git a/src/PlayerTest.java b/src/PlayerTest.java
index 259f993..8bb5398 100644
--- a/src/PlayerTest.java
+++ b/src/PlayerTest.java
@@ -1,16 +1,6 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import static org.junit.jupiter.api.Assertions.*;
-
class PlayerTest {
- @BeforeEach
- void setUp() {
- }
-
- @Test
- void draw() {
-
- }
}
\ No newline at end of file
diff --git a/src/Suit.java b/src/Suit.java
deleted file mode 100644
index 6255a3a..0000000
--- a/src/Suit.java
+++ /dev/null
@@ -1,14 +0,0 @@
-public class Suit {
- int suit;
-// public static Suit SPADES;
- public static final int CLUBS = 0;
- public static final int SPADES = 1;
- public static final int HEARTS = 2;
- public static final int DIAMONDS = 3;
- public static final int COUNT = 4;
-
- public Suit(int suit) {
- this.suit = suit;
- }
-
-}