Browse Source

Refactor Game and GameTest

AIPlayer
Jonas Wagner 3 years ago
parent
commit
0c86133258
  1. 7
      src/main/java/Game.java
  2. 2
      src/test/java/GameTest.java

7
src/main/java/Game.java

@ -1,6 +1,4 @@
import java.sql.SQLOutput;
import java.util.ArrayList;
import java.util.Iterator;
public class Game {
@ -53,17 +51,12 @@ public class Game {
public int checkFieldClear(int posToCheck, Player p, Game g) {
int mode;
for (Player currentPlayer : g.players) {
//System.out.println("Player");
if (currentPlayer.name.equals(p.name)) {
System.out.println("TEST");
mode = 2;
} else {
System.out.println("TEST2");
mode = 1;
}
for (Figure f : currentPlayer.figures) {
//System.out.println("Figure");
System.out.println(f.getPosition());
if (posToCheck == f.getPosition()) {
return mode;
}

2
src/test/java/GameTest.java

@ -15,14 +15,12 @@ public class GameTest {
private Game g;
private Player p1;
private Player p2;
@BeforeEach
void setup() {
g = new Game();
p1 = new Player("Rot", 1, 40, 43);
p2 = new Player("Blau",10, 44, 47);
}
@ParameterizedTest

Loading…
Cancel
Save