#include <map>
struct monster
{
int Damage;
int PowerUp;
int Monster_Strength;
int hp;
int lvl;
int money;
int defense;
};
using key = std::pair<int,int> ; // dungeon_level,moster_level pair
// or typedef std::pair<int,int> key ; // C++98
std::map< key, monster > look_up =
{
{ { 1, 1 } /* key */, { 23, 2, 5, 8, 19, 7, 9 } /* monster 1,1*/ },
{ { 1, 2 } /* key */, { 5, 7, 15, 2, 8, 15, 6 } /* monster 1,2*/ },
{ { 3, 5 } /* key */, { 1, 3, 11, 9, 17, 6, 1 } /* monster 3,5*/ },
};
#include <iostream>
std::ostream& operator << ( std::ostream& stm, const key& k )
{ return stm << '(' << k.first << ',' << k.second << ')' ; }
std::ostream& operator << ( std::ostream& stm, const monster& m )
{
return stm << "monster{" << m.Damage << ',' << m.PowerUp << ',' << m.Monster_Strength
<< ',' << m.hp << ',' << m.lvl << ',' << m.money << ',' << m.money << '}' ;
}
int main()
{
key k = { 1, 2 } ;
std::cout << k << '\n' ;
for( const auto& p : look_up )
std::cout << "key: " << p.first << " => data: " << p.second << '\n' ;
}
I2luY2x1ZGUgPG1hcD4KCnN0cnVjdCBtb25zdGVyCnsKICAgIGludCBEYW1hZ2U7CiAgICBpbnQgUG93ZXJVcDsKICAgIGludCBNb25zdGVyX1N0cmVuZ3RoOwogICAgaW50IGhwOwogICAgaW50IGx2bDsKICAgIGludCBtb25leTsKICAgIGludCBkZWZlbnNlOwp9OwoKCnVzaW5nIGtleSA9IHN0ZDo6cGFpcjxpbnQsaW50PiA7IC8vIGR1bmdlb25fbGV2ZWwsbW9zdGVyX2xldmVsIHBhaXIKCi8vIG9yIHR5cGVkZWYgc3RkOjpwYWlyPGludCxpbnQ+IGtleSA7IC8vIEMrKzk4CgpzdGQ6Om1hcDwga2V5LCBtb25zdGVyID4gbG9va191cCA9CnsKIHsgeyAxLCAxIH0gLyoga2V5ICovLCB7IDIzLCAyLCA1LCA4LCAxOSwgNywgOSB9IC8qIG1vbnN0ZXIgMSwxKi8gfSwKIHsgeyAxLCAy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