CMSC 202 Project Pokemon Assignment

Added on - 09 Oct 2019

  • 11

    pages

  • 2784

    words

  • 10

    views

  • 0

    downloads

Showing pages 1 to 4 of 11 pages
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 thefamous 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 theworld in hopes of finding powerful Pokémon. Additionally, you can train thePokémon once you have caught them. Finally, after you have found somePokémon, you can battle them against other people.There are two pieces of information that are important in this game. The firstis the list of all of the Pokémon that are available. Currently, there are 151Pokémon available in thepokeDex.txtfile (which is provided). Theinformation about each of the Pokémon provided includes their number (1-151), their name, their maximum combat points, their minimum combatpoints, and their rarity (1-5).**For Pokémon fans - the numbers used inthis project are pretty random and do not represent actual Pokémonvalues!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 aPoké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 betracked. Additionally, even when a user quits the game, their collection ofPokémon should be saved to a file namedmyCollection.txt.For our implementation of the game, we will be designing some basicfunctionality including: listing all available Pokémon, listing your collection ofCMSC 202 – Computer Science I for MajorsPage1
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 toinclude 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 bynumber 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 afile.CMSC 202 – Computer Science I for MajorsPage2
4.Requirements:Initially, you will have to use the following filesPokemon.h, MyPokemon.h,pokeDex.txt, and proj2.hfor the project. You can copy the files fromProf’s folder(((( I will attach the five files, but note that thepokeDex.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 librariesor data structures that we have not learned in class. Libraries we havelearned include<iostream>, <fstream>, <iomanip>,<vector>, <stdlib.h>, <time.h>,and<string>. You shouldonly usenamespace 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 numbergenerator seed.For various parts of this project, you will be using a random numbergenerator. To use thesrand()andrand()you will need to#include<stdlib.h>and to seedsrand()you will need to#include <time.h>.oThe class notes on random numbers should help with this topic.ovalue = rand() % max + mingives you a range betweenmin and max.oFor example,exam1 = rand() % 100 + 1gives you a rangebetween 1 and 100.You must use the function prototypes as outlined in theproj2.hheader file. Theproj2.hfile includes additional comments describingwhat the function is expected to do. You may not edit theproj2.hfile.You can include theproj2.hfile in your program by using#include"proj2.h"Additionally, you will need to use thePokemon.handMyPokemon.has templates for your class definition files.You first need to write the functions for the classes (Pokemon.cppandMyPokemon.cpp) based on the header files (Pokemon.handMyPokemon.h) respectively:CMSC 202 – Computer Science I for MajorsPage3
oAll of the getters simply return the corresponding membervariable.oAll of the setters take in the new value and update the membervariable (with no checks).oTrain()– simply adds 10 CP to the Pokémon. Updates the CPof the Pokémon that trained and what their new CP is.Next you need to code up the various functions that are called in theproj2.cppfile that are prototyped inproj2.h.omainMenu()– Provided in theproj2.cppfile. It must validatethe 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 avector called pokeDex. Made up of Pokemon objects.ogetMyCollection(myCollection)– Upon the loading of theapplication, takes a provided input file (myCollection.txt) andimports it into a vector called myCollection. Made up ofMyPokemon 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 thePoké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 combatpoints are a random number between the minimum combat points(CP) and the maximum combat points listed in the pokeDex. Thehit points are based on 10% of the calculated CP.obattlePokemon(pokeDex, myCollection)– Pits a randomPokémon from the pokeDex vector against a user’s ownedPokémon from the myCollection vector. Only compares CP andoutputs if the user won or lost the battle.CMSC 202 – Computer Science I for MajorsPage4
desklib-logo
You’re reading a preview
card-image

To View Complete Document

Become a Desklib Library Member.
Subscribe to our plans

Unlock This Document