COM S 327 Programming Project 1.07 CSV parsing


Category: You will Instantly receive a download link for .zip solution file upon Payment


5/5 - (1 vote)

We’ll be parsing in a number of data files that describe pokemon and their moves. The database contain- ´
ing these files is available on Pyrite under /share/cs327/pokedex. You may copy this entire database
to a local location if you would like using scp, for example:
scp -r /local/path/
where netid is your net id and /local/path/ is the local path to the location where you want your
files (and is not under your source tree).

When loading the database, your program should look in at least two and optionally three places for
the files, only failing if none of those locations contain the database. Your program should first look under
/share/cs327. Failing that, it should look under $HOME/.poke327/. And, optionally, it may look in
a third place (which is not under your source tree) of your choosing. For the second location, use getenv()
to resolve the value of the HOME environment variable.

NOTE: Your program must search for the database under /share/cs327 and $HOME/.poke327/
even if you have a local copy somewhere (not under your source tree) else. This is so it will load the TAs’
copies without them having to modify your sources.

you submit a solution that has the database included within it, you will be docked 4 points (out of 10)!

database is too large for the teaching staff to pass around 100+ copies of it and for limits of the systems that
we use.

Your program should open the database in the first location where it is found, or print an error message
and terminate upon failure if the database is not found.

The CSV files are located under pokedex/pokedex/data/csv/. We will need to parse the following files:
• pokemon.csv
• moves.csv
• pokemon moves.csv
• pokemon species.csv
• experience.csv
• type names.csv
• pokemon stats.csv
• stats.csv
• pokemon types.csv

For each parsed file, create a struct or class to hold the data type, then create an array of those to hold all
of the data.
Use the value INT MAX as a placeholder for empty cells in the CSV files.

type names.csv contains some non-ascii characters. You are welcome to fully parse the file—and
to use non-English words—but if you are only interested in English, you can simple read whole lines and
discard the irrelevant lines from this file. Only those lines wherein local language id is 9 are in

Modify your game to take a single command line parameter, one of pokemon, moves, pokemon moves,
pokemon species, experience, type names, pokemon stats, stats or pokemon types.

Your program should parse the specified file, print its contents to standard output (do not initialize curses),
and exit.

The whole game will still be compiled and linked, we’re simply exiting before running it.
The format of the files is multiple lines of values separated by commas. The first line in each file defines
the fields in the file (and make good choices for field names in your data structures). Some fields will be
empty, denoted by a comma followed immediately by a comma. In printing out your parsed data, do not
print the INT MAX that you use internally to denote empty fields.

All new code should be written in C++.