Merge branch 'TUI' into toString-fixes
This commit is contained in:
@@ -18,6 +18,9 @@ import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import it.polimi.ingsw.gc14.Network.Observer;
|
||||
import it.polimi.ingsw.gc14.View.TUI.AsciiTable;
|
||||
import it.polimi.ingsw.gc14.View.TUI.BorderStyle;
|
||||
|
||||
/**
|
||||
* Represents the main game model.
|
||||
* A Game object stores the players, the current state of the match,
|
||||
@@ -36,6 +39,15 @@ public class Game implements Serializable {
|
||||
o.update(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of players participating in the game.
|
||||
* @return
|
||||
*/
|
||||
public List<Player> getPlayers() {
|
||||
return playersList;
|
||||
}
|
||||
|
||||
/**
|
||||
* The current number of players.
|
||||
*/
|
||||
@@ -691,4 +703,22 @@ public class Game implements Serializable {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
var table = new AsciiTable(BorderStyle.UNICODE, slotMap.size());
|
||||
List<String> stringUp=new ArrayList<>();
|
||||
List<String> stringDown=new ArrayList<>();
|
||||
for(Map.Entry<Slot,Player> entry:slotMap.entrySet())
|
||||
{
|
||||
|
||||
stringDown.add(entry.getKey().toStringTUI());
|
||||
if(entry.getValue()!=null)
|
||||
stringUp.add(entry.getValue().getUserName());
|
||||
else
|
||||
stringUp.add(" ");
|
||||
}
|
||||
table.addRow(stringUp);
|
||||
table.addRow(stringDown);
|
||||
return orderLogicCard.toString()+"\nOFFER TRACK\n"+ table.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
package it.polimi.ingsw.gc14.Model;
|
||||
|
||||
import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
|
||||
import it.polimi.ingsw.gc14.Model.Orders.OrderPlayer;
|
||||
import it.polimi.ingsw.gc14.View.TUI.AsciiTable;
|
||||
import it.polimi.ingsw.gc14.View.TUI.BorderStyle;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Abstract base class for all order logic cards.
|
||||
* An OrderLogicCard manages a queue of players and defines the effects
|
||||
* applied when players are pushed back into the queue.
|
||||
*/
|
||||
public abstract class OrderLogicCard implements Serializable {
|
||||
|
||||
/**
|
||||
* The queue of players associated with this order logic card.
|
||||
*/
|
||||
protected Queue<Player> players;
|
||||
protected List<OrderPlayer> playerList;
|
||||
|
||||
|
||||
/**
|
||||
* Creates an order logic card with the specified list of players.
|
||||
@@ -26,6 +27,8 @@ public abstract class OrderLogicCard implements Serializable {
|
||||
public OrderLogicCard(ArrayList<Player> players) {
|
||||
Collections.shuffle(players);
|
||||
this.players = new LinkedList<>(players);
|
||||
|
||||
this.playerList=new ArrayList<>(players.stream().map(x->new OrderPlayer(x,false)).toList());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -36,7 +39,15 @@ public abstract class OrderLogicCard implements Serializable {
|
||||
*/
|
||||
public void push(Player player){
|
||||
effect(player,players.size());
|
||||
if(players.size()==0)
|
||||
{
|
||||
playerList=new ArrayList<>();
|
||||
|
||||
}
|
||||
playerList.add(new OrderPlayer(player,false));
|
||||
players.add(player);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,6 +56,13 @@ public abstract class OrderLogicCard implements Serializable {
|
||||
* @return the first player in the queue, or {@code null} if the queue is empty.
|
||||
*/
|
||||
public Player pull(){
|
||||
for(OrderPlayer p:playerList){
|
||||
if(p.played==false)
|
||||
{
|
||||
p.played=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return players.poll();
|
||||
}
|
||||
|
||||
@@ -79,4 +97,17 @@ public abstract class OrderLogicCard implements Serializable {
|
||||
for(BuildingCard b : player.buildingCards.stream().filter(x->x.getEffectId()==3).toList())
|
||||
player.addFood(1);
|
||||
}
|
||||
|
||||
protected int getPosition(String username)
|
||||
{
|
||||
int pos = 0;
|
||||
for (Player p : players) {
|
||||
if (p.getUserName().equals(username))
|
||||
return pos;
|
||||
pos++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,8 +2,11 @@ package it.polimi.ingsw.gc14.Model.Orders;
|
||||
|
||||
import it.polimi.ingsw.gc14.Model.OrderLogicCard;
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
import it.polimi.ingsw.gc14.View.TUI.AsciiTable;
|
||||
import it.polimi.ingsw.gc14.View.TUI.BorderStyle;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class Order2 extends OrderLogicCard {
|
||||
|
||||
@@ -49,4 +52,35 @@ public class Order2 extends OrderLogicCard {
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
|
||||
var table = new AsciiTable(BorderStyle.UNICODE, 2);
|
||||
List<String> stringUp=new ArrayList<>();
|
||||
List<String> stringDown=new ArrayList<>();
|
||||
for(int i=0;i<2;i++)
|
||||
{
|
||||
try {
|
||||
playerList.get(i);
|
||||
stringUp.add(i+". "+playerList.get(i).player.getUserName());
|
||||
if(playerList.get(i).played)
|
||||
stringDown.add(" Placed");
|
||||
else
|
||||
stringDown.add(" Not Placed");
|
||||
}
|
||||
catch (IndexOutOfBoundsException e) {
|
||||
stringUp.add("");
|
||||
stringDown.add("");
|
||||
}
|
||||
}
|
||||
table.addRow(stringUp);
|
||||
table.addRow(stringDown);
|
||||
|
||||
List<String> stringList=new ArrayList<>();
|
||||
stringList.add("+1 Food");
|
||||
stringList.add("-1 Food / -2 Prestige");
|
||||
table.addRow(stringList);
|
||||
return "TURN ORDER\n" + table.build() + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,21 +57,29 @@ public class Order3 extends OrderLogicCard {
|
||||
{
|
||||
|
||||
var table = new AsciiTable(BorderStyle.UNICODE, 3);
|
||||
List<Player> tempPlayer=new ArrayList<>(players);
|
||||
List<String> stringList=new ArrayList<>();
|
||||
|
||||
List<String> stringUp=new ArrayList<>();
|
||||
List<String> stringDown=new ArrayList<>();
|
||||
for(int i=0;i<3;i++)
|
||||
{
|
||||
try {
|
||||
tempPlayer.get(i);
|
||||
stringList.add(i+". "+tempPlayer.get(i).getUserName());
|
||||
playerList.get(i);
|
||||
stringUp.add(i+". "+playerList.get(i).player.getUserName());
|
||||
if(playerList.get(i).played)
|
||||
stringDown.add(" Placed");
|
||||
else
|
||||
stringDown.add(" Not Placed");
|
||||
}
|
||||
catch (IndexOutOfBoundsException e) {
|
||||
stringList.add(i+". ");
|
||||
stringUp.add("");
|
||||
stringDown.add("");
|
||||
}
|
||||
}
|
||||
table.addRow(stringList);
|
||||
stringList=new ArrayList<>();
|
||||
table.addRow(stringUp);
|
||||
table.addRow(stringDown);
|
||||
|
||||
List<String> stringList=new ArrayList<>();
|
||||
|
||||
stringList.add("+2 Food");
|
||||
stringList.add(" --");
|
||||
stringList.add("-1 Food / -2 Prestige");
|
||||
|
||||
@@ -2,8 +2,11 @@ package it.polimi.ingsw.gc14.Model.Orders;
|
||||
|
||||
import it.polimi.ingsw.gc14.Model.OrderLogicCard;
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
import it.polimi.ingsw.gc14.View.TUI.AsciiTable;
|
||||
import it.polimi.ingsw.gc14.View.TUI.BorderStyle;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
public class Order4 extends OrderLogicCard {
|
||||
@@ -57,4 +60,37 @@ public class Order4 extends OrderLogicCard {
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
|
||||
var table = new AsciiTable(BorderStyle.UNICODE, 4);
|
||||
List<String> stringUp=new ArrayList<>();
|
||||
List<String> stringDown=new ArrayList<>();
|
||||
for(int i=0;i<4;i++)
|
||||
{
|
||||
try {
|
||||
playerList.get(i);
|
||||
stringUp.add(i+". "+playerList.get(i).player.getUserName());
|
||||
if(playerList.get(i).played)
|
||||
stringDown.add(" Placed");
|
||||
else
|
||||
stringDown.add(" Not Placed");
|
||||
}
|
||||
catch (IndexOutOfBoundsException e) {
|
||||
stringUp.add("");
|
||||
stringDown.add("");
|
||||
}
|
||||
}
|
||||
table.addRow(stringUp);
|
||||
table.addRow(stringDown);
|
||||
|
||||
List<String> stringList=new ArrayList<>();
|
||||
stringList.add("+2 Food");
|
||||
stringList.add("+1 Food");
|
||||
stringList.add(" --");
|
||||
stringList.add("-1 Food / -2 Prestige");
|
||||
table.addRow(stringList);
|
||||
return "TURN ORDER\n" + table.build() + "\n";
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,11 @@ package it.polimi.ingsw.gc14.Model.Orders;
|
||||
|
||||
import it.polimi.ingsw.gc14.Model.OrderLogicCard;
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
import it.polimi.ingsw.gc14.View.TUI.AsciiTable;
|
||||
import it.polimi.ingsw.gc14.View.TUI.BorderStyle;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
public class Order5 extends OrderLogicCard {
|
||||
@@ -58,4 +61,38 @@ public class Order5 extends OrderLogicCard {
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
|
||||
var table = new AsciiTable(BorderStyle.UNICODE, 5);
|
||||
List<String> stringUp=new ArrayList<>();
|
||||
List<String> stringDown=new ArrayList<>();
|
||||
for(int i=0;i<5;i++)
|
||||
{
|
||||
try {
|
||||
playerList.get(i);
|
||||
stringUp.add(i+". "+playerList.get(i).player.getUserName());
|
||||
if(playerList.get(i).played)
|
||||
stringDown.add(" Placed");
|
||||
else
|
||||
stringDown.add(" Not Placed");
|
||||
}
|
||||
catch (IndexOutOfBoundsException e) {
|
||||
stringUp.add("");
|
||||
stringDown.add("");
|
||||
}
|
||||
}
|
||||
table.addRow(stringUp);
|
||||
table.addRow(stringDown);
|
||||
|
||||
List<String> stringList=new ArrayList<>();
|
||||
stringList.add("+3 Food");
|
||||
stringList.add("+1 Food");
|
||||
stringList.add(" --");
|
||||
stringList.add(" --");
|
||||
stringList.add("-1 Food / -2 Prestige");
|
||||
table.addRow(stringList);
|
||||
return "TURN ORDER\n" + table.build() + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package it.polimi.ingsw.gc14.Model.Orders;
|
||||
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
|
||||
/**
|
||||
* Abstract base class for all order logic cards.
|
||||
* An OrderLogicCard manages a queue of players and defines the effects
|
||||
* applied when players are pushed back into the queue.
|
||||
*/
|
||||
public class OrderPlayer{
|
||||
public Player player;
|
||||
public boolean played;
|
||||
public OrderPlayer(Player player,boolean played){
|
||||
this.player=player;
|
||||
this.played=played;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return player.getUserName()+" "+played;
|
||||
}
|
||||
}
|
||||
@@ -152,7 +152,25 @@ public class Slot implements Serializable {
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return ("SlotID: "+this.getSlotId()+"\nNUpper: "+this.getNUpper()+"\nNLower: "+this.getNLower()+"\nFood: "+this.getFood()+"\nNMinPlayer: "+this.getNMinPlayer()+"\n");
|
||||
return ("SlotID: "+this.getSlotId()+"\nNUpper: "+this.getNUpper()+"\nNLower: "+this.getNLower()+"\nFood: "+this.getFood()+"\n");
|
||||
}
|
||||
|
||||
|
||||
public String toStringTUI()
|
||||
{
|
||||
StringBuilder s = new StringBuilder();
|
||||
s.append(this.getSlotId()+" ");
|
||||
for(int i=0;i<this.getNUpper();i++)
|
||||
{
|
||||
s.append("↑");
|
||||
}
|
||||
for(int i=0;i<this.getNLower();i++)
|
||||
{
|
||||
s.append("↓");
|
||||
}
|
||||
if(getFood()!=0)
|
||||
s.append("+"+getFood()+" Food");
|
||||
return s.toString();
|
||||
}
|
||||
|
||||
// End Constructors
|
||||
|
||||
@@ -141,9 +141,12 @@ class GameTest {
|
||||
countCards++;
|
||||
}
|
||||
cards=game.getUpperListTribeCards();
|
||||
try {
|
||||
index = cards.indexOf(cards.stream().filter(TribeCard::IsEventCard).findFirst().get());
|
||||
assertFalse(game.DrawUpperTribeCardByIndex(temp_player, index));
|
||||
}catch (Exception e) {
|
||||
|
||||
index=cards.indexOf(cards.stream().filter(TribeCard::IsEventCard).findFirst().get());
|
||||
assertFalse(game.DrawUpperTribeCardByIndex(temp_player,index));
|
||||
}
|
||||
//index=cards.indexOf(cards.stream().filter(x->!x.IsEventCard()).findFirst().get());
|
||||
//assertTrue(game.DrawUpperTribeCardByIndex(temp_player,index));
|
||||
List<BuildingCard> buildings=game.getUpperListBuilding();
|
||||
@@ -195,4 +198,27 @@ class GameTest {
|
||||
@Test
|
||||
void noOptionalCard() {
|
||||
}
|
||||
@Test
|
||||
void toStringModel()
|
||||
{
|
||||
Game game=new Game(5);
|
||||
Player p1=new Player("p1");
|
||||
Player p2=new Player("p2");
|
||||
Player p3=new Player("p3");
|
||||
Player p4=new Player("p4");
|
||||
Player p5=new Player("p5");
|
||||
|
||||
assertTrue(game.addPlayer(p1));
|
||||
assertTrue(game.addPlayer(p2));
|
||||
assertTrue(game.addPlayer(p3));
|
||||
assertTrue(game.addPlayer(p4));
|
||||
assertTrue(game.addPlayer(p5));
|
||||
|
||||
Queue<Player>players=new LinkedList<>();
|
||||
for(int i=0;i<5;i++) {
|
||||
players.add( game.getCurrentState().getCurrentPlayer());
|
||||
assertTrue(game.SlotChoiceByIndex(game.getCurrentState().getCurrentPlayer(), i));
|
||||
}
|
||||
System.out.println(game);
|
||||
}
|
||||
}
|
||||
@@ -4,9 +4,10 @@ import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class Order2Test {
|
||||
@@ -154,4 +155,16 @@ class Order2Test {
|
||||
assertEquals(p1, order.getFirst());
|
||||
assertEquals(p1, order.getFirst());
|
||||
}
|
||||
@Test
|
||||
void toStringTest() throws NoSuchFieldException, IllegalAccessException {
|
||||
Player p1 = new Player("wPIshEUhiOpRRnIBFfM89s2$@q$9FGbz");
|
||||
Player p2 = new Player("L*Ncw1rjjrF2xn%H@4P1iC@&NNIooQQk");
|
||||
Order2 order = new Order2(new ArrayList<>(Arrays.asList(p1, p2)));
|
||||
order.pull();
|
||||
order.pull();
|
||||
order.push(p2);
|
||||
order.push(p1);
|
||||
order.pull().getUserName();
|
||||
System.out.println(order);
|
||||
}
|
||||
}
|
||||
@@ -4,9 +4,10 @@ import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class Order3Test {
|
||||
@@ -206,5 +207,30 @@ class Order3Test {
|
||||
assertEquals(p1, order.getFirst());
|
||||
assertEquals(p1, order.getFirst());
|
||||
}
|
||||
@Test
|
||||
void toStringTest() throws NoSuchFieldException, IllegalAccessException {
|
||||
Player p1 = new Player("wPIshEUhiOpRRnIBFfM89s2$@q$9FGbz");
|
||||
Player p2 = new Player("L*Ncw1rjjrF2xn%H@4P1iC@&NNIooQQk");
|
||||
Player p3 = new Player("L*Ncw1ryyrF2xn%H@4P1iC@&NNIooQQk");
|
||||
Order3 order = new Order3(new ArrayList<>(Arrays.asList(p1, p2,p3)));
|
||||
Field field = Order3.class.getSuperclass().getDeclaredField("playerList");
|
||||
field.setAccessible(true);
|
||||
List<OrderPlayer> values =(ArrayList<OrderPlayer>)field.get(order);
|
||||
|
||||
String userPulled=order.pull().getUserName();
|
||||
userPulled=order.pull().getUserName();
|
||||
userPulled=order.pull().getUserName();
|
||||
|
||||
System.out.println(values);
|
||||
order.push(p1);
|
||||
order.push(p2);
|
||||
values =(ArrayList<OrderPlayer>)field.get(order);
|
||||
System.out.println(order);
|
||||
// assertEquals("TURN ORDER\n" +
|
||||
// "╔════════════════════════════════════╦════════════════════════════════════╦════════════════════════════════════╗\n" +
|
||||
// "║ 0. ║ 1. "+values.get(1).getUserName() +"║ 2. "+values.get(2).getUserName()+"║\n" +
|
||||
// "║ +2 Food ║ -- ║ -1 Food / -2 Prestige ║\n"+
|
||||
// "╚════════════════════════════════════╩════════════════════════════════════╩════════════════════════════════════╝\n", order.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,10 @@ import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class Order4Test {
|
||||
@@ -272,22 +273,14 @@ class Order4Test {
|
||||
}
|
||||
|
||||
@Test
|
||||
void getFirst() {
|
||||
Player p1 = new Player("p1");
|
||||
Player p2 = new Player("p2");
|
||||
Player p3 = new Player("p3");
|
||||
Player p4 = new Player("p4");
|
||||
Order4 order = new Order4(new ArrayList<>(Arrays.asList(p1, p2, p3, p4)));
|
||||
void toStringTest() throws NoSuchFieldException, IllegalAccessException {
|
||||
Player p1 = new Player("wPIshNQhiOpRRnIBFfM89s2$@q$9FGbz");
|
||||
Player p2 = new Player("L*Ncw1rjjrF2xn%H@4P1iC@&NNIooQQk");
|
||||
Player p3 = new Player("wPIshEUhiOpRRnIBFfM89s2$@q$9FGbz");
|
||||
Player p4 = new Player("wPIshOThiOpRRnIBFfM89s2$@q$9FGbz");
|
||||
Order4 order = new Order4(new ArrayList<>(Arrays.asList(p1, p2,p3,p4)));
|
||||
String userPulled=order.pull().getUserName();
|
||||
System.out.println(order);
|
||||
|
||||
order.pull();
|
||||
order.pull();
|
||||
order.pull();
|
||||
order.pull();
|
||||
assertNull(order.getFirst());
|
||||
|
||||
order.push(p1);
|
||||
|
||||
assertEquals(p1, order.getFirst());
|
||||
assertEquals(p1, order.getFirst());
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import it.polimi.ingsw.gc14.Model.Player;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
@@ -364,6 +365,23 @@ class Order5Test {
|
||||
assertEquals(p1, order.getFirst());
|
||||
assertEquals(p1, order.getFirst());
|
||||
}
|
||||
@Test
|
||||
void toStringTest() throws NoSuchFieldException, IllegalAccessException {
|
||||
Player p1 = new Player("wPIshUEhiOpRRnIBFfM89s2$@q$9FGbz");
|
||||
Player p2 = new Player("L*Ncw1rjjrF2xn%H@4P1iC@&NNIooQQk");
|
||||
Player p3 = new Player("wPIshOUhiOpRRnIBFfM89s2$@q$9FGbz");
|
||||
Player p4 = new Player("wPIshNUhiOpRRnIBFfM89s2$@q$9FGbz");
|
||||
Player p5 = new Player("wPIshKUhiOpRRnIBFfM89s2$@q$9FGbz");
|
||||
Order5 order = new Order5(new ArrayList<>(Arrays.asList(p1, p2,p3,p4,p5)));
|
||||
order.pull();
|
||||
order.pull();
|
||||
order.pull();
|
||||
order.pull();
|
||||
order.pull();
|
||||
order.push(p1);
|
||||
System.out.println(order);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -46,7 +46,8 @@ class SlotTest {
|
||||
assertEquals(0, s.getNLower());
|
||||
assertEquals(0, s.getNUpper());
|
||||
assertEquals(5, s.getNMinPlayer());
|
||||
assertEquals("SlotID: "+slotID+"\nNUpper: "+s.getNUpper()+"\nNLower: "+s.getNLower()+"\nFood: "+s.getFood()+"\nNMinPlayer: "+s.getNMinPlayer()+"\n", s.toString());
|
||||
System.out.println(s);
|
||||
assertEquals("SlotID: "+slotID+"\nNUpper: "+s.getNUpper()+"\nNLower: "+s.getNLower()+"\nFood: "+s.getFood()+"\n", s.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -59,7 +60,8 @@ class SlotTest {
|
||||
assertEquals(1, s.getNLower());
|
||||
assertEquals(0, s.getNUpper());
|
||||
assertEquals(0, s.getNMinPlayer());
|
||||
assertEquals("SlotID: "+slotID+"\nNUpper: "+s.getNUpper()+"\nNLower: "+s.getNLower()+"\nFood: "+s.getFood()+"\nNMinPlayer: "+s.getNMinPlayer()+"\n", s.toString());
|
||||
System.out.println(s);
|
||||
assertEquals("SlotID: "+slotID+"\nNUpper: "+s.getNUpper()+"\nNLower: "+s.getNLower()+"\nFood: "+s.getFood()+"\n", s.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -72,8 +74,8 @@ class SlotTest {
|
||||
assertEquals(0, s.getNLower());
|
||||
assertEquals(1, s.getNUpper());
|
||||
assertEquals(0, s.getNMinPlayer());
|
||||
assertEquals("SlotID: "+slotID+"\nNUpper: "+s.getNUpper()+"\nNLower: "+s.getNLower()+"\nFood: "+s.getFood()+"\nNMinPlayer: "+s.getNMinPlayer()+"\n", s.toString());
|
||||
}
|
||||
System.out.println(s);
|
||||
assertEquals("SlotID: "+slotID+"\nNUpper: "+s.getNUpper()+"\nNLower: "+s.getNLower()+"\nFood: "+s.getFood()+"\n", s.toString()); }
|
||||
|
||||
@Test
|
||||
void SlotIdD() {
|
||||
@@ -85,7 +87,8 @@ class SlotTest {
|
||||
assertEquals(2, s.getNLower());
|
||||
assertEquals(0, s.getNUpper());
|
||||
assertEquals(3, s.getNMinPlayer());
|
||||
assertEquals("SlotID: "+slotID+"\nNUpper: "+s.getNUpper()+"\nNLower: "+s.getNLower()+"\nFood: "+s.getFood()+"\nNMinPlayer: "+s.getNMinPlayer()+"\n", s.toString());
|
||||
System.out.println(s);
|
||||
assertEquals("SlotID: "+slotID+"\nNUpper: "+s.getNUpper()+"\nNLower: "+s.getNLower()+"\nFood: "+s.getFood()+"\n", s.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -98,7 +101,8 @@ class SlotTest {
|
||||
assertEquals(1, s.getNLower());
|
||||
assertEquals(1, s.getNUpper());
|
||||
assertEquals(0, s.getNMinPlayer());
|
||||
assertEquals("SlotID: "+slotID+"\nNUpper: "+s.getNUpper()+"\nNLower: "+s.getNLower()+"\nFood: "+s.getFood()+"\nNMinPlayer: "+s.getNMinPlayer()+"\n", s.toString());
|
||||
System.out.println(s);
|
||||
assertEquals("SlotID: "+slotID+"\nNUpper: "+s.getNUpper()+"\nNLower: "+s.getNLower()+"\nFood: "+s.getFood()+"\n", s.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -111,7 +115,8 @@ class SlotTest {
|
||||
assertEquals(0, s.getNLower());
|
||||
assertEquals(2, s.getNUpper());
|
||||
assertEquals(0, s.getNMinPlayer());
|
||||
assertEquals("SlotID: "+slotID+"\nNUpper: "+s.getNUpper()+"\nNLower: "+s.getNLower()+"\nFood: "+s.getFood()+"\nNMinPlayer: "+s.getNMinPlayer()+"\n", s.toString());
|
||||
System.out.println(s);
|
||||
assertEquals("SlotID: "+slotID+"\nNUpper: "+s.getNUpper()+"\nNLower: "+s.getNLower()+"\nFood: "+s.getFood()+"\n", s.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -124,6 +129,7 @@ class SlotTest {
|
||||
assertEquals(1, s.getNLower());
|
||||
assertEquals(2, s.getNUpper());
|
||||
assertEquals(4, s.getNMinPlayer());
|
||||
assertEquals("SlotID: "+slotID+"\nNUpper: "+s.getNUpper()+"\nNLower: "+s.getNLower()+"\nFood: "+s.getFood()+"\nNMinPlayer: "+s.getNMinPlayer()+"\n", s.toString());
|
||||
System.out.println(s);
|
||||
assertEquals("SlotID: "+slotID+"\nNUpper: "+s.getNUpper()+"\nNLower: "+s.getNLower()+"\nFood: "+s.getFood()+"\n", s.toString());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user