From f4c0f2b758369f34e0108c9667d92efb8ddf6d2d Mon Sep 17 00:00:00 2001 From: TonyGunk01 <208976102+TonyGunk01@users.noreply.github.com> Date: Wed, 14 May 2025 11:54:06 +0530 Subject: [PATCH 01/13] First changes Creating main function --- playermain.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 playermain.cpp diff --git a/playermain.cpp b/playermain.cpp new file mode 100644 index 00000000..88b7ba52 --- /dev/null +++ b/playermain.cpp @@ -0,0 +1,13 @@ +#include +using namespace std; + +void main() +{ + cout << "Enter your name"; + string player_name; + + cin >> player_name; + + cout << "Great start " << player_name << ", looks like you have understood the main() function properly now!"; + +} \ No newline at end of file From 808f823cf21931d3d84a23b5f333649d14ce6ca0 Mon Sep 17 00:00:00 2001 From: TonyGunk01 <208976102+TonyGunk01@users.noreply.github.com> Date: Wed, 14 May 2025 12:53:14 +0530 Subject: [PATCH 02/13] creating pokemon game first convo with prof oak --- playermain.cpp | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/playermain.cpp b/playermain.cpp index 88b7ba52..f12bdc30 100644 --- a/playermain.cpp +++ b/playermain.cpp @@ -3,11 +3,32 @@ using namespace std; void main() { - cout << "Enter your name"; - string player_name; + cout << "Welcome to the world of Pokemon! I am Professor Oak.\n"; + cout << "You can choose one of the following Pokemon:\n"; + cout << "1. Bulbasaur\n2. Charmander\n3. Squirtle\n"; - cin >> player_name; + int ch; + cin >> ch; - cout << "Great start " << player_name << ", looks like you have understood the main() function properly now!"; + if (ch == 1) + { + cout << "You chose Bulbasaur! A wise choice.\n"; + } + else if (ch == 2) + { + cout << "You chose Charmander! A fiery choice.\n"; + } + + else if (ch == 3) + { + cout << "You chose Squirtle! A cool choice.\n"; + } + + else + { + cout < "Invalid choice. Please restart the game.\n"; + } + + return 0; } \ No newline at end of file From 2f97aec264a84c8e717fa349b1857f09042c7887 Mon Sep 17 00:00:00 2001 From: TonyGunk01 <208976102+TonyGunk01@users.noreply.github.com> Date: Wed, 14 May 2025 15:04:29 +0530 Subject: [PATCH 03/13] lots of changes changing to switch statements from else if conditions asking for player name defaulting to pikachu if invalid input descriptions for pokemons --- playermain.cpp | 72 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 48 insertions(+), 24 deletions(-) diff --git a/playermain.cpp b/playermain.cpp index f12bdc30..e84945fd 100644 --- a/playermain.cpp +++ b/playermain.cpp @@ -1,34 +1,58 @@ #include +#include using namespace std; -void main() -{ - cout << "Welcome to the world of Pokemon! I am Professor Oak.\n"; - cout << "You can choose one of the following Pokemon:\n"; - cout << "1. Bulbasaur\n2. Charmander\n3. Squirtle\n"; +int main() { - int ch; - cin >> ch; + string name; + string pokemon; - if (ch == 1) - { - cout << "You chose Bulbasaur! A wise choice.\n"; - } + cout << "Professor Oak: Hello there! Welcome to the world of Pokemon!\n"; + cout << "Professor Oak: My name is Oak. People call me the Pokemon Professor!\n"; + cout << "Professor Oak: But enough about me. Let's talk about you!\n"; - else if (ch == 2) - { - cout << "You chose Charmander! A fiery choice.\n"; - } + cout << "Professor Oak: First, tell me, what’s your name?\n"; + cin >> name; - else if (ch == 3) - { - cout << "You chose Squirtle! A cool choice.\n"; - } + cout << "Professor Oak: Ah, " << name << "! What a fantastic name!\n"; + cout << "Professor Oak: You must be eager to start your adventure. But first, you’ll need a Pokemon of your own!\n"; - else - { - cout < "Invalid choice. Please restart the game.\n"; - } + cout << "Professor Oak: I have three Pokemon here with me. They’re all quite feisty!\n"; + cout << "Professor Oak: Choose wisely...\n"; + cout << "1. Charmander - The fire type. A real hothead!\n"; + cout << "2. Bulbasaur - The grass type. Calm and collected!\n"; + cout << "3. Squirtle - The water type. Cool as a cucumber!\n"; - return 0; + int ch; + + cout << "Professor Oak: So, which one will it be? Enter the number of your choice: "; + cin >> ch; + + switch (ch) { + case 1: + pokemon = "Charmander"; + cout << "Professor Oak: A fiery choice! Charmander is yours!\n"; + break; + + case 2: + pokemon = "Bulbasaur"; + cout << "Professor Oak: A fine choice! Bulbasaur is always ready to grow on you!\n"; + break; + + case 3: + pokemon = "Squirtle"; + cout << "Professor Oak: Splendid! Squirtle will keep you cool under pressure!\n"; + break; + + default: + cout << "Professor Oak: Hmm, that doesn't seem right. Let me choose for you...\n"; + pokemon = "Pikachu"; + cout << "Professor Oak: Just kidding! Let's go with Pikachu, the surprise guest!\n"; + break; + } + + cout << "Professor Oak: " << pokemon << " and you, " << name << ", are going to be the best of friends!\n"; + cout << "Professor Oak: Your journey begins now! Get ready to explore the vast world of Pokemon!\n"; + + return 0; } \ No newline at end of file From 981e7e9fd3127cfc59c10a9194b4a54acd6563d9 Mon Sep 17 00:00:00 2001 From: TonyGunk01 <208976102+TonyGunk01@users.noreply.github.com> Date: Thu, 15 May 2025 10:31:15 +0530 Subject: [PATCH 04/13] Using enum data types added enum changed default choice from pikachu to charmander --- playermain.cpp | 47 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/playermain.cpp b/playermain.cpp index e84945fd..9fcd4127 100644 --- a/playermain.cpp +++ b/playermain.cpp @@ -2,10 +2,18 @@ #include using namespace std; +enum PokemonChoice{ + + Charmander, + Bulbasaur, + Squirtle, + InvalidChoice +}; + int main() { string name; - string pokemon; + PokemonChoice ch_pokemon = InvalidChoice; cout << "Professor Oak: Hello there! Welcome to the world of Pokemon!\n"; cout << "Professor Oak: My name is Oak. People call me the Pokemon Professor!\n"; @@ -27,31 +35,50 @@ int main() { cout << "Professor Oak: So, which one will it be? Enter the number of your choice: "; cin >> ch; - + switch (ch) { + case 1: - pokemon = "Charmander"; - cout << "Professor Oak: A fiery choice! Charmander is yours!\n"; + ch_pokemon = Charmander; break; case 2: - pokemon = "Bulbasaur"; - cout << "Professor Oak: A fine choice! Bulbasaur is always ready to grow on you!\n"; + ch_pokemon = Bulbasaur; break; case 3: - pokemon = "Squirtle"; + ch_pokemon = Squirtle; + break; + + default: + ch_pokemon = InvalidChoice; + break; + + } + + switch (ch_pokemon) { + + case Charmander: + cout << "Professor Oak: A fiery choice! Charmander is yours!\n"; + break; + + case Bulbasaur: + cout << "Professor Oak: A fine choice! Bulbasaur is always ready to grow on you!\n"; + break; + + case Squirtle: cout << "Professor Oak: Splendid! Squirtle will keep you cool under pressure!\n"; break; default: cout << "Professor Oak: Hmm, that doesn't seem right. Let me choose for you...\n"; - pokemon = "Pikachu"; - cout << "Professor Oak: Just kidding! Let's go with Pikachu, the surprise guest!\n"; + ch_pokemon = Charmander; + cout << "Professor Oak: Just kidding! Let's go with Charmander, the fiery dragon in the making!\n"; break; + } - cout << "Professor Oak: " << pokemon << " and you, " << name << ", are going to be the best of friends!\n"; + cout << "Professor Oak: " << (ch_pokemon == Charmander ? "Charmander" : ch_pokemon == Bulbasaur ? "Bulbasaur" : "Squirtle") << " and you, " << name << ", are going to be the best of friends!\n"; cout << "Professor Oak: Your journey begins now! Get ready to explore the vast world of Pokemon!\n"; return 0; From dcf0995916d1a4a277ff06461482cc392e01e849 Mon Sep 17 00:00:00 2001 From: TonyGunk01 <208976102+TonyGunk01@users.noreply.github.com> Date: Thu, 15 May 2025 17:39:24 +0530 Subject: [PATCH 05/13] Delete playermain.cpp deleting playermain.cpp for changes --- playermain.cpp | 85 -------------------------------------------------- 1 file changed, 85 deletions(-) delete mode 100644 playermain.cpp diff --git a/playermain.cpp b/playermain.cpp deleted file mode 100644 index 9fcd4127..00000000 --- a/playermain.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#include -#include -using namespace std; - -enum PokemonChoice{ - - Charmander, - Bulbasaur, - Squirtle, - InvalidChoice -}; - -int main() { - - string name; - PokemonChoice ch_pokemon = InvalidChoice; - - cout << "Professor Oak: Hello there! Welcome to the world of Pokemon!\n"; - cout << "Professor Oak: My name is Oak. People call me the Pokemon Professor!\n"; - cout << "Professor Oak: But enough about me. Let's talk about you!\n"; - - cout << "Professor Oak: First, tell me, what’s your name?\n"; - cin >> name; - - cout << "Professor Oak: Ah, " << name << "! What a fantastic name!\n"; - cout << "Professor Oak: You must be eager to start your adventure. But first, you’ll need a Pokemon of your own!\n"; - - cout << "Professor Oak: I have three Pokemon here with me. They’re all quite feisty!\n"; - cout << "Professor Oak: Choose wisely...\n"; - cout << "1. Charmander - The fire type. A real hothead!\n"; - cout << "2. Bulbasaur - The grass type. Calm and collected!\n"; - cout << "3. Squirtle - The water type. Cool as a cucumber!\n"; - - int ch; - - cout << "Professor Oak: So, which one will it be? Enter the number of your choice: "; - cin >> ch; - - switch (ch) { - - case 1: - ch_pokemon = Charmander; - break; - - case 2: - ch_pokemon = Bulbasaur; - break; - - case 3: - ch_pokemon = Squirtle; - break; - - default: - ch_pokemon = InvalidChoice; - break; - - } - - switch (ch_pokemon) { - - case Charmander: - cout << "Professor Oak: A fiery choice! Charmander is yours!\n"; - break; - - case Bulbasaur: - cout << "Professor Oak: A fine choice! Bulbasaur is always ready to grow on you!\n"; - break; - - case Squirtle: - cout << "Professor Oak: Splendid! Squirtle will keep you cool under pressure!\n"; - break; - - default: - cout << "Professor Oak: Hmm, that doesn't seem right. Let me choose for you...\n"; - ch_pokemon = Charmander; - cout << "Professor Oak: Just kidding! Let's go with Charmander, the fiery dragon in the making!\n"; - break; - - } - - cout << "Professor Oak: " << (ch_pokemon == Charmander ? "Charmander" : ch_pokemon == Bulbasaur ? "Bulbasaur" : "Squirtle") << " and you, " << name << ", are going to be the best of friends!\n"; - cout << "Professor Oak: Your journey begins now! Get ready to explore the vast world of Pokemon!\n"; - - return 0; -} \ No newline at end of file From b6c7202a733700383f0f39d14a506ebdf932139a Mon Sep 17 00:00:00 2001 From: TonyGunk01 <208976102+TonyGunk01@users.noreply.github.com> Date: Thu, 15 May 2025 17:40:33 +0530 Subject: [PATCH 06/13] Adding main.cpp with enum class using enum class changing some output format --- main.cpp | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 main.cpp diff --git a/main.cpp b/main.cpp new file mode 100644 index 00000000..81a4b310 --- /dev/null +++ b/main.cpp @@ -0,0 +1,85 @@ +#include +#include +using namespace std; + +enum class PokemonChoice { + + Charmander, + Bulbasaur, + Squirtle, + InvalidChoice +}; + +int main() { + + string name; + PokemonChoice ch_pokemon = PokemonChoice::InvalidChoice; + + cout << "Professor Oak: Hello there! Welcome to the world of Pokemon!\n"; + cout << "Professor Oak: My name is Oak. People call me the Pokemon Professor!\n"; + cout << "Professor Oak: But enough about me. Let's talk about you!\n"; + + cout << "Professor Oak: First, tell me, what’s your name?\n"; + cin >> name; + + cout << "Professor Oak: Ah, " << name << "! What a fantastic name!\n"; + cout << "Professor Oak: You must be eager to start your adventure. But first, you’ll need a Pokemon of your own!\n"; + + cout << "Professor Oak: I have three Pokemon here with me. They’re all quite feisty!\n"; + cout << "Professor Oak: Choose wisely...\n"; + cout << "Choice 1. Charmander - The fire type. A real hothead!\n"; + cout << "Choice 2. Bulbasaur - The grass type. Calm and collected!\n"; + cout << "Choice 3. Squirtle - The water type. Cool as a cucumber!\n"; + + int ch; + + cout << "Professor Oak: So, which one will it be? Enter the number for your choice: "; + cin >> ch; + + switch (ch) { + + case 1: + ch_pokemon = PokemonChoice::Charmander; + break; + + case 2: + ch_pokemon = PokemonChoice::Bulbasaur; + break; + + case 3: + ch_pokemon = PokemonChoice::Squirtle; + break; + + default: + ch_pokemon = PokemonChoice::InvalidChoice; + break; + + } + + switch (ch_pokemon) { + + case PokemonChoice::Charmander: + cout << "Professor Oak: A fiery choice! Charmander is yours!\n"; + break; + + case PokemonChoice::Bulbasaur: + cout << "Professor Oak: A fine choice! Bulbasaur is always ready to grow on you!\n"; + break; + + case PokemonChoice::Squirtle: + cout << "Professor Oak: Splendid! Squirtle will keep you cool under pressure!\n"; + break; + + default: + cout << "Professor Oak: Hmm, that doesn't seem right. Let me choose for you...\n"; + ch_pokemon = PokemonChoice::Charmander; + cout << "Professor Oak: Just kidding! Let's go with Charmander, the fiery dragon in the making!\n"; + break; + + } + + cout << "Professor Oak: " << (ch_pokemon == PokemonChoice::Charmander ? "Charmander" : ch_pokemon == PokemonChoice::Bulbasaur ? "Bulbasaur" : "Squirtle") << " and you, " << name << ", are going to be the best of friends!\n"; + cout << "Professor Oak: Your journey begins now! Get ready to explore the vast world of Pokemon!\n"; + + return 0; +} \ No newline at end of file From 6f19d469422cfdfa812428868a8725a42f931584 Mon Sep 17 00:00:00 2001 From: TonyGunk01 <208976102+TonyGunk01@users.noreply.github.com> Date: Thu, 15 May 2025 18:02:10 +0530 Subject: [PATCH 07/13] enum class PokemonType Adding enum class PokemonType and changing code format and looks --- main.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/main.cpp b/main.cpp index 81a4b310..9f7b6eac 100644 --- a/main.cpp +++ b/main.cpp @@ -3,13 +3,20 @@ using namespace std; enum class PokemonChoice { - Charmander, Bulbasaur, Squirtle, InvalidChoice }; +enum class PokemonType { + Fire, + Electric, + Water, + Earth, + Normal +}; + int main() { string name; @@ -19,13 +26,13 @@ int main() { cout << "Professor Oak: My name is Oak. People call me the Pokemon Professor!\n"; cout << "Professor Oak: But enough about me. Let's talk about you!\n"; - cout << "Professor Oak: First, tell me, what’s your name?\n"; + cout << "Professor Oak: First, tell me, what’s your name?\n"; cin >> name; cout << "Professor Oak: Ah, " << name << "! What a fantastic name!\n"; - cout << "Professor Oak: You must be eager to start your adventure. But first, you’ll need a Pokemon of your own!\n"; + cout << "Professor Oak: You must be eager to start your adventure. But first, you’ll need a Pokemon of your own!\n"; - cout << "Professor Oak: I have three Pokemon here with me. They’re all quite feisty!\n"; + cout << "Professor Oak: I have three Pokemon here with me. They’re all quite feisty!\n"; cout << "Professor Oak: Choose wisely...\n"; cout << "Choice 1. Charmander - The fire type. A real hothead!\n"; cout << "Choice 2. Bulbasaur - The grass type. Calm and collected!\n"; @@ -82,4 +89,4 @@ int main() { cout << "Professor Oak: Your journey begins now! Get ready to explore the vast world of Pokemon!\n"; return 0; -} \ No newline at end of file +} From c1be7cbe68124cd6b75f259e560cf87c93f569ec Mon Sep 17 00:00:00 2001 From: TonyGunk01 <208976102+TonyGunk01@users.noreply.github.com> Date: Fri, 16 May 2025 11:45:36 +0530 Subject: [PATCH 08/13] implementing classes added class Player added class Pokemon added class ProfessorOak --- main.cpp | 127 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 main.cpp diff --git a/main.cpp b/main.cpp new file mode 100644 index 00000000..06778ca8 --- /dev/null +++ b/main.cpp @@ -0,0 +1,127 @@ +#include +#include +using namespace std; + +enum class PokemonChoice +{ + CHARMANDER = 1, + BULBASAUR, + SQUIRTLE, + PIKACHU +}; + +enum class PokemonType +{ + FIRE, + GRASS, + WATER, + ELECTRIC +}; + +class Pokemon +{ + public: + string name; + PokemonType type; + int health; + + Pokemon() { + + } + + Pokemon(string p_name, PokemonType p_type, int p_health) + { + name = p_name; + type = p_type; + health = p_health; + } + + void attack() + { + cout << name << "attacks with a powerful move!\n"; + } +}; + +class Player +{ + public: + string name; + Pokemon chosenPokemon; + + void choosePokemon(int choice) + { + switch ((PokemonChoice)choice) + { + case PokemonChoice::CHARMANDER: + chosenPokemon = Pokemon("Charmander", PokemonType::FIRE, 100); + break; + + case PokemonChoice::BULBASAUR: + chosenPokemon = Pokemon("Bulbasaur", PokemonType::GRASS, 100); + break; + + case PokemonChoice::SQUIRTLE: + chosenPokemon = Pokemon("Squirtle", PokemonType::WATER, 100); + break; + + default: + chosenPokemon = Pokemon("Pikachu", PokemonType::ELECTRIC, 100); + break; + } + + cout << "Player " << name << " chose " << chosenPokemon.name << "!\n"; + } +}; + +class ProfessorOak +{ + public: + string name; + + void greetPlayer(Player& player) + { + cout << name << ": Hello there! Welcome to the world of Pokemon!\n"; + cout << name << ": My name is Oak. People call me the Pokemon Professor!\n"; + cout << name << ": But enough about me. Let's talk about you!\n"; + } + + void offerPokemonChoices(Player& player) + { + cout << name << ": First, tell me, what’s your name?\n"; + getline(cin, player.name); + cout << endl << name << ": Ah, " << player.name << "! What a fantastic name!\n"; + cout << name << ": You must be eager to start your adventure. But first, you’ll need a Pokemon of your own!\n"; + + cout << name << ": I have three Pokemon here with me. They’re all quite feisty!\n"; + cout << name << ": Choose wisely...\n"; cout << "1. Charmander - The fire type. A real hothead!\n"; + cout << "2. Bulbasaur - The grass type. Calm and collected!\n"; + cout << "3. Squirtle - The water type. Cool as a cucumber!\n"; + + int choice; + cout << name << ": So, which one will it be? Enter the number of your choice: "; + cin >> choice; + player.choosePokemon(choice); + } +}; + +int main() +{ + ProfessorOak professor; + Pokemon placeholderPokemon; + Player player; + + placeholderPokemon.name = "Pikachu"; + placeholderPokemon.type = PokemonType::ELECTRIC; + placeholderPokemon.health = 40; + + player.name = "Trainer"; + professor.name = "Professor Oak"; + + professor.greetPlayer(player); + professor.offerPokemonChoices(player); + + cout << "Professor Oak: " << player.chosenPokemon.name << " and you, " << player.name << ", are going to be the best of friends!\n"; + cout << "Professor Oak: Your journey begins now! Get ready to explore the vast world of Pokemon!\n"; + + return 0; +} \ No newline at end of file From 57d4a62a04177c7bb92a38788d89d35318bf1104 Mon Sep 17 00:00:00 2001 From: TonyGunk01 <208976102+TonyGunk01@users.noreply.github.com> Date: Fri, 16 May 2025 14:53:31 +0530 Subject: [PATCH 09/13] adding constructors and destructors experimenting with default constructor, parameterized constructor, copy constructor, destructor --- main.cpp | 63 +++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 53 insertions(+), 10 deletions(-) diff --git a/main.cpp b/main.cpp index 06778ca8..87cdbc8b 100644 --- a/main.cpp +++ b/main.cpp @@ -25,8 +25,12 @@ class Pokemon PokemonType type; int health; - Pokemon() { - + Pokemon() + { + name = "Unknown"; + type = PokemonType::Normal; + health = 50; + cout << "A new Pokemon has been created with the default constructor!\n"; } Pokemon(string p_name, PokemonType p_type, int p_health) @@ -34,6 +38,20 @@ class Pokemon name = p_name; type = p_type; health = p_health; + cout << "A new Pokemon named " << name << " has been created!\n"; + } + + Pokemon(const Pokemon& other) + { + name = other.name; + type = other.type; + heatlh = other.health; + cout << "A new Pokemon has been copied from " << other.name << "!\n"; + } + + ~Pokemon() + { + cout << name << " has been released!\n"; } void attack() @@ -48,6 +66,20 @@ class Player string name; Pokemon chosenPokemon; + Player() + { + name = "Trainer"; + chosenPokemon = Pokemon(); + cout << "A new player named " << name << " has been created!\n"; + } + + Player(std::string p_name, Pokemon p_chosenPokemon) + { + name = p.name; + chosenPokemon = p_chosenPokemon; + cout << "Player " << name << " has been created!\n"; + } + void choosePokemon(int choice) { switch ((PokemonChoice)choice) @@ -106,16 +138,27 @@ class ProfessorOak int main() { - ProfessorOak professor; - Pokemon placeholderPokemon; - Player player; + Pokemon defaultPokemon; + Pokemon charmander("Charmander", PokemonType::FIRE, 100); + + cout << "Pokemon Details:\n"; + cout << "Name: " << defaultPokemon.name << "\nType: " << (int)defaultPokemon.type << "\nHealth: " << defaultPokemon.health << "\n"; + cout << "Name: " << charmander.name << "\nType: " << (int)charmander.type << "\nHealth: " << charmander.health << "\n"; + + Pokemon bulbasaur("Bulbasaur", PokemonType::GRASS, 100); + Pokemon bulbasaurCopy = bulbasaur; + cout << "Original Pokemon Health: " << bulbasaur.health << "\n"; + cout << "Copied Pokemon Health: " << bulbasaurCopy.health << "\n"; + + bulbasaurCopy.health = 80; + cout << "After Modification:\n"; + cout << "Original Pokemon Health: " << bulbasaur.health << "\n"; + cout << "Copied Pokemon Health: " << bulbasaurCopy.health << "\n"; - placeholderPokemon.name = "Pikachu"; - placeholderPokemon.type = PokemonType::ELECTRIC; - placeholderPokemon.health = 40; + Pokemon squirtle("Squirtle", PokemonType::WATER, 100); - player.name = "Trainer"; - professor.name = "Professor Oak"; + ProfessorOak professor("Professor Oak"); + Player player("Ash", charmander); professor.greetPlayer(player); professor.offerPokemonChoices(player); From ce1fa9bff1859aba559bd0fb6140af9d3d0be208 Mon Sep 17 00:00:00 2001 From: TonyGunk01 <208976102+TonyGunk01@users.noreply.github.com> Date: Thu, 29 May 2025 19:13:42 +0530 Subject: [PATCH 10/13] shifting from root folder to Pokemon folder --- Pokemon/main.cpp | 98 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 92 insertions(+), 6 deletions(-) diff --git a/Pokemon/main.cpp b/Pokemon/main.cpp index c2bc7bfc..9f7b6eac 100644 --- a/Pokemon/main.cpp +++ b/Pokemon/main.cpp @@ -1,6 +1,92 @@ -#include - -int main() { - - return 0; -} +#include +#include +using namespace std; + +enum class PokemonChoice { + Charmander, + Bulbasaur, + Squirtle, + InvalidChoice +}; + +enum class PokemonType { + Fire, + Electric, + Water, + Earth, + Normal +}; + +int main() { + + string name; + PokemonChoice ch_pokemon = PokemonChoice::InvalidChoice; + + cout << "Professor Oak: Hello there! Welcome to the world of Pokemon!\n"; + cout << "Professor Oak: My name is Oak. People call me the Pokemon Professor!\n"; + cout << "Professor Oak: But enough about me. Let's talk about you!\n"; + + cout << "Professor Oak: First, tell me, what’s your name?\n"; + cin >> name; + + cout << "Professor Oak: Ah, " << name << "! What a fantastic name!\n"; + cout << "Professor Oak: You must be eager to start your adventure. But first, you’ll need a Pokemon of your own!\n"; + + cout << "Professor Oak: I have three Pokemon here with me. They’re all quite feisty!\n"; + cout << "Professor Oak: Choose wisely...\n"; + cout << "Choice 1. Charmander - The fire type. A real hothead!\n"; + cout << "Choice 2. Bulbasaur - The grass type. Calm and collected!\n"; + cout << "Choice 3. Squirtle - The water type. Cool as a cucumber!\n"; + + int ch; + + cout << "Professor Oak: So, which one will it be? Enter the number for your choice: "; + cin >> ch; + + switch (ch) { + + case 1: + ch_pokemon = PokemonChoice::Charmander; + break; + + case 2: + ch_pokemon = PokemonChoice::Bulbasaur; + break; + + case 3: + ch_pokemon = PokemonChoice::Squirtle; + break; + + default: + ch_pokemon = PokemonChoice::InvalidChoice; + break; + + } + + switch (ch_pokemon) { + + case PokemonChoice::Charmander: + cout << "Professor Oak: A fiery choice! Charmander is yours!\n"; + break; + + case PokemonChoice::Bulbasaur: + cout << "Professor Oak: A fine choice! Bulbasaur is always ready to grow on you!\n"; + break; + + case PokemonChoice::Squirtle: + cout << "Professor Oak: Splendid! Squirtle will keep you cool under pressure!\n"; + break; + + default: + cout << "Professor Oak: Hmm, that doesn't seem right. Let me choose for you...\n"; + ch_pokemon = PokemonChoice::Charmander; + cout << "Professor Oak: Just kidding! Let's go with Charmander, the fiery dragon in the making!\n"; + break; + + } + + cout << "Professor Oak: " << (ch_pokemon == PokemonChoice::Charmander ? "Charmander" : ch_pokemon == PokemonChoice::Bulbasaur ? "Bulbasaur" : "Squirtle") << " and you, " << name << ", are going to be the best of friends!\n"; + cout << "Professor Oak: Your journey begins now! Get ready to explore the vast world of Pokemon!\n"; + + return 0; +} From 6b05ad768cbd6f983c8b09689ffe1edb0775ff90 Mon Sep 17 00:00:00 2001 From: TonyGunk01 <208976102+TonyGunk01@users.noreply.github.com> Date: Thu, 29 May 2025 19:14:27 +0530 Subject: [PATCH 11/13] Delete main.cpp --- main.cpp | 92 -------------------------------------------------------- 1 file changed, 92 deletions(-) delete mode 100644 main.cpp diff --git a/main.cpp b/main.cpp deleted file mode 100644 index 9f7b6eac..00000000 --- a/main.cpp +++ /dev/null @@ -1,92 +0,0 @@ -#include -#include -using namespace std; - -enum class PokemonChoice { - Charmander, - Bulbasaur, - Squirtle, - InvalidChoice -}; - -enum class PokemonType { - Fire, - Electric, - Water, - Earth, - Normal -}; - -int main() { - - string name; - PokemonChoice ch_pokemon = PokemonChoice::InvalidChoice; - - cout << "Professor Oak: Hello there! Welcome to the world of Pokemon!\n"; - cout << "Professor Oak: My name is Oak. People call me the Pokemon Professor!\n"; - cout << "Professor Oak: But enough about me. Let's talk about you!\n"; - - cout << "Professor Oak: First, tell me, what’s your name?\n"; - cin >> name; - - cout << "Professor Oak: Ah, " << name << "! What a fantastic name!\n"; - cout << "Professor Oak: You must be eager to start your adventure. But first, you’ll need a Pokemon of your own!\n"; - - cout << "Professor Oak: I have three Pokemon here with me. They’re all quite feisty!\n"; - cout << "Professor Oak: Choose wisely...\n"; - cout << "Choice 1. Charmander - The fire type. A real hothead!\n"; - cout << "Choice 2. Bulbasaur - The grass type. Calm and collected!\n"; - cout << "Choice 3. Squirtle - The water type. Cool as a cucumber!\n"; - - int ch; - - cout << "Professor Oak: So, which one will it be? Enter the number for your choice: "; - cin >> ch; - - switch (ch) { - - case 1: - ch_pokemon = PokemonChoice::Charmander; - break; - - case 2: - ch_pokemon = PokemonChoice::Bulbasaur; - break; - - case 3: - ch_pokemon = PokemonChoice::Squirtle; - break; - - default: - ch_pokemon = PokemonChoice::InvalidChoice; - break; - - } - - switch (ch_pokemon) { - - case PokemonChoice::Charmander: - cout << "Professor Oak: A fiery choice! Charmander is yours!\n"; - break; - - case PokemonChoice::Bulbasaur: - cout << "Professor Oak: A fine choice! Bulbasaur is always ready to grow on you!\n"; - break; - - case PokemonChoice::Squirtle: - cout << "Professor Oak: Splendid! Squirtle will keep you cool under pressure!\n"; - break; - - default: - cout << "Professor Oak: Hmm, that doesn't seem right. Let me choose for you...\n"; - ch_pokemon = PokemonChoice::Charmander; - cout << "Professor Oak: Just kidding! Let's go with Charmander, the fiery dragon in the making!\n"; - break; - - } - - cout << "Professor Oak: " << (ch_pokemon == PokemonChoice::Charmander ? "Charmander" : ch_pokemon == PokemonChoice::Bulbasaur ? "Bulbasaur" : "Squirtle") << " and you, " << name << ", are going to be the best of friends!\n"; - cout << "Professor Oak: Your journey begins now! Get ready to explore the vast world of Pokemon!\n"; - - return 0; -} From 796b792e7b6579b2c71553b0db38195591709e11 Mon Sep 17 00:00:00 2001 From: TonyGunk01 <208976102+TonyGunk01@users.noreply.github.com> Date: Thu, 29 May 2025 19:15:27 +0530 Subject: [PATCH 12/13] Delete main.cpp --- main.cpp | 170 ------------------------------------------------------- 1 file changed, 170 deletions(-) delete mode 100644 main.cpp diff --git a/main.cpp b/main.cpp deleted file mode 100644 index 87cdbc8b..00000000 --- a/main.cpp +++ /dev/null @@ -1,170 +0,0 @@ -#include -#include -using namespace std; - -enum class PokemonChoice -{ - CHARMANDER = 1, - BULBASAUR, - SQUIRTLE, - PIKACHU -}; - -enum class PokemonType -{ - FIRE, - GRASS, - WATER, - ELECTRIC -}; - -class Pokemon -{ - public: - string name; - PokemonType type; - int health; - - Pokemon() - { - name = "Unknown"; - type = PokemonType::Normal; - health = 50; - cout << "A new Pokemon has been created with the default constructor!\n"; - } - - Pokemon(string p_name, PokemonType p_type, int p_health) - { - name = p_name; - type = p_type; - health = p_health; - cout << "A new Pokemon named " << name << " has been created!\n"; - } - - Pokemon(const Pokemon& other) - { - name = other.name; - type = other.type; - heatlh = other.health; - cout << "A new Pokemon has been copied from " << other.name << "!\n"; - } - - ~Pokemon() - { - cout << name << " has been released!\n"; - } - - void attack() - { - cout << name << "attacks with a powerful move!\n"; - } -}; - -class Player -{ - public: - string name; - Pokemon chosenPokemon; - - Player() - { - name = "Trainer"; - chosenPokemon = Pokemon(); - cout << "A new player named " << name << " has been created!\n"; - } - - Player(std::string p_name, Pokemon p_chosenPokemon) - { - name = p.name; - chosenPokemon = p_chosenPokemon; - cout << "Player " << name << " has been created!\n"; - } - - void choosePokemon(int choice) - { - switch ((PokemonChoice)choice) - { - case PokemonChoice::CHARMANDER: - chosenPokemon = Pokemon("Charmander", PokemonType::FIRE, 100); - break; - - case PokemonChoice::BULBASAUR: - chosenPokemon = Pokemon("Bulbasaur", PokemonType::GRASS, 100); - break; - - case PokemonChoice::SQUIRTLE: - chosenPokemon = Pokemon("Squirtle", PokemonType::WATER, 100); - break; - - default: - chosenPokemon = Pokemon("Pikachu", PokemonType::ELECTRIC, 100); - break; - } - - cout << "Player " << name << " chose " << chosenPokemon.name << "!\n"; - } -}; - -class ProfessorOak -{ - public: - string name; - - void greetPlayer(Player& player) - { - cout << name << ": Hello there! Welcome to the world of Pokemon!\n"; - cout << name << ": My name is Oak. People call me the Pokemon Professor!\n"; - cout << name << ": But enough about me. Let's talk about you!\n"; - } - - void offerPokemonChoices(Player& player) - { - cout << name << ": First, tell me, what’s your name?\n"; - getline(cin, player.name); - cout << endl << name << ": Ah, " << player.name << "! What a fantastic name!\n"; - cout << name << ": You must be eager to start your adventure. But first, you’ll need a Pokemon of your own!\n"; - - cout << name << ": I have three Pokemon here with me. They’re all quite feisty!\n"; - cout << name << ": Choose wisely...\n"; cout << "1. Charmander - The fire type. A real hothead!\n"; - cout << "2. Bulbasaur - The grass type. Calm and collected!\n"; - cout << "3. Squirtle - The water type. Cool as a cucumber!\n"; - - int choice; - cout << name << ": So, which one will it be? Enter the number of your choice: "; - cin >> choice; - player.choosePokemon(choice); - } -}; - -int main() -{ - Pokemon defaultPokemon; - Pokemon charmander("Charmander", PokemonType::FIRE, 100); - - cout << "Pokemon Details:\n"; - cout << "Name: " << defaultPokemon.name << "\nType: " << (int)defaultPokemon.type << "\nHealth: " << defaultPokemon.health << "\n"; - cout << "Name: " << charmander.name << "\nType: " << (int)charmander.type << "\nHealth: " << charmander.health << "\n"; - - Pokemon bulbasaur("Bulbasaur", PokemonType::GRASS, 100); - Pokemon bulbasaurCopy = bulbasaur; - cout << "Original Pokemon Health: " << bulbasaur.health << "\n"; - cout << "Copied Pokemon Health: " << bulbasaurCopy.health << "\n"; - - bulbasaurCopy.health = 80; - cout << "After Modification:\n"; - cout << "Original Pokemon Health: " << bulbasaur.health << "\n"; - cout << "Copied Pokemon Health: " << bulbasaurCopy.health << "\n"; - - Pokemon squirtle("Squirtle", PokemonType::WATER, 100); - - ProfessorOak professor("Professor Oak"); - Player player("Ash", charmander); - - professor.greetPlayer(player); - professor.offerPokemonChoices(player); - - cout << "Professor Oak: " << player.chosenPokemon.name << " and you, " << player.name << ", are going to be the best of friends!\n"; - cout << "Professor Oak: Your journey begins now! Get ready to explore the vast world of Pokemon!\n"; - - return 0; -} \ No newline at end of file From 48f7bad7c46630151a8508dcb5b2705dba1a5bf0 Mon Sep 17 00:00:00 2001 From: TonyGunk01 <208976102+TonyGunk01@users.noreply.github.com> Date: Thu, 29 May 2025 19:16:03 +0530 Subject: [PATCH 13/13] shifting from root to Pokemon folder --- Pokemon/main.cpp | 176 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 170 insertions(+), 6 deletions(-) diff --git a/Pokemon/main.cpp b/Pokemon/main.cpp index c2bc7bfc..87cdbc8b 100644 --- a/Pokemon/main.cpp +++ b/Pokemon/main.cpp @@ -1,6 +1,170 @@ -#include - -int main() { - - return 0; -} +#include +#include +using namespace std; + +enum class PokemonChoice +{ + CHARMANDER = 1, + BULBASAUR, + SQUIRTLE, + PIKACHU +}; + +enum class PokemonType +{ + FIRE, + GRASS, + WATER, + ELECTRIC +}; + +class Pokemon +{ + public: + string name; + PokemonType type; + int health; + + Pokemon() + { + name = "Unknown"; + type = PokemonType::Normal; + health = 50; + cout << "A new Pokemon has been created with the default constructor!\n"; + } + + Pokemon(string p_name, PokemonType p_type, int p_health) + { + name = p_name; + type = p_type; + health = p_health; + cout << "A new Pokemon named " << name << " has been created!\n"; + } + + Pokemon(const Pokemon& other) + { + name = other.name; + type = other.type; + heatlh = other.health; + cout << "A new Pokemon has been copied from " << other.name << "!\n"; + } + + ~Pokemon() + { + cout << name << " has been released!\n"; + } + + void attack() + { + cout << name << "attacks with a powerful move!\n"; + } +}; + +class Player +{ + public: + string name; + Pokemon chosenPokemon; + + Player() + { + name = "Trainer"; + chosenPokemon = Pokemon(); + cout << "A new player named " << name << " has been created!\n"; + } + + Player(std::string p_name, Pokemon p_chosenPokemon) + { + name = p.name; + chosenPokemon = p_chosenPokemon; + cout << "Player " << name << " has been created!\n"; + } + + void choosePokemon(int choice) + { + switch ((PokemonChoice)choice) + { + case PokemonChoice::CHARMANDER: + chosenPokemon = Pokemon("Charmander", PokemonType::FIRE, 100); + break; + + case PokemonChoice::BULBASAUR: + chosenPokemon = Pokemon("Bulbasaur", PokemonType::GRASS, 100); + break; + + case PokemonChoice::SQUIRTLE: + chosenPokemon = Pokemon("Squirtle", PokemonType::WATER, 100); + break; + + default: + chosenPokemon = Pokemon("Pikachu", PokemonType::ELECTRIC, 100); + break; + } + + cout << "Player " << name << " chose " << chosenPokemon.name << "!\n"; + } +}; + +class ProfessorOak +{ + public: + string name; + + void greetPlayer(Player& player) + { + cout << name << ": Hello there! Welcome to the world of Pokemon!\n"; + cout << name << ": My name is Oak. People call me the Pokemon Professor!\n"; + cout << name << ": But enough about me. Let's talk about you!\n"; + } + + void offerPokemonChoices(Player& player) + { + cout << name << ": First, tell me, what’s your name?\n"; + getline(cin, player.name); + cout << endl << name << ": Ah, " << player.name << "! What a fantastic name!\n"; + cout << name << ": You must be eager to start your adventure. But first, you’ll need a Pokemon of your own!\n"; + + cout << name << ": I have three Pokemon here with me. They’re all quite feisty!\n"; + cout << name << ": Choose wisely...\n"; cout << "1. Charmander - The fire type. A real hothead!\n"; + cout << "2. Bulbasaur - The grass type. Calm and collected!\n"; + cout << "3. Squirtle - The water type. Cool as a cucumber!\n"; + + int choice; + cout << name << ": So, which one will it be? Enter the number of your choice: "; + cin >> choice; + player.choosePokemon(choice); + } +}; + +int main() +{ + Pokemon defaultPokemon; + Pokemon charmander("Charmander", PokemonType::FIRE, 100); + + cout << "Pokemon Details:\n"; + cout << "Name: " << defaultPokemon.name << "\nType: " << (int)defaultPokemon.type << "\nHealth: " << defaultPokemon.health << "\n"; + cout << "Name: " << charmander.name << "\nType: " << (int)charmander.type << "\nHealth: " << charmander.health << "\n"; + + Pokemon bulbasaur("Bulbasaur", PokemonType::GRASS, 100); + Pokemon bulbasaurCopy = bulbasaur; + cout << "Original Pokemon Health: " << bulbasaur.health << "\n"; + cout << "Copied Pokemon Health: " << bulbasaurCopy.health << "\n"; + + bulbasaurCopy.health = 80; + cout << "After Modification:\n"; + cout << "Original Pokemon Health: " << bulbasaur.health << "\n"; + cout << "Copied Pokemon Health: " << bulbasaurCopy.health << "\n"; + + Pokemon squirtle("Squirtle", PokemonType::WATER, 100); + + ProfessorOak professor("Professor Oak"); + Player player("Ash", charmander); + + professor.greetPlayer(player); + professor.offerPokemonChoices(player); + + cout << "Professor Oak: " << player.chosenPokemon.name << " and you, " << player.name << ", are going to be the best of friends!\n"; + cout << "Professor Oak: Your journey begins now! Get ready to explore the vast world of Pokemon!\n"; + + return 0; +} \ No newline at end of file