Skip to content
Snippets Groups Projects
Commit 67478acb authored by Bariatti Francesco's avatar Bariatti Francesco
Browse files

Test morpion player vs player added

parent a0f4e7b9
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@ BIN=bin
INCLUDE=-I src/game -I src/util -I src/monte_carlo -I src/mcts -I src/minmax
CFLAGS=-g -O3 -ffast-math -fopenmp -c -Wall -std=c++11 $(INCLUDE)
LDFLAGS=-fopenmp -std=c++11 #-lprofiler -Wl,-no_pie
SOURCES=omp_util.cpp fast_log.cpp display_node.cpp morpion.cpp connect4.cpp test_connect4.cpp monte_carlo.cpp test_monte_carlo.cpp test_fast_log.cpp\
SOURCES=omp_util.cpp fast_log.cpp display_node.cpp morpion.cpp test_morpion.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
OBJECTS=$(addprefix $(BIN)/, $(SOURCES:.cpp=.o))
......
#include "morpion.hpp"
#include "test_morpion.hpp"
#include <iostream>
#include <map>
using namespace std;
namespace game
{
test_morpion::test_morpion()
{
play();
}
void test_morpion::play()
{
morpion mor;
cout << "Player vs Player game!" << endl;
while(!mor.end_of_game())
{
cout << mor << endl;
cout << "It's" << mor.player_to_string(mor.current_player()) << "turn." << endl;
map<string, int> m;
uint64_t possible_moves = mor.get_state().possible_moves;
for (int i = 0; i < mor.number_of_moves(); i++)
{
uint16_t move = possible_moves & ((uint64_t) 15); //15 = 1111 (a move is on 4 bits)
cout << "Possible move: " << mor.move_to_string(move) << endl;
m[mor.move_to_string(move)] = i; //In the map: the move as seen by the player and its index in possible moves
possible_moves = possible_moves >> 4;
}
}
}
}
#ifndef __TEST_MORPION_HPP__
#define __TEST_MORPION_HPP__
namespace game
{
class test_morpion
{
//void playout();
void play();
public:
test_morpion();
};
}
#endif
#include "test_connect4.hpp"
//#include "test_connect4.hpp"
#include "test_morpion.hpp"
#include "test_monte_carlo.hpp"
#include "test_fast_log.hpp"
#include "test_allocator.hpp"
......@@ -13,14 +14,15 @@ 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);
mcts::test_mcts_two_players();
// minmax::test_minmax();
//util::test_bits(200000000);
//game::connect4 c4;
// util::learning::display_file(c4, "learning_examples.txt");
return 0;
// game::test_connect4();
game::test_morpion();
// util::test_fast_log(100000000);
// mcts::test_allocator(10, 2);
// omp_set_num_threads(8);
//mcts::test_mcts_two_players();
// minmax::test_minmax();
//util::test_bits(200000000);
//game::connect4 c4;
// util::learning::display_file(c4, "learning_examples.txt");
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment