#ifndef MASTERMIND_H
#define MASTERMIND_H

#include <iostream>

#include <ctime>
#include <random>
#include <vector>
#include <algorithm>

#include "crossover.h"

class MasterMind
{
    public:
        MasterMind(int nb_colors, int nb_cases, std::default_random_engine& randomizer);
        MasterMind(int nb_colors, int nb_cases, int* solution, std::default_random_engine& randomizer);

        void set_new_random_solution();
        int* get_random_candidate();
        void display_candidate(int *x);
        int try_candidate(int* candidate);
        int get_max_radius();
        int* modify_with_radius(int* x, int r);
        int* crossover(int* y, void* x, int nb, int* (*selector)(int, void*), int method);
        void copy_candidate(int *x, int *y);
        double get_progress(int* x, int v_x);
        bool is_optimal(int* x, double objective=1.00);
        bool is_optimal(int* x, int v_x, double objective=1.00);
        virtual ~MasterMind();

    protected:

    private:
        int m_nb_colors;
        int m_nb_cases;
        int* m_solution;
        bool m_random_solution;
        std::vector<int> m_permutation;
        std::default_random_engine m_randomizer;
        int* m_vote;
};

#endif // MASTERMIND_H
