Forked from
Bariatti Francesco / pingouins
148 commits behind the upstream repository.
-
Gaste Adrien authoredGaste Adrien authored
morpion.cpp 2.94 KiB
#include "morpion.hpp"
#include <sstream>
using namespace std;
namespace game
{
static vector<vector<uint64_t>> create_hash_values()
{
default_random_engine generator;
uniform_int_distribution<uint64_t> distribution;
vector<vector<uint64_t>> res(7, vector<uint64_t>(6, 0));
for (int i = 0; i < 7; ++i)
{
for (int j = 0; j < 6; ++j)
{
res[i][j] = distribution(generator);
}
}
return res;
}
vector<vector<uint64_t>> morpion::cross_hash_values = create_hash_values();
vector<vector<uint64_t>> morpion::circle_hash_values = create_hash_values();
morpion::morpion()
{
}
shared_ptr<game<morpion_state>> morpion::do_copy() const
{
return shared_ptr<morpion>(new morpion(*this));
}
morpion_state morpion::get_state()
{
return state;
}
void morpion::set_state(const morpion_state& s)
{
state = s;
}
bool morpion::end_of_game() const
{
//TODO: Implement
return false;
}
bool morpion::won(std::uint8_t player) const
{
//TODO: Implement
return false;
}
bool morpion::lost(std::uint8_t player) const
{
//TODO: Implement
return false;
}
bool morpion::draw(std::uint8_t player) const
{
//TODO: Implement
return false;
}
uint8_t morpion::current_player() const
{
//TODO: Implement
return 0;
}
int morpion::value(uint8_t player) const
{
if (player == CROSS) {
return state.first_player_win? 1 : (state.second_player_win? -1 : 0)
}
else if (player == CIRCLE) {
return state.second_player_win? 1 : (state.first_player_win? -1 : 0)
}
return 0;
}
uint16_t morpion::number_of_moves() const
{
//TODO: Implement
return 0;
}
bool morpion::get(uint64_t bitboard, uint8_t col, uint8_t row) const
{
//TODO: Implement
return false;
}
//#define set(bitboard, col, row) (bitboard |= (1LL << (((col) << 3) + (row))))
void morpion::update_win()
{
//TODO: Implement
}
bool morpion::has_won(uint64_t bitboard)
{
//TODO: Implement
return false;
}
void morpion::update_moves(uint16_t move)
{
//TODO: Implement
}
void morpion::play(uint16_t m)
{
//TODO: Implement
}
string morpion::player_to_string(uint8_t player) const
{
//TODO: Implement
return "TODO";
}
string morpion::move_to_string(uint16_t m) const
{
//TODO: Implement
return "TODO";
}
set<int> morpion::to_input_vector() const
{
return set<int>();
}
void morpion::from_input_vector(const std::set<int>& input)
{
}
string morpion::to_string() const
{
//TODO: Implement
return "TODO";
}
void morpion::playout(mt19937& engine, int max_depth)
{
while (!end_of_game())
{
uniform_int_distribution<uint16_t> distribution(0, number_of_moves() - 1);
uint16_t move = distribution(engine);
play(move);
}
}
std::uint64_t morpion::hash() const
{
//TODO: Implement
return 0;
}
std::uint64_t morpion::hash(std::uint16_t m) const
{
//TODO: Implement
return 0;
}
ostream& operator<<(ostream& os, const morpion& mor)
{
os << mor.to_string() << endl;
return os;
}
}