#pragma once
#ifndef ROBBIE_HH_
#define ROBBIE_HH_

#include "CoreBase.hh"
#include "RobbieConfig.hh"
#include "SimpleMap.hh"
#include "fstream"

typedef struct RewardPunishmentInfo {
    int reward;
    int punishment_edge;
    int punishment_pick;
} RewardPunishmentInfo;

class Robbie : public CoreBase {
  public:
    Robbie();
    ~Robbie();
    int                  id;
    int                  father;
    int                  mother;
    int                  str_len;
    int                  gene_len;
    int                  loop_cnt;
    int                  generation;
    int                  mutate_val;
    int                  mutate_all;
    float                score;
    float                aver_score;
    vec2i               pos;      // current position
    vector<int>          genes;    // stores all genes of Robbie
    std::vector<vec2i>  strategy; // stratery list
    RewardPunishmentInfo rp_info;

    void Mutate();

    Robbie Clip(Robbie mother, int pos = -1);

    RobbieActionResult Move(RobbieAction act, SimpleMap& map);

    RobbieActionResult Pick(RobbieAction act, SimpleMap& map);

    RobbieActionResult NextStep(SimpleMap& map);

    void PlaySingleMap(SimpleMap& map);

    void PlayMultiMaps(int cnt);

    void Print();

    void Compare(const Robbie& other);

    void Save(string save_path);

    void Load(string load_path);
};

#endif