Base AI is now able to meld initially properly
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@346 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
58d58c0c07
commit
061e7ab305
5 changed files with 129 additions and 65 deletions
|
@ -45,9 +45,9 @@ public class TurnControlTest {
|
|||
StoneSet[] getSetArray() {
|
||||
return objects.keySet().toArray(new StoneSet[0]);
|
||||
}
|
||||
|
||||
AccessibleTable (){
|
||||
super (new GameSettings());
|
||||
|
||||
AccessibleTable() {
|
||||
super(new GameSettings());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,8 @@ public class TurnControlTest {
|
|||
mockPlayer = new MockPlayer(null, null);
|
||||
mockPlayer.hand = mockHand;
|
||||
testControl = new HumanTurnControl(mockTimer);
|
||||
testControl.setup(mockPlayer, mockTable, mockView, false, false);
|
||||
testControl.setup(new GameSettings(), mockPlayer, mockTable, mockView,
|
||||
false, false);
|
||||
}
|
||||
|
||||
/** */
|
||||
|
@ -131,15 +132,15 @@ public class TurnControlTest {
|
|||
public void showInitialHand() {
|
||||
mockView.displayStartTurnPanel = true;
|
||||
|
||||
List<Pair<Stone, Position>> stones = Arrays
|
||||
.asList(new Pair<Stone, Position>(new Stone(RED), new Position(
|
||||
0, 0)), new Pair<Stone, Position>(new Stone(BLACK),
|
||||
new Position(1, 0)));
|
||||
List<Pair<Stone, Position>> stones = Arrays.asList(
|
||||
new Pair<Stone, Position>(new Stone(RED), new Position(0, 0)),
|
||||
new Pair<Stone, Position>(new Stone(BLACK), new Position(1, 0)));
|
||||
|
||||
mockHand.iterable = stones;
|
||||
|
||||
testControl = new HumanTurnControl(mockTimer);
|
||||
testControl.setup(mockPlayer, mockTable, mockView, false, false);
|
||||
testControl.setup(new GameSettings(), mockPlayer, mockTable, mockView,
|
||||
false, false);
|
||||
testControl.startTurn();
|
||||
|
||||
int i = 0;
|
||||
|
@ -266,8 +267,8 @@ public class TurnControlTest {
|
|||
mockView.handPanel.stoneClickEvent.emit(firstStone, true);
|
||||
mockView.handPanel.stoneClickEvent.emit(secondStone, true);
|
||||
|
||||
mockView.tablePanel.stoneCollectionPanel.stoneClickEvent.emit(
|
||||
firstStone, false);
|
||||
mockView.tablePanel.stoneCollectionPanel.stoneClickEvent.emit(firstStone,
|
||||
false);
|
||||
|
||||
assertCollection(Arrays.asList(secondStone));
|
||||
}
|
||||
|
@ -283,8 +284,8 @@ public class TurnControlTest {
|
|||
mockView.handPanel.stoneClickEvent.emit(firstStone, true);
|
||||
mockView.handPanel.stoneClickEvent.emit(secondStone, true);
|
||||
|
||||
mockView.tablePanel.stoneCollectionPanel.stoneClickEvent.emit(
|
||||
firstStone, true);
|
||||
mockView.tablePanel.stoneCollectionPanel.stoneClickEvent.emit(firstStone,
|
||||
true);
|
||||
|
||||
assertCollection(Arrays.asList(secondStone, firstStone));
|
||||
}
|
||||
|
@ -300,8 +301,8 @@ public class TurnControlTest {
|
|||
mockView.handPanel.stoneClickEvent.emit(firstStone, true);
|
||||
mockView.handPanel.stoneClickEvent.emit(secondStone, true);
|
||||
|
||||
mockView.tablePanel.stoneCollectionPanel.stoneClickEvent.emit(
|
||||
firstStone, true);
|
||||
mockView.tablePanel.stoneCollectionPanel.stoneClickEvent.emit(firstStone,
|
||||
true);
|
||||
|
||||
mockView.tablePanel.stoneCollectionPanel.setClickEvent.emit(firstStone,
|
||||
true);
|
||||
|
@ -408,8 +409,7 @@ public class TurnControlTest {
|
|||
Stone stone2 = new Stone(2, StoneColor.RED);
|
||||
Stone stone3 = new Stone(3, 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(stone3, set1);
|
||||
|
@ -430,8 +430,7 @@ public class TurnControlTest {
|
|||
Stone stone2 = new Stone(2, StoneColor.RED);
|
||||
Stone stone3 = new Stone(3, 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(stone3, set1);
|
||||
|
@ -454,8 +453,7 @@ public class TurnControlTest {
|
|||
Stone stone2 = new Stone(2, StoneColor.RED);
|
||||
Stone stone3 = new Stone(3, 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(stone3, set1);
|
||||
|
@ -635,7 +633,8 @@ public class TurnControlTest {
|
|||
public void testAddLeft() {
|
||||
AccessibleTable table = new AccessibleTable();
|
||||
HumanTurnControl turnControl = new HumanTurnControl(mockTimer);
|
||||
turnControl.setup(mockPlayer, table, mockView, false, false);
|
||||
turnControl.setup(new GameSettings(), mockPlayer, table, mockView, false,
|
||||
false);
|
||||
turnControl.startTurn();
|
||||
Stone blueOne = new Stone(1, BLUE);
|
||||
Stone redOne = new Stone(1, RED);
|
||||
|
@ -650,10 +649,10 @@ public class TurnControlTest {
|
|||
Stone blackThree = new Stone(3, BLACK);
|
||||
Stone blackFour = new Stone(4, BLACK);
|
||||
Stone blackFive = new Stone(5, BLACK);
|
||||
StoneSet oldSet1 = new StoneSet(Arrays.asList(blueOne, redOne,
|
||||
blackOne, redTwo, redThree, redFour, blackTwo, blackThree));
|
||||
StoneSet oldSet2 = new StoneSet(Arrays.asList(blueTwo, blackFour,
|
||||
blackFive));
|
||||
StoneSet oldSet1 = new StoneSet(Arrays.asList(blueOne, redOne, blackOne,
|
||||
redTwo, redThree, redFour, blackTwo, blackThree));
|
||||
StoneSet oldSet2 = new StoneSet(
|
||||
Arrays.asList(blueTwo, blackFour, blackFive));
|
||||
table.drop(oldSet1, new Position(0, 0));
|
||||
table.drop(oldSet2, new Position(0, 0));
|
||||
mockHand.drop(blueThree, new Position(0, 0));
|
||||
|
@ -752,7 +751,8 @@ public class TurnControlTest {
|
|||
public void testAddRight() {
|
||||
AccessibleTable table = new AccessibleTable();
|
||||
HumanTurnControl turnControl = new HumanTurnControl(mockTimer);
|
||||
turnControl.setup(mockPlayer, table, mockView, false, false);
|
||||
turnControl.setup(new GameSettings(), mockPlayer, table, mockView, false,
|
||||
false);
|
||||
turnControl.startTurn();
|
||||
Stone blueOne = new Stone(1, BLUE);
|
||||
Stone redOne = new Stone(1, RED);
|
||||
|
@ -767,10 +767,10 @@ public class TurnControlTest {
|
|||
Stone blackThree = new Stone(3, BLACK);
|
||||
Stone blackFour = new Stone(4, BLACK);
|
||||
Stone blackFive = new Stone(5, BLACK);
|
||||
StoneSet oldSet1 = new StoneSet(Arrays.asList(blueOne, redOne,
|
||||
blackOne, redTwo, redThree, redFour, blackTwo, blackThree));
|
||||
StoneSet oldSet2 = new StoneSet(Arrays.asList(blueTwo, blackFour,
|
||||
blackFive));
|
||||
StoneSet oldSet1 = new StoneSet(Arrays.asList(blueOne, redOne, blackOne,
|
||||
redTwo, redThree, redFour, blackTwo, blackThree));
|
||||
StoneSet oldSet2 = new StoneSet(
|
||||
Arrays.asList(blueTwo, blackFour, blackFive));
|
||||
table.drop(oldSet1, new Position(0, 0));
|
||||
table.drop(oldSet2, new Position(0, 0));
|
||||
mockHand.drop(blueThree, new Position(0, 0));
|
||||
|
@ -869,7 +869,8 @@ public class TurnControlTest {
|
|||
public void testAddNewSet() {
|
||||
AccessibleTable table = new AccessibleTable();
|
||||
HumanTurnControl turnControl = new HumanTurnControl(mockTimer);
|
||||
turnControl.setup(mockPlayer, table, mockView, false, false);
|
||||
turnControl.setup(new GameSettings(), mockPlayer, table, mockView, false,
|
||||
false);
|
||||
turnControl.startTurn();
|
||||
Stone blueOne = new Stone(1, BLUE);
|
||||
Stone redOne = new Stone(1, RED);
|
||||
|
@ -884,10 +885,10 @@ public class TurnControlTest {
|
|||
Stone blackThree = new Stone(3, BLACK);
|
||||
Stone blackFour = new Stone(4, BLACK);
|
||||
Stone blackFive = new Stone(5, BLACK);
|
||||
StoneSet oldSet1 = new StoneSet(Arrays.asList(blueOne, redOne,
|
||||
blackOne, redTwo, redThree, redFour, blackTwo, blackThree));
|
||||
StoneSet oldSet2 = new StoneSet(Arrays.asList(blueTwo, blackFour,
|
||||
blackFive));
|
||||
StoneSet oldSet1 = new StoneSet(Arrays.asList(blueOne, redOne, blackOne,
|
||||
redTwo, redThree, redFour, blackTwo, blackThree));
|
||||
StoneSet oldSet2 = new StoneSet(
|
||||
Arrays.asList(blueTwo, blackFour, blackFive));
|
||||
table.drop(oldSet1, new Position(0, 0));
|
||||
table.drop(oldSet2, new Position(0, 0));
|
||||
mockHand.drop(blueThree, new Position(0, 0));
|
||||
|
@ -991,8 +992,8 @@ public class TurnControlTest {
|
|||
|
||||
List<Pair<Stone, Position>> stones = new ArrayList<Pair<Stone, Position>>(
|
||||
mockHand.stones);
|
||||
Collections.sort(stones,
|
||||
new HumanTurnControl.HandStonePositionComparator());
|
||||
Collections
|
||||
.sort(stones, new HumanTurnControl.HandStonePositionComparator());
|
||||
|
||||
assertEquals(stones.size(), 13);
|
||||
|
||||
|
@ -1053,8 +1054,8 @@ public class TurnControlTest {
|
|||
|
||||
List<Pair<Stone, Position>> stones = new ArrayList<Pair<Stone, Position>>(
|
||||
mockHand.stones);
|
||||
Collections.sort(stones,
|
||||
new HumanTurnControl.HandStonePositionComparator());
|
||||
Collections
|
||||
.sort(stones, new HumanTurnControl.HandStonePositionComparator());
|
||||
|
||||
assertEquals(stones.size(), 13);
|
||||
|
||||
|
|
Reference in a new issue