#include <iostream>
using namespace std;


struct Monster
{
	string name;
	int combatPower;
};

bool captureAttempt(Monster monster)
{
	int chance = 0;
	if(monster.combatPower < 100)
		chance = rand()%1;
	else if(monster.combatPower > 99)
		chance = rand()%3;
	else if(monster.combatPower > 200)
		chance = rand()%7;
		
	if(chance == 0)
		return true;
	else return false;
}

string randomNameGenerator()
{
	
	string names[25] = {"Charmander", "Bulbasor", "Squrtile", "Pidgey", "Pikachu",
						"Sandshrew", "Zubat", "Mankey", "Abra", "Magikarp",
						"Eevee", "Rattata", "Vulpix", "Scyther", "Jigglypuff",
						"Geodude", "Onix", "Staryu", "Snorlax", "Mewtwo",
						"Oddish", "Caterpie", "Spearow", "Charizard", "Zapdos",};
	return names[rand()%24];
}

Monster setMonster(Monster monster)
{
	monster.name = randomNameGenerator();
	monster.combatPower = rand()%450 + 1;
	return monster;
}
int main() {
	srand(time(NULL));
	Monster monster;
	char input;
	bool didCatch = false;
	int pokeballs = 5;
	
	while(true)
	{
		pokeballs--;
		monster = setMonster(monster);
		didCatch = captureAttempt(monster);
		if(didCatch)
		{
			cout<<"Gotcha! You caught the monster "<<monster.name<<"!"<<endl;
			cout<<"Attempt to catch again? (Y?N): "	;
		}
		else 
			cout<<"broke free! Attempt to catch again? (Y/N)"<<endl;
		cin>>input;
		if(input == 'N' || input == 'n')
		{
			cout<<"\nGot away safely."<<endl;
			exit(0);
		}
		if(pokeballs == 0)
		{
			cout<<"\nYou do not have any pokeballs, so you ran and got away safely.";
			exit(0);	
		}
		else
		{
			cout<<"\nRemianing pokeballs: "<<pokeballs<<endl;
		}
	}
	return 0;
}