Skip to content
Snippets Groups Projects
Forked from Bariatti Francesco / pingouins
44 commits ahead of the upstream repository.
points_heuristic.cpp 4.27 KiB
#include "points_heuristic.hpp"
#include <iostream>
namespace mcts
{
	float points_heuristic::get_value(const game::penguin& game, uint8_t move) const
	{
		
		
		const std::shared_ptr<game::penguin> played = game::copy(game);																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																											
		const game::penguin_state old_state = played->get_state();																			
		played->play(move);
		const game::penguin_state new_state = played->get_state();
		const bool current_player_is_red = old_state.current_player_red;
			
		int old_score = old_state.score_red;
		int new_score = new_state.score_red;					
		if(!current_player_is_red) {
				old_score = old_state.score_blue;
				new_score = new_state.score_blue;
		}
		return (-2.f + (new_score - old_score));
	}

	int points_heuristic::get_count(const game::penguin& game, uint8_t move) const
	{
		return 10000;																																																																																																																					;
	}
}