Worked on Game

This commit is contained in:
Malte Tammena 2017-10-13 11:04:14 +02:00
parent 09c7e4e41d
commit 4240ac37cd
3 changed files with 57 additions and 4 deletions

38
Makefile Normal file
View 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

View file

@ -1,6 +1,6 @@
package game; package game;
import math.Random; import java.util.Random;
import player.Player; import player.Player;
// import player.Player1; // import player.Player1;
@ -10,20 +10,37 @@ public class Game {
private final Player p1; private final Player p1;
private final Player p2; private final Player p2;
private int[][] board;
private boolean gameOn;
public Game(Player p1, Player p2) { public Game(Player p1, Player p2) {
this.p1 = p1; this.p1 = p1;
this.p2 = p2; this.p2 = p2;
this.board = new int [7][6];
} }
public void start() { public void start() {
Random ran = new Random(); 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) { while(gameOn) {
makeMove(first);
} }
} }
private void makeMove(Player p) {
}
private void log(String s) { private void log(String s) {
} }

View file

@ -2,8 +2,6 @@ package player;
public interface Player { public interface Player {
private String name;
public int move(int[][] game); public int move(int[][] game);
public String getName(); public String getName();
} }