diff --git a/Makefile b/Makefile index 069562bb783948a35b313161356607d06fe25a5f..dd2fa5237f1358355c037026205e6f9a43d0c07a 100644 --- a/Makefile +++ b/Makefile @@ -1,30 +1,42 @@ +# Compiler CC=g++ +# Output directory BIN=bin -INCLUDE=-I src/game -I src/util -I src/monte_carlo -I src/mcts -I src/minmax -I src/json -CFLAGS=-g -O3 -ffast-math -fopenmp -c -Wall -std=c++11 $(INCLUDE) +# Name of the executable +EXECUTABLE=$(BIN)/penguin +# Directories with .h files +INCLUDE=-I src/game -I src/util -I src/monte_carlo -I src/mcts -I src/json +# Directories in which make will search for files +vpath %.cpp src/game src/main src/util src/monte_carlo src/mcts src/gdl +# Flags passed to the compiler +CFLAGS=-g -O3 -ffast-math -fopenmp -Wall -std=c++11 +# Flags passed to the linker LDFLAGS=-fopenmp -std=c++11 #-lprofiler -Wl,-no_pie -SOURCES=omp_util.cpp fast_log.cpp display_node.cpp penguin.cpp connect4.cpp morpion.cpp test_two_players_game.cpp test_connect4.cpp monte_carlo.cpp test_monte_carlo.cpp test_fast_log.cpp\ -statistics.cpp node.cpp allocator.cpp test_allocator.cpp openings.cpp mcts_two_players.cpp test_mcts_two_players.cpp test_minmax.cpp\ -bits.cpp test_bits.cpp main.cpp +# Cpp source files +SOURCES=omp_util.cpp fast_log.cpp display_node.cpp penguin.cpp test_two_players_game.cpp monte_carlo.cpp \ + test_fast_log.cpp statistics.cpp node.cpp allocator.cpp test_allocator.cpp openings.cpp mcts_two_players.cpp \ + test_mcts_two_players.cpp bits.cpp test_bits.cpp main.cpp +# Generating .o files' names OBJECTS=$(addprefix $(BIN)/, $(SOURCES:.cpp=.o)) -EXECUTABLE=$(BIN)/theturk -vpath %.cpp src/game:src/main:src/util:src/monte_carlo:src/mcts:src/gdl:src/minmax -all: $(EXECUTABLE) +# ========= RULES ============ + +# Creates the output directory and the executable +all: bindir $(EXECUTABLE) + +# Creates the output directory if it doesn't exist +bindir: + mkdir -p $(BIN) $(EXECUTABLE): $(OBJECTS) $(CC) $(LDFLAGS) $(OBJECTS) -o $@ --include $(BIN)/$(OBJECTS:.o=.d) - +# Creates .o files with automatic generation of dependencies (.d) files $(BIN)/%.o: %.cpp - $(CC) -c $(CFLAGS) $< -o $(BIN)/$*.o - $(CC) -MM $(CFLAGS) $< > $(BIN)/$*.d - @mv -f $(BIN)/$*.d $(BIN)/$*.d.tmp - @sed -e 's|.*:|$(BIN)/$*.o:|' < $(BIN)/$*.d.tmp > $(BIN)/$*.d - @sed -e 's/.*://' -e 's/\\$$//' < $(BIN)/$*.d.tmp | fmt -1 | \ - sed -e 's/^ *//' -e 's/$$/:/' >> $(BIN)/$*.d - @rm -f $(BIN)/$*.d.tmp + $(CC) -c $(CFLAGS) $(INCLUDE) -MD -MP $< -o $@ +# Include the dependency files into the makefile +-include $(OBJECTS:.o=.d) +# Deletes .o, .d and the executable clean: rm -f $(BIN)/*.o $(BIN)/*.d $(EXECUTABLE) diff --git a/gui/src/controller/Controller.java b/gui/src/controller/Controller.java index 2739604e6444ee47300a2c8ae3370fd559e26060..872cead2654cf488568b435c32dbe39e23afe565 100644 --- a/gui/src/controller/Controller.java +++ b/gui/src/controller/Controller.java @@ -30,7 +30,7 @@ import java.util.ResourceBundle; public class Controller implements Initializable { - private static final String iaProgramPath = "../bin/theturk"; + private static final String iaProgramPath = "../bin/penguin"; private static final String introMusicFile = "./resource/pingu_theme.wav"; private static final String clickSoundFile = "./resource/clic.wav"; private static final int max1Fish = 30, max2Fish = 20, max3Fish = 10; diff --git a/src/main/main.cpp b/src/main/main.cpp index 181e630022f1aff1effd9e8df4ad5c78175eccc4..2e4300876e79d36372b04aaf2bcff29ff9adf07a 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -1,13 +1,8 @@ -#include "test_connect4.hpp" -#include "connect4.hpp" -#include "morpion.hpp" #include "penguin.hpp" #include "test_two_players_game.hpp" -#include "test_monte_carlo.hpp" #include "test_fast_log.hpp" #include "test_allocator.hpp" #include "test_mcts_two_players.hpp" -#include "test_minmax.hpp" #include "test_bits.hpp" #include "learning.hpp" @@ -17,23 +12,13 @@ using namespace std; int main(int argc, char *argv[]) { - // game::test_connect4(); // util::test_fast_log(100000000); // mcts::test_allocator(10, 2); // omp_set_num_threads(8); - // game::run_test_two_players_game(game::connect4()); - //mcts::run_test_mcts_two_players(game::connect4()); - - //game::run_test_two_players_game(game::morpion()); - //mcts::run_test_mcts_two_players(game::morpion()); - + //game::run_test_two_players_game(game::penguin()); mcts::run_test_mcts_two_players(game::penguin()); - - // minmax::test_minmax(); //util::test_bits(200000000); - //game::connect4 c4; - // util::learning::display_file(c4, "learning_examples.txt"); return 0; }