Pokemon OSU Edition

Pokemon OSU Edition

Students were tasked with applying the principles of object-oriented programming to create a command-line Pokemon game in C++.

Program Requirements

The program will let the user play out a simplified Pokémon battle against the computer. Upon execution, the program will prompt the user for their name, then allow them to pick 3 Pokémon for their team from a pool of the 4 original starters -- Charmander, Squirtle, Bulbasaur, and Pikachu. These original 4 starters will each have their own class, derived from an abstract Pokémon class. The Trainer class will have a composition relationship with the Pokémon class, containing an array of Pokémon objects i.e. their team. Finally, an Arena class will act as the primary logic for the game, having a composition relationship with the Trainer class. All Pokémon stats used will be pulled from pokemondb.net/pokedex/all. Battle will take place between the Pokémon in the [0] position of each trainer’s team array. The user and computer will take turns. On the users turn, they will be presented with three options: fight, heal, or swap. The fight option will trigger an attack on the computer’s Pokémon. Rather than a standard set of moves to choose from, this will be a standardized attack. The damage will be calculated on a base attack value, attack stat of the attacking Pokémon, defense stat of the defending Pokémon, type effectiveness, and a random function. The heal option will restore up to 15 health points, based on a random function. Swap will allow the player to move another Pokémon on their team to the [0] position, and ends their turn. On the computer’s turn, it will randomly select one of the three options. The game will be finished when the sum of one team’s health points is 0. Upon completion of the game, the user will either be congratulated or consoled, on the result of the
game. They will then be prompted if they would like to play again, and the game will either reset or end, depending on their selection.


Since I am a lifelong Pokemon fan that's been playing since the first generation of Gameboy games, I felt I needed to go above and beyond for this project. I decided to add ASCII art representations of each of the available Pokemon, create a typewriter effect for the console output, and add a simple "AI" algorithm to control the opponents move selection.

Figure 1: Bulbasaur ASCII representation

The typewriter effect was implemented using the thread and chrono libraries along with the rand function. The effect is acheived by putting the output stream to sleep for a variable amount of time each time a character is outputted to the console.

The opponent AI was acheived by creating a set of functions which altered the likeliness of the opponent trainer choosing a move based on the health of their pokemon.

UML Class Diagram