Fixed lots and lots of IDE warnings, so basically that
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -11,7 +11,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit-jupiter</artifactId>
|
<artifactId>junit-jupiter</artifactId>
|
||||||
<version>RELEASE</version>
|
<version>5.9.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Dealer {
|
public class Dealer {
|
||||||
private Deck deck;
|
private final Deck deck;
|
||||||
|
|
||||||
public Dealer(Deck deck) {
|
public Dealer(Deck deck) {
|
||||||
this.deck = deck;
|
this.deck = deck;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
package mau.mau;
|
package mau.mau;
|
||||||
|
|
||||||
public enum TYPENUM {
|
public enum TYPENUM {
|
||||||
SPADES, HEARTS, DIAMONDS, CLUBS, JOKER;
|
SPADES, HEARTS, DIAMONDS, CLUBS, JOKER
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import mau.mau.players.Player;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class TurnTable {
|
public class TurnTable {
|
||||||
private List<Player> players;
|
private final List<Player> players;
|
||||||
private int currentPlayerIndex;
|
private int currentPlayerIndex;
|
||||||
private int direction;
|
private int direction;
|
||||||
|
|
||||||
|
|||||||
@@ -4,13 +4,12 @@ import mau.mau.*;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Scanner;
|
|
||||||
|
|
||||||
public class Bot extends Player {
|
public class Bot extends Player {
|
||||||
|
|
||||||
private static int nameIndex = 0;
|
private static int nameIndex = 0;
|
||||||
private static String JSON = "src/main/resources/languages/en.json";
|
private static final String JSON = "src/main/resources/languages/en.json";
|
||||||
private static String JSON_KEY = "botnames";
|
private static final String JSON_KEY = "bot-names";
|
||||||
|
|
||||||
public Bot(Dealer dealer) {
|
public Bot(Dealer dealer) {
|
||||||
super(dealer);
|
super(dealer);
|
||||||
@@ -82,7 +81,7 @@ public class Bot extends Player {
|
|||||||
try {
|
try {
|
||||||
return JSONderulo.getJSONArrayFromJSONFile(JSON, JSON_KEY).getString(nameIndex++);
|
return JSONderulo.getJSONArrayFromJSONFile(JSON, JSON_KEY).getString(nameIndex++);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("Error reading botnames from JSON file");
|
System.out.println("Error reading bot-names from JSON file");
|
||||||
return "Koet " + nameIndex++;
|
return "Koet " + nameIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import java.util.List;
|
|||||||
|
|
||||||
public abstract class Player {
|
public abstract class Player {
|
||||||
|
|
||||||
private String name;
|
private final String name;
|
||||||
private List<Card> hand;
|
private List<Card> hand;
|
||||||
private Dealer dealer;
|
private final Dealer dealer;
|
||||||
|
|
||||||
public Player(Dealer dealer) {
|
public Player(Dealer dealer) {
|
||||||
this.dealer = dealer;
|
this.dealer = dealer;
|
||||||
@@ -21,8 +21,8 @@ public abstract class Player {
|
|||||||
return hand;
|
return hand;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Card> setHand(List<Card> hand) {
|
public void setHand(List<Card> hand) {
|
||||||
return this.hand = hand;
|
this.hand = hand;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean handIsEmpty() {
|
public Boolean handIsEmpty() {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ loop until someone wins
|
|||||||
else draw
|
else draw
|
||||||
User -> Player: draw()
|
User -> Player: draw()
|
||||||
end
|
end
|
||||||
else bot's turn
|
else bots turn
|
||||||
alt play
|
alt play
|
||||||
Bot -> Player: play(card)
|
Bot -> Player: play(card)
|
||||||
Game <-- Player: playedCard
|
Game <-- Player: playedCard
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"botnames": [
|
"bot-names": [
|
||||||
"Jordan",
|
"Jordan",
|
||||||
"MaarKoet",
|
"MaarKoet",
|
||||||
"El Tigre"
|
"El Tigre"
|
||||||
|
|||||||
@@ -15,13 +15,12 @@ public class CardHandlerTest {
|
|||||||
private CardHandler sut;
|
private CardHandler sut;
|
||||||
private TurnTable turnTable;
|
private TurnTable turnTable;
|
||||||
private List<Player> players;
|
private List<Player> players;
|
||||||
private Dealer dealer;
|
|
||||||
private Bot bot1, bot2, bot3;
|
private Bot bot1, bot2, bot3;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
//Arrange
|
//Arrange
|
||||||
dealer = new Dealer(new Deck());
|
Dealer dealer = new Dealer(new Deck());
|
||||||
sut = new CardHandler();
|
sut = new CardHandler();
|
||||||
players = new ArrayList<>();
|
players = new ArrayList<>();
|
||||||
turnTable = new TurnTable(players);
|
turnTable = new TurnTable(players);
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
package mau.mau;
|
package mau.mau;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
||||||
|
|
||||||
public class DealerTest {
|
public class DealerTest {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ public class RefereeTest {
|
|||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void isAceOfSpadesValidEndcardTest(){
|
public void isAceOfSpadesValidEndCardTest(){
|
||||||
//Arrange
|
//Arrange
|
||||||
Card testCardOne = new Card(TYPENUM.SPADES, VALUENUM.ACE);
|
Card testCardOne = new Card(TYPENUM.SPADES, VALUENUM.ACE);
|
||||||
Card testCurrentCard = new Card(TYPENUM.HEARTS, VALUENUM.ACE);
|
Card testCurrentCard = new Card(TYPENUM.HEARTS, VALUENUM.ACE);
|
||||||
@@ -112,7 +112,7 @@ public class RefereeTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void isThreeOfHeartsValidEndcardTest(){
|
public void isThreeOfHeartsValidEndCardTest(){
|
||||||
//Arrange
|
//Arrange
|
||||||
Card testCardOne = new Card(TYPENUM.HEARTS, VALUENUM.THREE);
|
Card testCardOne = new Card(TYPENUM.HEARTS, VALUENUM.THREE);
|
||||||
Card testCurrentCard = new Card(TYPENUM.HEARTS, VALUENUM.ACE);
|
Card testCurrentCard = new Card(TYPENUM.HEARTS, VALUENUM.ACE);
|
||||||
|
|||||||
@@ -12,14 +12,12 @@ import static org.junit.jupiter.api.Assertions.*;
|
|||||||
public class BotTest {
|
public class BotTest {
|
||||||
|
|
||||||
private Bot sut;
|
private Bot sut;
|
||||||
private Dealer dealer;
|
|
||||||
private Deck deck;
|
|
||||||
private List<Card> hand;
|
private List<Card> hand;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
deck = new Deck();
|
Deck deck = new Deck();
|
||||||
dealer = new Dealer(deck);
|
Dealer dealer = new Dealer(deck);
|
||||||
sut = new Bot(dealer);
|
sut = new Bot(dealer);
|
||||||
hand = new ArrayList<>();
|
hand = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user