Commit 0e4bbc70 authored by Jan Pokorný's avatar Jan Pokorný 💬
Browse files

templated PNS solver

parent fc8a6bcc
#include <iomanip>
#include <iostream>
#include <string>
#include "GameState.hpp"
#include "PNS.hpp"
#include "Qubic.hpp"
#include "ConnectFour3D.hpp"
#include "TranspositionTable/TranspositionTableHashed.hpp"
int main(void) {
Qubic::generateLines();
Qubic game;
template <typename Game>
void play(){
Game::generateLines();
Game game;
try {
game = Qubic::loadGame(std::cin);
game = Game::loadGame(std::cin);
} catch (const ParseException& e) {
std::cerr << e.getMessage() << endl;
throw;
}
Node<Qubic> root(game);
TranspositionTableHashed<Qubic> tt(100'000'000);
Node<Game> root(game);
TranspositionTableHashed<Game> tt(100'000'000);
PNS(root, tt);
cout << GameStateToString(root.getGameState()) << endl;
cerr << root.depth << endl;
}
int main(int argc, char ** argv) {
if(argc != 2){
cerr << "Expected 2 arguments, run this program as ./program game" << endl;
return 1;
}
std::string game = argv[1];
if(game == "qubic"){
play<Qubic>();
}else if(game == "cf"){
play<ConnectFour3D>();
} else{
cerr << "unknown game, expected qubic or cf" << endl;
return 1;
}
return 0;
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment