prompt description

This commit is contained in:
cdemeyer-teachx
2025-08-20 15:54:17 +09:00
parent aff99a507c
commit 58e3c1c734
2 changed files with 5 additions and 34 deletions

2
Prompts/6-pokemonTable Normal file
View File

@@ -0,0 +1,2 @@
This repo is the start of a highly performant pokemon battle simulator.
I want you to implement a pokemon data table that contains all PokemonSpecies. So we can easily access any pokemon using it's ID during runtime.

View File

@@ -5,22 +5,17 @@
#include "stats.h" #include "stats.h"
#include "types.h" #include "types.h"
#include <string> #include <string>
#include <string_view>
#include <array>
#include <unordered_map>
namespace PokEng { namespace PokEng {
// Pokemon species data structure // Pokemon species data structure
struct PokemonSpecies { struct PokemonSpecies {
std::string_view name; PokemonSpecies() = default;
std::string name;
uint16_t id; uint16_t id;
BaseStats base_stats; BaseStats base_stats;
PokemonTypes types; PokemonTypes types;
constexpr PokemonSpecies(uint16_t id_, std::string_view name_,
const BaseStats& stats, const PokemonTypes& types_)
: name(name_), id(id_), base_stats(stats), types(types_) {}
}; };
// Pokemon Archetype - contains information on how a pokemon will be instantiated // Pokemon Archetype - contains information on how a pokemon will be instantiated
@@ -114,32 +109,6 @@ private:
uint8_t m_friendship = 0; uint8_t m_friendship = 0;
}; };
// Pokemon lookup tables for each generation
template<Generation Gen>
class PokemonDataTable {
public:
// Get Pokemon species data by ID
static const PokemonSpecies* getSpecies(uint16_t id);
// Get Pokemon species data by name
static const PokemonSpecies* getSpecies(std::string_view name);
// Check if Pokemon exists in this generation
static bool exists(uint16_t id);
// Get total number of Pokemon in this generation
static size_t getCount();
private:
static const std::unordered_map<uint16_t, PokemonSpecies>& getTable();
static const std::unordered_map<std::string_view, uint16_t>& getNameTable();
};
// Convenience typedefs for different generations
using Gen1PokemonData = PokemonDataTable<Generation::I>;
using Gen2PokemonData = PokemonDataTable<Generation::II>;
using Gen3PokemonData = PokemonDataTable<Generation::III>;
} // namespace PokEng } // namespace PokEng
#endif // POKEMON_H #endif // POKEMON_H