<commit_before>#include "Players/Neural_AI.h"

#include <iostream>
#include <fstream>

#include "Game/Board.h"
#include "Game/Clock.h"

size_t Neural_AI::next_id = 0;

Neural_AI::Neural_AI() : id(next_id++)
{
}

std::string Neural_AI::name() const
{
    return "Neural Net AI";
}

std::string Neural_AI::author() const
{
    return "<NAME>";
}

size_t Neural_AI::get_id() const
{
    return id;
}

void Neural_AI::mutate(int iterations)
{
    brain.mutate(iterations);
}

void Neural_AI::print(const std::string & file_name) const
{
    auto ofs = std::ofstream(file_name, std::ios::app);
    print(ofs);
}

void Neural_AI::print(std::ostream & output) const
{
    output << "ID: " << get_id() << '\n';
    brain.print(output);
}

double Neural_AI::internal_evaluate(const Board& board, Color perspective) const
{
    return brain.evaluate(board, perspective);
}

double Neural_AI::speculation_time_factor(const Board&) const
{
    return 1.0;
}

double Neural_AI::time_to_examine(const Board&, const Clock& clock) const
{
    return clock.time_left(clock.running_for())/30.0;
}<commit_msg>Calibrate thinking speed of Neural AI<commit_after>#include "Players/Neural_AI.h"

#include <iostream>
#include <fstream>

#include "Game/Board.h"
#include "Game/Clock.h"

size_t Neural_AI::next_id = 0;

Neural_AI::Neural_AI() : id(next_id++)
{
    calibrate_thinking_speed();
    calculate_centipawn_value();
}

std::string Neural_AI::name() const
{
    return "Neural Net AI";
}

std::string Neural_AI::author() const
{
    return "<NAME>";
}

size_t Neural_AI::get_id() const
{
    return id;
}

void Neural_AI::mutate(int iterations)
{
    brain.mutate(iterations);

    calibrate_thinking_speed();
    calculate_centipawn_value();
}

void Neural_AI::print(const std::string & file_name) const
{
    auto ofs = std::ofstream(file_name, std::ios::app);
    print(ofs);
}

void Neural_AI::print(std::ostream & output) const
{
    output << "ID: " << get_id() << '\n';
    brain.print(output);
}

double Neural_AI::internal_evaluate(const Board& board, Color perspective) const
{
    return brain.evaluate(board, perspective);
}

double Neural_AI::speculation_time_factor(const Board&) const
{
    return 1.0;
}

double Neural_AI::time_to_examine(const Board&, const Clock& clock) const
{
    return clock.time_left(clock.running_for())/30.0;
}
{'fraction_non_alphanumeric': 0.15160599571734476, 'fraction_numerical': 0.005139186295503212, 'mean_word_length': 5.036175710594315, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7188998', 'n_tokens_mistral': 886, 'n_tokens_neox': 846, 'n_words': 169}