getPlayer entfernt, weil es getNthNextPlayer gibt. Warnings beseitigt.
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@170 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
8ee379b1ab
commit
82c58a1eae
6 changed files with 32 additions and 30 deletions
|
@ -32,11 +32,6 @@ public class MockGameState implements IGameState {
|
||||||
return players.size();
|
return players.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public IPlayer getPlayer(int i) {
|
|
||||||
return players.get(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Changes the activePlayer to the next {@link Player} in the list */
|
/** Changes the activePlayer to the next {@link Player} in the list */
|
||||||
@Override
|
@Override
|
||||||
public void nextPlayer() {
|
public void nextPlayer() {
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class RoundControl {
|
||||||
|
|
||||||
void deal() {
|
void deal() {
|
||||||
for (int i = 0; i < gameState.getPlayerCount(); i++) {
|
for (int i = 0; i < gameState.getPlayerCount(); i++) {
|
||||||
IHand hand = gameState.getPlayer(i).getHand();
|
IHand hand = gameState.getNthNextPlayer(i).getHand();
|
||||||
for (int j = 0; j < 7; j++) {
|
for (int j = 0; j < 7; j++) {
|
||||||
hand.drop(gameState.getGameHeap().drawStone(), new Position(j, 0));
|
hand.drop(gameState.getGameHeap().drawStone(), new Position(j, 0));
|
||||||
hand.drop(gameState.getGameHeap().drawStone(), new Position(j, 1));
|
hand.drop(gameState.getGameHeap().drawStone(), new Position(j, 1));
|
||||||
|
@ -81,8 +81,6 @@ public class RoundControl {
|
||||||
if (clonedTable.isValid()) {
|
if (clonedTable.isValid()) {
|
||||||
gameState.setTable(clonedTable);
|
gameState.setTable(clonedTable);
|
||||||
|
|
||||||
System.err.println(gameState.getActivePlayer().getName());
|
|
||||||
System.err.println(gameState.getActivePlayer().getHand().getSize());
|
|
||||||
if (gameState.getActivePlayer().getHand().getSize() == 0) {
|
if (gameState.getActivePlayer().getHand().getSize() == 0) {
|
||||||
win();
|
win();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -37,11 +37,6 @@ public class GameState implements IGameState {
|
||||||
return players.size();
|
return players.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public IPlayer getPlayer(int i) {
|
|
||||||
return players.get(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Changes the activePlayer to the next {@link Player} in the list */
|
/** Changes the activePlayer to the next {@link Player} in the list */
|
||||||
@Override
|
@Override
|
||||||
public void nextPlayer() {
|
public void nextPlayer() {
|
||||||
|
|
|
@ -3,12 +3,11 @@ package jrummikub.model;
|
||||||
public interface IGameState {
|
public interface IGameState {
|
||||||
|
|
||||||
public ITable getTable();
|
public ITable getTable();
|
||||||
|
|
||||||
public void setTable(ITable table);
|
public void setTable(ITable table);
|
||||||
|
|
||||||
public int getPlayerCount();
|
public int getPlayerCount();
|
||||||
|
|
||||||
public IPlayer getPlayer(int i);
|
|
||||||
|
|
||||||
/** Changes the activePlayer to the next {@link Player} in the list */
|
/** Changes the activePlayer to the next {@link Player} in the list */
|
||||||
public void nextPlayer();
|
public void nextPlayer();
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ import static jrummikub.model.StoneColor.RED;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertNotSame;
|
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.junit.Assert.assertNull;
|
||||||
import static org.junit.Assert.assertSame;
|
import static org.junit.Assert.assertSame;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
@ -50,7 +49,7 @@ public class RoundControlTest {
|
||||||
- testGameState.table.getSize(), testGameState.getGameHeap()
|
- testGameState.table.getSize(), testGameState.getGameHeap()
|
||||||
.getSize());
|
.getSize());
|
||||||
for (int i = 0; i < testGameState.getPlayerCount(); i++) {
|
for (int i = 0; i < testGameState.getPlayerCount(); i++) {
|
||||||
assertEquals(14, testGameState.getPlayer(i).getHand().getSize());
|
assertEquals(14, testGameState.getNthNextPlayer(i).getHand().getSize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,9 +78,10 @@ public class TurnControlTest {
|
||||||
|
|
||||||
mockView.displayStartTurnPanel = true;
|
mockView.displayStartTurnPanel = true;
|
||||||
|
|
||||||
List<Pair<Stone, Position>> stones = Arrays.asList(
|
List<Pair<Stone, Position>> stones = Arrays
|
||||||
new Pair<Stone, Position>(new Stone(RED), new Position(0, 0)),
|
.asList(new Pair<Stone, Position>(new Stone(RED), new Position(
|
||||||
new Pair<Stone, Position>(new Stone(BLACK), new Position(1, 0)));
|
0, 0)), new Pair<Stone, Position>(new Stone(BLACK),
|
||||||
|
new Position(1, 0)));
|
||||||
|
|
||||||
mockHand.iterable = stones;
|
mockHand.iterable = stones;
|
||||||
|
|
||||||
|
@ -118,7 +119,6 @@ public class TurnControlTest {
|
||||||
assertTrue(mockView.playerPanel.endTurnEvent.listeners.isEmpty());
|
assertTrue(mockView.playerPanel.endTurnEvent.listeners.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void timerEndOfTurn() {
|
public void timerEndOfTurn() {
|
||||||
eventFired = false;
|
eventFired = false;
|
||||||
|
@ -150,7 +150,6 @@ public class TurnControlTest {
|
||||||
assertCollection(new ArrayList<Stone>());
|
assertCollection(new ArrayList<Stone>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void selectStoneInHand() {
|
public void selectStoneInHand() {
|
||||||
|
|
||||||
|
@ -199,8 +198,8 @@ public class TurnControlTest {
|
||||||
mockView.playerPanel.handPanel.stoneClickEvent.emit(firstStone, true);
|
mockView.playerPanel.handPanel.stoneClickEvent.emit(firstStone, true);
|
||||||
mockView.playerPanel.handPanel.stoneClickEvent.emit(secondStone, true);
|
mockView.playerPanel.handPanel.stoneClickEvent.emit(secondStone, true);
|
||||||
|
|
||||||
mockView.tablePanel.stoneCollectionPanel.stoneClickEvent.emit(firstStone,
|
mockView.tablePanel.stoneCollectionPanel.stoneClickEvent.emit(
|
||||||
false);
|
firstStone, false);
|
||||||
|
|
||||||
assertCollection(Arrays.asList(secondStone));
|
assertCollection(Arrays.asList(secondStone));
|
||||||
}
|
}
|
||||||
|
@ -214,8 +213,8 @@ public class TurnControlTest {
|
||||||
mockView.playerPanel.handPanel.stoneClickEvent.emit(firstStone, true);
|
mockView.playerPanel.handPanel.stoneClickEvent.emit(firstStone, true);
|
||||||
mockView.playerPanel.handPanel.stoneClickEvent.emit(secondStone, true);
|
mockView.playerPanel.handPanel.stoneClickEvent.emit(secondStone, true);
|
||||||
|
|
||||||
mockView.tablePanel.stoneCollectionPanel.stoneClickEvent.emit(firstStone,
|
mockView.tablePanel.stoneCollectionPanel.stoneClickEvent.emit(
|
||||||
true);
|
firstStone, true);
|
||||||
|
|
||||||
assertCollection(Arrays.asList(secondStone, firstStone));
|
assertCollection(Arrays.asList(secondStone, firstStone));
|
||||||
}
|
}
|
||||||
|
@ -320,7 +319,8 @@ public class TurnControlTest {
|
||||||
Stone stone2 = new Stone(2, StoneColor.RED);
|
Stone stone2 = new Stone(2, StoneColor.RED);
|
||||||
Stone stone3 = new Stone(3, StoneColor.RED);
|
Stone stone3 = new Stone(3, StoneColor.RED);
|
||||||
Stone stone4 = new Stone(4, StoneColor.RED);
|
Stone stone4 = new Stone(4, StoneColor.RED);
|
||||||
StoneSet set1 = new StoneSet(Arrays.asList(stone1, stone2, stone3, stone4));
|
StoneSet set1 = new StoneSet(Arrays.asList(stone1, stone2, stone3,
|
||||||
|
stone4));
|
||||||
|
|
||||||
mockTable.findStoneSet.put(stone1, set1);
|
mockTable.findStoneSet.put(stone1, set1);
|
||||||
mockTable.findStoneSet.put(stone3, set1);
|
mockTable.findStoneSet.put(stone3, set1);
|
||||||
|
@ -340,7 +340,8 @@ public class TurnControlTest {
|
||||||
Stone stone2 = new Stone(2, StoneColor.RED);
|
Stone stone2 = new Stone(2, StoneColor.RED);
|
||||||
Stone stone3 = new Stone(3, StoneColor.RED);
|
Stone stone3 = new Stone(3, StoneColor.RED);
|
||||||
Stone stone4 = new Stone(4, StoneColor.RED);
|
Stone stone4 = new Stone(4, StoneColor.RED);
|
||||||
StoneSet set1 = new StoneSet(Arrays.asList(stone1, stone2, stone3, stone4));
|
StoneSet set1 = new StoneSet(Arrays.asList(stone1, stone2, stone3,
|
||||||
|
stone4));
|
||||||
|
|
||||||
mockTable.findStoneSet.put(stone1, set1);
|
mockTable.findStoneSet.put(stone1, set1);
|
||||||
mockTable.findStoneSet.put(stone3, set1);
|
mockTable.findStoneSet.put(stone3, set1);
|
||||||
|
@ -402,4 +403,19 @@ public class TurnControlTest {
|
||||||
ArrayList<Stone> expectedStones = new ArrayList<Stone>(expected);
|
ArrayList<Stone> expectedStones = new ArrayList<Stone>(expected);
|
||||||
assertEquals(expectedStones, selectedStones);
|
assertEquals(expectedStones, selectedStones);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void takeLeftStone() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void takeRightStone() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void takeMiddleStone() {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue