<commit_before>#pragma once

#include <string>
#include <unordered_map>
#include <vector>

#include <glm/glm.hpp>
#include <asdfm/utilities/utilities.h>
#include <plantgen/plant_generator.h>

namespace fast_travel_sim
{
    using pregen_node_t = plantgen::pregen_node_t;
    using generated_node_t = plantgen::generated_node_t;

    struct journal_entry_t;

    enum terrain_grade_e
    {
        terrain_flat = 0
      , terrain_hilly
      , terrain_mountainous
      , terrain_marshland
      , terrain_grade_count
    };

    inline constexpr int32_t travel_rate(terrain_grade_e tg)
    {
        return tg - terrain_grade_count;
    }

    enum path_type_e
    {
        path_paved = 0
      , path_dirt
      , path_none
      , path_forest
      , path_difficult
    };

    /// I could make path_type_e start at -2 and count upwards
    /// but I prefer starting at 0 in case I want to index into
    /// an array (it's common for me to have a constexpr array
    /// of names)
    constexpr int32_t path_difficulty_min = -2;
    inline constexpr int32_t path_difficulty(path_type_e path)
    {
        return path_difficulty_min + path;
    }

    using hex_coord_t = glm::ivec2;

    struct hex_t
    {
        hex_coord_t coord;

        terrain_grade_e grade = terrain_flat;
        //path_type_e     path  = path_dirt;

        hex_t() = default;
        hex_t(hex_t const&) = default;
    };

    inline int32_t terrain_difficulty(terrain_grade_e grade, path_type_e path)
    {
        return uint32_t(grade) + path_difficulty(path);
    }

    inline int32_t terrain_difficulty(hex_t const& hex)
    {
        //return terrain_difficulty(hex.grade, hex.path);
        return int32_t(hex.grade);
    }
    

    using location_encounter_t = generated_node_t;
    using    plant_encounter_t = generated_node_t;
    using creature_encounter_t = generated_node_t;

    struct generated_hex_t : hex_t
    {
        location_encounter_t location;
        plant_encounter_t    plant;

        generated_hex_t(hex_t const&, pregen_node_t const& pregen_node);
    };

    struct hex_database_t
    {
        /// hash function for hex_coord_t (ie: glm::ivec2) is in hexmap/data/hex_utils.h
        std::unordered_map<hex_coord_t, generated_hex_t> hex_data;
        pregen_node_t hex_rollables;

        inline generated_hex_t& hex_at(hex_coord_t c)
        {
            ASSERT(hex_data.count(c) == 1, "accessing a hex that has not been generated yet");
            return hex_data.at(c);
        }
        inline generated_hex_t const& hex_at(hex_coord_t c) const
        {
            ASSERT(hex_data.count(c) == 1, "accessing a hex that has not been generated yet");
            return hex_data.at(c);
        }

        void generate_if_empty(hex_t const& coord);
        void generate_if_empty(std::vector<hex_t> const& hexes);
    };

    // bool is_boring(generated_hex_t const&);
    // bool is_boring(journal_entry_t const&);
}<commit_msg>encounter types (loc, plant, creature) are now subclasses of generated_node hex_database_t now has a separate pregen node for creature_rollables<commit_after>#pragma once

#include <string>
#include <unordered_map>
#include <vector>

#include <glm/glm.hpp>
#include <asdfm/utilities/utilities.h>
#include <plantgen/plant_generator.h>

namespace fast_travel_sim
{
    using pregen_node_t = plantgen::pregen_node_t;
    using generated_node_t = plantgen::generated_node_t;

    struct journal_entry_t;

    /////////////////////////////////

    enum terrain_grade_e
    {
        terrain_flat = 0
      , terrain_hilly
      , terrain_mountainous
      , terrain_marshland
      , terrain_grade_count
    };

    enum path_type_e
    {
        path_paved = 0
      , path_dirt
      , path_none
      , path_forest
      , path_difficult
    };

    /// I could make path_type_e start at -2 and count upwards
    /// but I prefer starting at 0 in case I want to index into
    /// an array (it's common for me to have a constexpr array
    /// of names)
    constexpr int32_t path_difficulty_min = -2;
    inline constexpr int32_t path_difficulty(path_type_e path)
    {
        return path_difficulty_min + path;
    }

    using hex_coord_t = glm::ivec2;

    struct hex_t
    {
        hex_coord_t coord;
        terrain_grade_e grade = terrain_flat;

        hex_t() = default;
        hex_t(hex_t const&) = default;
    };

    inline int32_t terrain_difficulty(terrain_grade_e grade, path_type_e path)
    {
        return uint32_t(grade) + path_difficulty(path);
    }

    inline int32_t terrain_difficulty(hex_t const& hex)
    {
        //return terrain_difficulty(hex.grade, hex.path);
        return int32_t(hex.grade);
    }

    /// Define these as structs instead of just type aliases
    /// so that I can overload a summarize function for each of these
    struct location_encounter_t : generated_node_t
    {
        location_encounter_t() = default;
        location_encounter_t(generated_node_t const& g)
        : generated_node_t(g)
        {}
    };

    struct plant_encounter_t : generated_node_t
    {
        plant_encounter_t() = default;
        plant_encounter_t(generated_node_t const& g)
        : generated_node_t(g)
        {
        }
    };
    struct creature_encounter_t : generated_node_t
    {
        creature_encounter_t() = default;
        creature_encounter_t(generated_node_t const& g)
        : generated_node_t(g)
        {}
    };

    struct generated_hex_t : hex_t
    {
        location_encounter_t location;
        plant_encounter_t    plant;

        generated_hex_t(hex_t const&, pregen_node_t const& pregen_node);
    };

    struct hex_database_t
    {
        /// hash function for hex_coord_t (ie: glm::ivec2) is in hexmap/data/hex_utils.h
        std::unordered_map<hex_coord_t, generated_hex_t> hex_data;
        pregen_node_t hex_rollables;
        pregen_node_t creature_rollables;

        inline generated_hex_t& hex_at(hex_coord_t c)
        {
            ASSERT(hex_data.count(c) == 1, "accessing a hex that has not been generated yet");
            return hex_data.at(c);
        }
        inline generated_hex_t const& hex_at(hex_coord_t c) const
        {
            ASSERT(hex_data.count(c) == 1, "accessing a hex that has not been generated yet");
            return hex_data.at(c);
        }

        void generate_if_empty(hex_t const& coord);
        void generate_if_empty(std::vector<hex_t> const& hexes);
    };

    // bool is_boring(generated_hex_t const&);
    // bool is_boring(journal_entry_t const&);
}
{'fraction_non_alphanumeric': 0.0853211009174312, 'fraction_numerical': 0.00672782874617737, 'mean_word_length': 2.522347872913301, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '3418265', 'n_tokens_mistral': 2234, 'n_tokens_neox': 2143, 'n_words': 488}