Ask a question from expert

Ask now

CMSC 202 Project Pokemon Assignment

11 Pages2784 Words319 Views
   

Added on  2019-10-09

CMSC 202 Project Pokemon Assignment

   Added on 2019-10-09

BookmarkShareRelated Documents
CMSC 202 Fall 2016Project 2 – PokémonAssignment: Project 2 - Pokémon1.OverviewIn this project you will:Write a program using classes and objectsUse vectors to manage your dataIncorporate file I/O to help manage your dataUse pass-by-value and pass-by-reference for parameters2.BackgroundFor this project, we are going to be designing a simple implementation of the famous Pokémon franchise. If you are not familiar with Pokémon, it is a gamewhere you act as a trainer of pocket monsters (Pokémon). You search the world in hopes of finding powerful Pokémon. Additionally, you can train the Pokémon once you have caught them. Finally, after you have found some Pokémon, you can battle them against other people.There are two pieces of information that are important in this game. The first is the list of all of the Pokémon that are available. Currently, there are 151 Pokémon available in the pokeDex.txt file (which is provided). The information about each of the Pokémon provided includes their number (1-151), their name, their maximum combat points, their minimum combat points, and their rarity (1-5). **For Pokémon fans - the numbers used in this project are pretty random and do not represent actual Pokémon values!The second piece of important information is the list of Pokémon that the userhas managed to catch. A user has the ability go out and try and catch a Pokémon but the more powerful the Pokémon is, the harder they are to catch!Once a user has caught a Pokémon, the information such as number (1-151),name, combat points (CP), hit points (HP), and their rarity (1-5) will be tracked. Additionally, even when a user quits the game, their collection of Pokémon should be saved to a file named myCollection.txt.For our implementation of the game, we will be designing some basic functionality including: listing all available Pokémon, listing your collection of CMSC 202 – Computer Science I for MajorsPage 1
CMSC 202 Project Pokemon Assignment_1
Pokémon, trying to catch Pokémon, training your Pokémon, and finally, battling against other Pokémon.3.Assignment DescriptionYour assignment is to develop a Pokémon application that allows you to include some gaming aspects. The application should:1.Load all available Pokémon into the pokeDex (which is a vector). The pokeDex is just a system that lists all available Pokémon by number and name. Load a user’s collection into the myCollection (which is a vector).2.Have a main menu that asks the user if they want to:a.What would you like to do?:i.See the PokeDexii.See your collectioniii.Search for a new Pokémoniv.Battle Your Pokémonv.Train your Pokémonvi.Exit1.Upon exit, my collection should be saved to a file.CMSC 202 – Computer Science I for MajorsPage 2
CMSC 202 Project Pokemon Assignment_2
4.Requirements:Initially, you will have to use the following files Pokemon.h, MyPokemon.h,pokeDex.txt, and proj2.h for the project. You can copy the files from Prof’s folder (((( I will attach the five files, but note that the pokeDex.txt is .txt not .cpp. I could not do it .txt ))))Notice the trailing period is required (it says copy it into this folder).The project must be completed in C++. You may not use any libraries or data structures that we have not learned in class. Libraries we have learned include <iostream>, <fstream>, <iomanip>, <vector>, <stdlib.h>, <time.h>, and <string>. You should only use namespace std. Although we haven’t discussed it in detail, you can use <stdlib.h> in order to access the random functions. Similarly, we use <time.h> to access the time for our random number generator seed.For various parts of this project, you will be using a random number generator. To use the srand() and rand() you will need to #include<stdlib.h> and to seed srand() you will need to #include <time.h>.oThe class notes on random numbers should help with this topic. ovalue = rand() % max + min gives you a range between min and max. oFor example, exam1 = rand() % 100 + 1 gives you a range between 1 and 100.You must use the function prototypes as outlined in the proj2.hheader file. The proj2.h file includes additional comments describing what the function is expected to do. You may not edit the proj2.h file. You can include the proj2.h file in your program by using #include "proj2.h" Additionally, you will need to use the Pokemon.h and MyPokemon.h as templates for your class definition files.You first need to write the functions for the classes (Pokemon.cpp and MyPokemon.cpp) based on the header files (Pokemon.h and MyPokemon.h) respectively:CMSC 202 – Computer Science I for MajorsPage 3
CMSC 202 Project Pokemon Assignment_3
oAll of the getters simply return the corresponding member variable.oAll of the setters take in the new value and update the member variable (with no checks).oTrain() – simply adds 10 CP to the Pokémon. Updates the CP of the Pokémon that trained and what their new CP is.Next you need to code up the various functions that are called in the proj2.cpp file that are prototyped in proj2.h.omainMenu() – Provided in the proj2.cpp file. It must validate the choice to be in the valid range.ogetPokeDex(pokeDex) – Upon the loading of the application, takes a provided input file (pokeDex.txt) and imports it into a vector called pokeDex. Made up of Pokemon objects.ogetMyCollection(myCollection) – Upon the loading of the application, takes a provided input file (myCollection.txt) andimports it into a vector called myCollection. Made up of MyPokemon objects.oprintPokeDex(pokeDex) – Prints (num and name) of all of thePokémon in the pokeDex vector.oprintMyCollection(myCollection) – Prints (num, name, CP, HP, rarity) of the Pokémon in the myCollection vector.ocatchPokemon(pokeDex, myCollection) – Based on rarity,allows the user to try and catch a Pokémon. The more rare the Pokémon, the more difficult they are to catch.ofoundPokemon(rarity, pokeDex, myCollection)Once a Pokémon is caught, it identifies which one (random basedon rarity) and adds it to the myCollection vector. The combat points are a random number between the minimum combat points(CP) and the maximum combat points listed in the pokeDex. The hit points are based on 10% of the calculated CP.obattlePokemon(pokeDex, myCollection) – Pits a random Pokémon from the pokeDex vector against a user’s owned Pokémon from the myCollection vector. Only compares CP and outputs if the user won or lost the battle.CMSC 202 – Computer Science I for MajorsPage 4
CMSC 202 Project Pokemon Assignment_4

End of preview

Want to access all the pages? Upload your documents or become a member.