Worked on Game
This commit is contained in:
parent
09c7e4e41d
commit
4240ac37cd
38
Makefile
Normal file
38
Makefile
Normal file
|
@ -0,0 +1,38 @@
|
|||
JAVA=java
|
||||
JAVAC=javac
|
||||
JAVADOC=javadoc
|
||||
JAR=jar
|
||||
|
||||
JAVAC_OPTIONS=-Xlint:all
|
||||
JAVADOC_OPTIONS=-Xdoclint:all -private -encoding UTF-8 -charset UTF-8 -docencoding UTF-8
|
||||
|
||||
BUILDS=builds
|
||||
DOC=doc
|
||||
CLASSPATH=src
|
||||
LIBARIES=
|
||||
CLASSES=\
|
||||
src/game/Main.java \
|
||||
src/game/Game.java \
|
||||
src/player/Player.java
|
||||
|
||||
OBJECTS=$($(subst $(CLASSPATH),$(BUILDS),$(CLASSES)):.java=.class)
|
||||
|
||||
BUILDFILES=$(OBJECTS) $(FXMLS_BUILD)
|
||||
|
||||
MAIN=game.Main
|
||||
|
||||
|
||||
all: $(CLASSES) $(FXMLS_BUILD)
|
||||
$(JAVAC) $(JAVAC_OPTIONS) -cp $(CLASSPATH):$(LIBARIES) $(CLASSES) -d $(BUILDS)
|
||||
|
||||
run: $(CLASSES)
|
||||
$(JAVA) -cp $(BUILDS):$(LIBARIES) $(MAIN)
|
||||
|
||||
doc: $(CLASSES)
|
||||
$(JAVADOC) $(JAVADOC_OPTIONS) -cp $(CLASSPATH):$(LIBARIES) $(CLASSES) -d $(DOC)
|
||||
|
||||
jar: all
|
||||
$(JAR) -cfe VierGewinnt.jar $(MAIN) -C $(BUILDS) .
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILDS)/* $(DOC)/* VierGewinnt.jar
|
|
@ -1,6 +1,6 @@
|
|||
package game;
|
||||
|
||||
import math.Random;
|
||||
import java.util.Random;
|
||||
|
||||
import player.Player;
|
||||
// import player.Player1;
|
||||
|
@ -10,20 +10,37 @@ public class Game {
|
|||
|
||||
private final Player p1;
|
||||
private final Player p2;
|
||||
private int[][] board;
|
||||
private boolean gameOn;
|
||||
|
||||
public Game(Player p1, Player p2) {
|
||||
this.p1 = p1;
|
||||
this.p2 = p2;
|
||||
this.board = new int [7][6];
|
||||
}
|
||||
|
||||
public void start() {
|
||||
Random ran = new Random();
|
||||
Player first;
|
||||
Player second;
|
||||
if (ran.nextBoolean()) {
|
||||
first = this.p1;
|
||||
second = this.p2;
|
||||
} else {
|
||||
first = this.p2;
|
||||
second = this.p1;
|
||||
}
|
||||
|
||||
|
||||
while(gameOn) {
|
||||
|
||||
makeMove(first);
|
||||
}
|
||||
}
|
||||
|
||||
private void makeMove(Player p) {
|
||||
|
||||
}
|
||||
|
||||
private void log(String s) {
|
||||
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@ package player;
|
|||
|
||||
public interface Player {
|
||||
|
||||
private String name;
|
||||
|
||||
public int move(int[][] game);
|
||||
public String getName();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue