Do My Homework / Homework Help Answers / C++ Homework Help / Programming 1 C++ Final Project

Programming 1 C++ Final Project

Need help with this question or any other C++ assignment help task?

Please follow the generic guidelines. I know that there are faster and more advanced ways to do the two programs for this project but my professor will count off points and question me as this is a programming 1 course that expects me to not have previous knowledge. It is most important you follow the Guide lines for the programs "2 Problem - Use the Force Luke! - 100 points" and "3 Problem 2 - Pokemon Battle - 100 points + 30 points extra credit" and the Generic Guidelines. We have been using CLion as our compiler if that gives any insight.
Additional Instructions:
COP 3014 Fall 2022 Homework 7 Total Points: 200 (and 30 points extra credit) Due: Friday 12/02/2022 11:59:00 PM EST through Canvas. NO EXTENSIONS 1 Objective The purpose of this assignment is to make sure: • You are familiar with dynamic memory allocation and two-dimensional arrays. • You are familiar with the concepts of bounds checking and maintaining state. • You can work with pointers, structures, and files in C++. • You can approach a complex problem, break it down into various parts, and put together a solution. For this assignment, please make sure you conform to program specifications and Output requirements. You should now be familiar enough with cout statements and output formatting that you should be able to EXACTLY match the sample output (other than certain exceptions you will be informed about before- hand). You should also have had enough experience with functions to match the function specifications (name, argument list, return type, and functionality) EXACTLY. Failure to do either or both will result in a loss of points. This assignment requires you to submit several files on Canvas. Please do so in a SINGLE submission. Canvas allows you to turn in multiple files in one submission. Once you have uploaded your first file, click “attach another file” to upload your second file, and so on. Turn in your files mirrors.cpp and pokemonBattle.cpp to Canvas. 2 Problem - Use the Force Luke! - 100 points Luke Skywalker’s on a mission. He’s the last X-Wing pilot in the desperate attack run on the Death Star, and he has to guide proton torpedoes into the thermal exhaust port, which will destroy the Death Star. Piece of cake for a Jedi (even one barely into training). Plot twist: The empire has protected the thermal exhaust ports with room-like blocks of construction, with double sided mirrored shields that bounce off anything that touches them at a 90 degree angle. Luke is able to sense the set-up of the mirrors in this “room” that’s blocking him from achieving his mission. He decides to exploit the defense of the exhaust port to get the job done. He knows exactly which spot on the walls of this room would lead into the exhaust port. But, due to inexperience, he can’t quite sense the spot on the “other side” that, when hit, would send the proton torpedoes bouncing off the mirrored shields into the exhaust port. 1 He decides to ask Obi-Wan for help. Your job, as Obi-Wan, is to backtrack from the exhaust port, backwards through the room, to the spot on the wall that Luke needs to hit, and tell him about it. Some things you need to note: 1. You will be given the dimensions of the room and the “map” of the room, including the mirrors. 2. The exhaust port will always be on the west (left) or the north (top) wall, and NEVER at a corner. 3. The mirrors will always be oriented as a \or a /. 4. The walls of the room are represented by the character ‘x’. The exhaust port is represented by ‘*’. The empty spaces are represented by ‘.’ 2.1 Specifications 1. Call this program mirrors.cpp 2. Create a function called process that takes in two integer parameters representing the length (num- ber of rows) and the width (number of columns) of the room. The function returns nothing. (5 points) 3. In main, read in the number of rows and columns from the user and call the process function. The main function should have at most 8 lines of code. (10 points) 4. In the process function, dynamically create a 2 dimensional array of chars. Read in the map of the room from the user. (10 points) 5. Search the array to find out the location (row and column as 2 variables) of the exhaust port. The port will be in the 0th row or the 0th column. (10 points) 6. Trace the path the proton torpedo will take through the room backwards. Mark each spot the torpedo will go through with an ‘o’. (25 points) 7. If we see a mirror, change the direction of the path accordingly. You can use an integer or a char to keep track of the direction you’re currently moving. Please note that you may encounter no mirrors, 1 mirror, or multiple mirrors. However, you will never loop endlessly between the same set of mirrors. That is, you are guaranteed that the torpedo will reach the wall at some point. (15 points) 8. Stop when we reach the edge of the room (when we see a “wall” character). Print the location as (row,column) where we reach the wall. (15 points) 9. Delete the dynamic array. (5 points) 10. Include comments wherever you think is appropriate. (5 points) 11. You need to make sure you are never out of bounds. Since this is a dynamic array, it will crash if we go out of the number of rows and columns we have. 2 Sample Run 1 Enter the number of rows: 6 Enter the number of columns: 11 Enter the map: xxxxxxxxxxx x.........x x.........x *../......x x.........x xxxxxxxxxxx The traced path is: xxxoxxxxxxx x..o......x x..o......x *oo/......x x.........x xxxxxxxxxxx The entry point is (0,3) Sample Run 2 Enter the number of rows: 6 Enter the number of columns: 11 Enter the map: xxxx*xxxxxx x.........x x.........x x.........x x...\...\.x xxxxxxxxxxx The traced path is: xxxx*xxxxxx x...o.....x x...o.....x x...o.....x x...\ooo\.x xxxxxxxxoxx The entry point is (5,8) Sample Run 3 Enter the number of rows: 5 Enter the number of columns: 5 Enter the map: xxxxx *...x x...x x...x xxxxx 3 The traced path is: xxxxx *ooox x...x x...x xxxxx The entry point is (1,4) 3 Problem 2 - Pokemon Battle - 100 points + 30 points extra credit You are a Pokemon Master working for a renowned Pokemon Gym. However, you’ve had a very busy week, and you don’t have a training schedule prepared for this weekend’s session. You decide to wing it with a Free for All combat, where the Pokemon in the gym decide to battle each other to see who comes out on top. To make things easier, you decide to write a program to basically let the session run itself. Please write a program that conforms to the following requirements: 1. Call this file pokemonBattle.cpp 2. Create a structure called Move that contains the following data members (5 points) • name - cstring of 50 characters • moveDamage - integer 3. Create a structure called Pokemon that contains the following data members (10 points): • name - cstring of 50 characters • type - cstring of 50 characters • hitPoints - integer • defenceRating - integer • isAwake - boolean • moveName - cstring of 50 characters 4. Open the file pokemon.txt. The file will be in the following format (5 points): numMoves move1 moveDamage1 move2 moveDamage2 . . . moveM moveDamageM numPokemon name1 type1 HP1 DR1 move1 name2 type2 HP2 DR2 move2 . . . nameN typeN HPN DRN moveN 4 5. The first line of the file is an integer M, representing the number of Moves. The next ‘M’ lines of the file will consist of 2 pieces of data - the name of the move, followed by the damage the move can do. These are separated by a tab. The next line is an integer N, representing the number of Pokemon. The next N lines of the file will consist of 5 pieces of data - the name of the Pokemon, the Pokemon type, the hitpoints (health) for that Pokemon, the defense rating of that Pokemon and finally the signature move of that Pokemon. This data is tab separated as well. 6. Open the file session.txt. This file will be in the following format (5 points): numAttacks pokemon1 move1 target1 attackRating1 pokemon2 move2 target2 attackRating2 . . . pokemonK moveK targetK attackRatingK 7. The first line of the file is an integer K, representing the number of attacks. The next K lines, will each consist of the name of a Pokemon, the name of a move, the name of a second Pokemon who is being attacked, and the attack rating (chance of a successful attack, in points) of the attack. 8. Read in the number of Moves M from pokemon.txt. Create a dynamic array of M Moves, and populate the structure variables with the data from the file. (10 points) 9. Read the number of Pokemon N. Create a dynamic array of N Pokemon structure variables, and populate the structure variables with the data from the file. In the beginning, all the Pokemon are conscious and ready to battle (10 points). 10. Read in the attacks K from the file session.txt. (2 points) 11. For each attack, check if the move used is the signature move of the Pokemon using the move. Also check if the attackRating for the attack is at least equal to the defense rating of the Pokemon being attacked. If both conditions are met, subtract the move’s damage from the hitPoints of the Pokemon being attacked. (25 points) 12. If ever the hitPoints of the Pokemon drops BELOW 0, that Pokemon has fainted. Adjust the boolean accordingly. (4 points). 13. Open the output file healthy.txt. Print the names of the Pokemon that are still conscious (not fainted) and the hitPoints they have left, one per line, in the order they appear in the input file, (9 points). 14. Close the files and delete the dynamic arrays (10 points). 15. Make sure your program is commented properly (5 points) 16. You may assume that a fainted Pokemon will not attack any more. 17. You are restricted to the iostream, fstream and cstring libraries for this program. 5 Extra Credit: 30 points 1. Print the output - the Pokemon that haven’t fainted with their hitPoints in descending order of remaining hitPoints, instead of the order they appear in the input file. Use the insertion sort algorithm as shown below. (25 points) 2. For the sorting, please sort the array of structs and then print the output. Also, please use the given algorithm and not the Bubble Sort algorithm shown in class. 3. Print the message “It was super effective”, after the attacking and the attacked Pokemon, to standard output (cout) every time a Pokemon faints. (5 points) Sample Files The output shown here includes the extra credit pokemon.txt 9 Take Down 6 Bubble Beam 7 Hyperbeam 10 Thunderbolt 5 Flamethrower 4 Counter 3 Confusion 3 Razor Leaf 4 Poison Sting 5 6 Charizard Fire 17 10 Flamethrower Gyarados Water 25 16 Hyperbeam Raichu Electric 27 14 Thunderbolt Wobbuffet Psychic 14 11 Counter Bayleef Grass 18 12 Razor Leaf Bewear Fighting 15 10 Take Down session.txt 15 Charizard Flamethrower Bayleef 16 Wobbuffet Counter Gyarados 4 Raichu Thunderbolt Bewear 8 Bayleef Razor Leaf Wobbuffet 12 Gyarados Hyperbeam Charizard 13 Bewear Take Down Raichu 10 Wobbuffet Mirror Coat Bayleef 17 Charizard Flamethrower Raichu 14 Bayleef Razor Leaf Gyarados 18 Gyarados Hyperbeam Bewear 16 Bewear Take Down Wobbuffet 12 6 Raichu Thunderbolt Charizard 11 Gyarados Hyperbeam Wobbuffet 15 Bewear Take Down Charizard 18 Raichu Thunderbolt Bewear 13 healthy.txt This output file includes the extra credit portion of the program. If you do not attempt the extra credit, the lines of output will be in the order the Pokemon appear in the input file. Raichu 23 Gyarados 21 Bayleef 14 Bewear 0 Output Printed to Standard Output (only for Extra Credit) Gyarados attacked Wobbuffet. It is super effective Bewear attacked Charizard. It is super effective Algorithm for Insertion Sort Please note that the algorithm sorts in ascending order, and is assumed to be working on primitives. You would have to modify it for sorting in descending order and to work with an array of structs. Hint: We cannot compare structs, only individual data members of structs. loop i from 1 to Length(A) x = A[i] j = i - 1 loop as long as j >= 0 and A[j] > x A[j+1] = A[j] j = j - 1 end loop A[j+1] = x end loop 4 Generic Guidelines 1. Include the header comment (in the Homework Rules page on Top Hat) with your name and other information on the top of your files. 2. This is individual work. You may NOT collaborate with other students in the course, former students, hire tutors to “help”, copy solutions off the internet, or use pay-for solution websites, including but not limited to Chegg, CourseHero, WiseAnt, Bartelby,, assorted Social Media groups, Discord servers where people offer “100% plagiarism-free solutions”, any GroupMe groups students might have created, etc.) This includes posting the problem statements on these websites even if you do not use the answer obtained. Doing so is a violation of the Academic Honor Code. Violation of the Honor Code will result in a 0 grade on the program, a reduced letter grade in the course and potentially more serious consequences. 7 3. Please make sure you’re only using the concepts already discussed in class. Please restrict yourself to variables, operators, selection statements, loops, functions, arrays, strings, pointers, and structs. Using classes, C++ 11 and up features (including string class iterators and the STL) or anything more advanced will result in a loss of 15-20 points (specified in the problem specifications). 4. If we have listed a specification and allocated point for it, you will lose points if that particular item is missing from your code, even if it is trivial. 5. No global variables (variables outside of main() ). constants and symbolic constants are allowed. 6. No goto statements or the auto keyword. Using these would result in a 10 point penalty. 7. In-stack arrays and strings should have a constant/literal size upon declaration. Creating variable- size in-stack arrays would result in a 10-point penalty per array. 8. All input and output must be done with streams, using the library iostream. 9. You may only use the specified libraries for programs (you do not need any others for these tasks). Using other libraries will result in a loss of 10-20 points (specified in the requirements for each program). 10. Please make sure that you’re conforming to specifications (program name, function names, parame- ters, return types, print statements, expected inputs, and outputs, etc.). Not doing so will result in a loss of 10 points. Please note that names are case-sensitive. 11. Do not use break or continue statements in loops. break is allowed only for preventing the fall- though in a switch statement. Use of these would result in a loss of 10 points per statement. 12. Functions should be declared above main and defined after main, in the convention established in the in-class examples. Failing to do so would result in a loss of 10 points per program. 13. NO C style printing is permitted. (Aka, don’t use printf). Use cout if you need to print to the screen. 14. When you write source code, it should be readable and well-documented (comments). 15. Make sure you either develop with or test with onlinegdb and/or CLion (to be sure it reports no compile errors or warnings) before you submit the program. 16. Testing your program thoroughly is a part of writing good code. We give you sample runs to make sure you match our output requirements and to get a general idea of how we would test your code. Matching your outputs for JUST the sample runs is not a guarantee of a 100. We have several extensive test cases. 17. Please make sure you’ve compiled and run your program before you turn it in. Compilation errors can be quite costly. We take 5 points off per compiler error for the first 9 errors. The 10th compiler error will result in a grade of 0. 18. Only a file turned in through Canvas counts as a submission. A file on your computer or onlinegdb, even if it hasn’t been edited after the deadline, does not count. 19. The student is responsible for making sure they have turned in the right file(s). We will not accept any excuses about inadvertently modifying or deleting files, or turning in the wrong files. 20. Program submissions should be done through the Canvas class page, under the assignments tab (if it’s not there yet I’ll create it soon.) Do not send program submissions through e-mail – e-mail attachments will not be accepted as valid submissions. 8 21. The ONLY files you will submit via Canvas are mirrors.cpp and pokemonBattles.cpp. 22. General Advice - always keep an untouched copy of your finished homework files in your email. These files will have a time stamp that will show when they were last worked on and will serve as a backup in case you ever have legitimate problems with submitting files through Canvas. Do this for ALL programs. 9 Objective Problem - Use the Force Luke! - 100 points Specifications Problem 2 - Pokemon Battle - 100 points + 30 points extra credit Generic Guidelines
There are no answers to this question.
Login to buy an answer or post yours. You can also vote on other others

Get Help With a similar task to - Programming 1 C++ Final Project

Related Questions

Similar orders to Programming 1 C++ Final Project
Popular Services
Tutlance Experts offer help in a wide range of topics. Here are some of our top services: