c++ | project | database作业 -COMS 327 CSV parsing and porting to C++

COMS 327 CSV parsing and porting to C++

c++ | project | database作业 – 这是一个c++面向对象设计的practice, 考察c++的理解, 涉及了c++/database等代写方面, 该题目是值得借鉴的project代写的题目

project代写 代写project

Programming project 1.

CSV parsing and porting to C++

Well be converting (porting) our entire game into c++ this week. Youll need to rename all of your C files with a.cpp extension (if using my makefile, do amake clobberbefore renaming). Youll also need to update your makefile. If youre using one of my code drops (or if youve taken my makefile into your project), there is already automatic support to compile C++ code; however, you will need to change the link line to link with the C++ compiler (try to figure this out on your own). The major structs in your game should be changed to classes; this includes the map and the character structures. There are no requirements about access to members (public, private, etc.); you decide what you think is best. My code uses a pseudo-object-oriented design of thecharactert, with sub-typespct andnpct. If you are using my code, you should change these so that they use C++ class inheritance (pc andnpcshould inherit fromcharacter^1 ). If youre not using my code, but you have a similar design, you should also use inheritance^2. You do not have to do anything withheap.handheap.c. These already include the necessary syntax to make them play nice with C++ and may remain as C files. Well 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 [email protected]:/share/cs327/pokedex /local/path/ wherenetidis your net id and/local/path/is the local path to the location where you want your files. 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, if may look in a third place of your choosing. For the second location, usegetenv()to resolve the value of theHOME environment variable. Your program should open the database in the first location where it is found, or print an error message and terminate upon failure. The CSV files are located underpokedex/pokedex/data/csv/. We will need to parse the fol- lowing files:

  • pokemon.csv
  • moves.csv
  • pokemonmoves.csv
  • pokemonspecies.csv
  • experience.csv
  • typenames.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 -1 as a placeholder for empty cells in the CSV files.

(^1) This is a requirement, not an optional change. (^2) Requiring this would be harder to enforcea lot of manual effort for the TAsso we wont do that, but you should make an effort to use inheritance somewhere in your code if the organization allows it, just so that you get the experience.

typenames.csvcontains some non-ascii characters. You are welcome to fully parse the fileand to use non-English wordsbut if you are only interested in English, you can simple read whole lines and discard the irrelevant lines from this file. Only those lines whereinlocallanguageidis 9 are in English. Modify your game to take a single command line parameter, one ofpokemon,moves,pokemonmoves, pokemonspecies,experience, ortypenames. 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, were 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 -1 that you use internally to denote empty fields. All new code should be written in C++.