Compare commits
No commits in common. "4b574c50e80d2feca30867e2b78075311538a69e" and "ad3ec299624ae0b06eca34088d3b2a787ca9f3d1" have entirely different histories.
4b574c50e8
...
ad3ec29962
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -30,16 +30,16 @@ public enum Suit {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
switch (this) {
|
switch (this) {
|
||||||
case HEARTS:
|
case HEARTS:
|
||||||
return "♥︎";
|
return "♥";
|
||||||
|
|
||||||
case DIAMONDS:
|
case DIAMONDS:
|
||||||
return "♦︎";
|
return "♦";
|
||||||
|
|
||||||
case CLUBS:
|
case CLUBS:
|
||||||
return "♣︎";
|
return "♣";
|
||||||
|
|
||||||
case SPADES:
|
case SPADES:
|
||||||
return "♠︎";
|
return "♠";
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return "";
|
return "";
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package cards.maumau.model;
|
package cards.maumau.model;
|
||||||
|
|
||||||
|
|
||||||
import cards.Card;
|
import cards.Card;
|
||||||
import cards.Suit;
|
import cards.Suit;
|
||||||
|
|
||||||
@ -12,8 +11,8 @@ class ActionHandler {
|
|||||||
private Suit chosenSuit;
|
private Suit chosenSuit;
|
||||||
private int ctr7 = 0;
|
private int ctr7 = 0;
|
||||||
|
|
||||||
private GameState gameState = GameState.GAME_INITIALIZED;
|
private GameState gameState;
|
||||||
private HandlerState handlerState = new Initialized(this);
|
private HandlerState handlerState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an ActionHandler for the specified MauMau game.
|
* Constructs an ActionHandler for the specified MauMau game.
|
||||||
@ -38,7 +37,7 @@ class ActionHandler {
|
|||||||
* @param player The player to be added to the game.
|
* @param player The player to be added to the game.
|
||||||
*/
|
*/
|
||||||
void addPlayer(Player player) {
|
void addPlayer(Player player) {
|
||||||
handlerState.addPlayer(player);
|
//TODO implement
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,7 +73,7 @@ public class CardHandler {
|
|||||||
* Deals cards to all players.
|
* Deals cards to all players.
|
||||||
* @throws Exception when there are not enough cards to satisfy starting conditions
|
* @throws Exception when there are not enough cards to satisfy starting conditions
|
||||||
*/
|
*/
|
||||||
public void dealCards() throws Exception {
|
void dealCards() throws Exception {
|
||||||
|
|
||||||
// get List of players
|
// get List of players
|
||||||
List<Player> players = game.getPlayers();
|
List<Player> players = game.getPlayers();
|
||||||
@ -119,7 +119,7 @@ public class CardHandler {
|
|||||||
*
|
*
|
||||||
* @return The top card of the discard pile.
|
* @return The top card of the discard pile.
|
||||||
*/
|
*/
|
||||||
public Card top() {
|
Card top() {
|
||||||
return discardPile.getFirst();
|
return discardPile.getFirst();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package cards.maumau.model;
|
package cards.maumau.model;
|
||||||
|
|
||||||
import cards.Card;
|
import cards.Card;
|
||||||
import cards.Rank;
|
|
||||||
import cards.Suit;
|
import cards.Suit;
|
||||||
|
|
||||||
public class Normal implements HandlerState {
|
public class Normal implements HandlerState {
|
||||||
@ -13,30 +12,15 @@ public class Normal implements HandlerState {
|
|||||||
|
|
||||||
public void addPlayer(Player player){}
|
public void addPlayer(Player player){}
|
||||||
public void startGame(){}
|
public void startGame(){}
|
||||||
public void finishGame(){}
|
public void finishGame(){
|
||||||
|
// Logic for finishing Game ????
|
||||||
|
if (handler.getGame().getPlayerHandler().getPlayers().isEmpty()) {
|
||||||
|
handler.setHandlerState(new Finished(handler));
|
||||||
|
}
|
||||||
|
}
|
||||||
public void cancelGame(){}
|
public void cancelGame(){}
|
||||||
|
public void chooseCard(Card c){}
|
||||||
public void chooseCard(Card c){
|
|
||||||
if (handler.canPlay(c)) {
|
|
||||||
handler.getGame().getPlayerHandler().getCurrentPlayer().playCard(c);
|
|
||||||
if (c.rank() == Rank.SEVEN) {
|
|
||||||
handler.increment7Counter();
|
|
||||||
handler.getGame().getPlayerHandler().nextTurn(1);
|
|
||||||
handler.setHandlerState(new SevenChosen(handler));
|
|
||||||
} else if (c.rank() == Rank.JACK) {
|
|
||||||
handler.setHandlerState(new JackChosen(handler));
|
|
||||||
} else if (c.rank() == Rank.EIGHT) {
|
|
||||||
handler.getGame().getPlayerHandler().nextTurn(2);
|
|
||||||
} else {
|
|
||||||
handler.getGame().getPlayerHandler().nextTurn(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void chooseSuit(Suit suit){}
|
public void chooseSuit(Suit suit){}
|
||||||
public void skip(){
|
public void skip(){}
|
||||||
handler.getGame().getPlayerHandler().getCurrentPlayer().drawCards(1);
|
|
||||||
handler.getGame().getPlayerHandler().nextTurn(1);
|
|
||||||
}
|
|
||||||
public void no7(){}
|
public void no7(){}
|
||||||
}
|
}
|
||||||
|
@ -14,13 +14,9 @@ public class WaitForNextTurnState implements PlayerState {
|
|||||||
handler.setRemember(handler.getCurrentPlayer());
|
handler.setRemember(handler.getCurrentPlayer());
|
||||||
handler.localNextTurn(n);
|
handler.localNextTurn(n);
|
||||||
handler.setCurrentState(handler.getWaitForMauMauState());
|
handler.setCurrentState(handler.getWaitForMauMauState());
|
||||||
} else if (handler.getCurrentPlayer().getCards().size() == 1) {
|
|
||||||
handler.setRemember(handler.getCurrentPlayer());
|
|
||||||
handler.localNextTurn(n);
|
|
||||||
handler.setCurrentState(handler.getWaitForMauState());
|
|
||||||
} else {
|
} else {
|
||||||
handler.localNextTurn(n);
|
handler.localNextTurn(n);
|
||||||
handler.setCurrentState(handler.getWaitForNextTurnState());
|
handler.setCurrentState(handler.getWaitForMauState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
package test.cards;
|
package cards;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import cards.Card;
|
|
||||||
import cards.Rank;
|
|
||||||
import cards.Suit;
|
|
||||||
|
|
||||||
import static cards.Rank.THREE;
|
import static cards.Rank.THREE;
|
||||||
import static cards.Rank.TWO;
|
import static cards.Rank.TWO;
|
||||||
import static cards.Suit.HEARTS;
|
import static cards.Suit.HEARTS;
|
@ -1,4 +1,4 @@
|
|||||||
package test.cards;
|
package cards;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package test.cards;
|
package cards;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
@ -1,10 +1,8 @@
|
|||||||
package test.cards.maumau;
|
package cards.maumau;
|
||||||
|
|
||||||
import cards.Card;
|
import cards.Card;
|
||||||
import cards.Rank;
|
import cards.Rank;
|
||||||
import cards.Suit;
|
import cards.Suit;
|
||||||
import cards.maumau.MauMauDeck;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,11 +1,8 @@
|
|||||||
package test.cards.maumau.model;
|
package cards.maumau.model;
|
||||||
|
|
||||||
import cards.Card;
|
import cards.Card;
|
||||||
import cards.Rank;
|
import cards.Rank;
|
||||||
import cards.Suit;
|
import cards.Suit;
|
||||||
import cards.maumau.model.MauMau;
|
|
||||||
import cards.maumau.model.Player;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -38,12 +35,7 @@ public class CardHandlerTest {
|
|||||||
final Player chantal = game.addPlayer("Chantal");
|
final Player chantal = game.addPlayer("Chantal");
|
||||||
assertTrue(jacqueline.getCards().isEmpty());
|
assertTrue(jacqueline.getCards().isEmpty());
|
||||||
assertTrue(chantal.getCards().isEmpty());
|
assertTrue(chantal.getCards().isEmpty());
|
||||||
try {
|
|
||||||
game.getCardHandler().dealCards();
|
game.getCardHandler().dealCards();
|
||||||
} catch (Exception e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
assertEquals("[J♦︎, Q♦︎, A♠︎, A♦︎, 8♦︎]", jacqueline.getCards().toString());
|
assertEquals("[J♦︎, Q♦︎, A♠︎, A♦︎, 8♦︎]", jacqueline.getCards().toString());
|
||||||
assertEquals("[7♣︎, 9♣︎, 9♠︎, 8♣︎, K♥︎]", chantal.getCards().toString());
|
assertEquals("[7♣︎, 9♣︎, 9♠︎, 8♣︎, K♥︎]", chantal.getCards().toString());
|
||||||
assertEquals(c(ACE, HEARTS), game.getCardHandler().top());
|
assertEquals(c(ACE, HEARTS), game.getCardHandler().top());
|
@ -1,11 +1,8 @@
|
|||||||
package test.cards.maumau.model;
|
package cards.maumau.model;
|
||||||
|
|
||||||
import cards.Card;
|
import cards.Card;
|
||||||
import cards.Rank;
|
import cards.Rank;
|
||||||
import cards.Suit;
|
import cards.Suit;
|
||||||
import cards.maumau.model.MauMau;
|
|
||||||
import cards.maumau.model.Player;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,10 +1,8 @@
|
|||||||
package test.cards.maumau.model;
|
package cards.maumau.model;
|
||||||
|
|
||||||
import cards.Card;
|
import cards.Card;
|
||||||
import cards.Rank;
|
import cards.Rank;
|
||||||
import cards.Suit;
|
import cards.Suit;
|
||||||
import cards.maumau.model.MauMau;
|
|
||||||
import cards.maumau.model.Player;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,10 +1,8 @@
|
|||||||
package test.cards.maumau.model;
|
package cards.maumau.model;
|
||||||
|
|
||||||
import cards.Card;
|
import cards.Card;
|
||||||
import cards.Rank;
|
import cards.Rank;
|
||||||
import cards.Suit;
|
import cards.Suit;
|
||||||
import cards.maumau.model.MauMau;
|
|
||||||
import cards.maumau.model.Player;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,10 +1,8 @@
|
|||||||
package test.cards.maumau.model;
|
package cards.maumau.model;
|
||||||
|
|
||||||
import cards.Card;
|
import cards.Card;
|
||||||
import cards.Rank;
|
import cards.Rank;
|
||||||
import cards.Suit;
|
import cards.Suit;
|
||||||
import cards.maumau.model.MauMau;
|
|
||||||
import cards.maumau.model.Player;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,10 +1,8 @@
|
|||||||
package test.cards.maumau.model;
|
package cards.maumau.model;
|
||||||
|
|
||||||
import cards.Card;
|
import cards.Card;
|
||||||
import cards.Rank;
|
import cards.Rank;
|
||||||
import cards.Suit;
|
import cards.Suit;
|
||||||
import cards.maumau.model.MauMau;
|
|
||||||
import cards.maumau.model.Player;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,10 +1,8 @@
|
|||||||
package test.cards.maumau.model;
|
package cards.maumau.model;
|
||||||
|
|
||||||
import cards.Card;
|
import cards.Card;
|
||||||
import cards.Rank;
|
import cards.Rank;
|
||||||
import cards.Suit;
|
import cards.Suit;
|
||||||
import cards.maumau.model.MauMau;
|
|
||||||
import cards.maumau.model.Player;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,10 +1,8 @@
|
|||||||
package test.cards.maumau.model;
|
package cards.maumau.model;
|
||||||
|
|
||||||
import cards.Card;
|
import cards.Card;
|
||||||
import cards.Rank;
|
import cards.Rank;
|
||||||
import cards.Suit;
|
import cards.Suit;
|
||||||
import cards.maumau.model.MauMau;
|
|
||||||
import cards.maumau.model.Player;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,10 +1,8 @@
|
|||||||
package test.cards.maumau.model;
|
package cards.maumau.model;
|
||||||
|
|
||||||
import cards.Card;
|
import cards.Card;
|
||||||
import cards.Rank;
|
import cards.Rank;
|
||||||
import cards.Suit;
|
import cards.Suit;
|
||||||
import cards.maumau.model.MauMau;
|
|
||||||
import cards.maumau.model.Player;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,10 +1,8 @@
|
|||||||
package test.cards.maumau.model;
|
package cards.maumau.model;
|
||||||
|
|
||||||
import cards.Card;
|
import cards.Card;
|
||||||
import cards.Rank;
|
import cards.Rank;
|
||||||
import cards.Suit;
|
import cards.Suit;
|
||||||
import cards.maumau.model.MauMau;
|
|
||||||
import cards.maumau.model.Player;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
Loading…
Reference in New Issue
Block a user