3/30/2020 Assignment 2 - Pokedex https://cgi.cse.unsw.edu.au/~dp1091/20T1/assignments/ass2/index.html 2/22 Introduction For this assignment, we are asking you to implement a mini Pokedex in C. The...

Help for c programming assignment


3/30/2020 Assignment 2 - Pokedex https://cgi.cse.unsw.edu.au/~dp1091/20T1/assignments/ass2/index.html 2/22 Introduction For this assignment, we are asking you to implement a mini Pokedex in C. The task is split into 4 sections; each section is not weighted the same. What is a Pokemon? What is a Pokedex? Hello there! Welcome to the world of Pokemon! My name is Oak! People call me the Pokemon Prof! This world is inhabited by creatures called Pokemon! For some people, Pokemon are pets. Others use them for fights. Myself ... I study Pokemon as a profession. — Professor Oak Pokemon are fictional creatures from the Pokemon franchise, most famously from the Pokemon games. The game revolves around the (questionably ethical) capturing of these creatures. Within the fiction of this universe, a device called the Pokedex is used to catalogue all the creatures a player finds and captures. Where can we learn more about Pokedexes? You can play the one of the original Pokemon games here. Quite early in the game you get introduced to the Pokedex. There's some more information on the Pokemon Wikia. In addition, Google will be a great resource, as the topic has been extensively written up about. http://emulator.online/gameboy/pokemon-blue-version/ http://pokemon.wikia.com/wiki/Pok%C3%A9dex 3/30/2020 Assignment 2 - Pokedex https://cgi.cse.unsw.edu.au/~dp1091/20T1/assignments/ass2/index.html 3/22 Supplied Code This zip file contains the files that you need to get started with the assignment. It contains the following files: pokedex.h contains declarations for all functions you need to implement for this assignment. Don't change pokedex.h pokedex.c contains stubs for all the functions you need to implement for this assignment. Put all your Pokedex code in pokedex.c. pokemon.h contains declarations for all functions you must call to create and manipulate Pokemon. Don't change pokemon.h pokemon.c contains the functions you must call to create and manipulate Pokemon. Don't change pokemon.c main.c contains a main function and other functions that allow you to interactively test the functions you implement in pokedex.c Don't change main.c test_pokedex.c contains a main function and other functions which are your starting point for a test framework to automatically test the functions you implement in pokedex.c. As you implement functions in pokedex.c you should add tests to test_pokedex.c. Only put testing code in test_pokedex.c. https://cgi.cse.unsw.edu.au/~dp1091/20T1/assignments/ass2/ass2.zip https://cgi.cse.unsw.edu.au/~dp1091/20T1/assignments/ass2/pokedex.h https://cgi.cse.unsw.edu.au/~dp1091/20T1/assignments/ass2/pokedex.c https://cgi.cse.unsw.edu.au/~dp1091/20T1/assignments/ass2/pokemon.h https://cgi.cse.unsw.edu.au/~dp1091/20T1/assignments/ass2/pokemon.c https://cgi.cse.unsw.edu.au/~dp1091/20T1/assignments/ass2/main.c https://cgi.cse.unsw.edu.au/~dp1091/20T1/assignments/ass2/test_pokedex.c 3/30/2020 Assignment 2 - Pokedex https://cgi.cse.unsw.edu.au/~dp1091/20T1/assignments/ass2/index.html 4/22 Reference implementation A reference implementation reference_implementation is available to help you understand the assignment. $ ~dp1091/bin/reference_implementation ===========================[ Pokedex ]========================== Welcome to the Pokedex! How can I help? ================================================================ Enter command: ? a [pokemon_id] [name] [height] [weight] [type1] [type2] Add a Pokemon to the Pokedex p Print all of the Pokemon in the Pokedex (in the order they were adde d) d Display details of the currently selected Pokemon > Move the cursor to the next Pokemon in the Pokedex< move="" the="" cursor="" to="" the="" previous="" pokemon="" in="" the="" pokedex="" m="" [pokemon_id]="" move="" the="" cursor="" to="" the="" pokemon="" with="" the="" specified="" pokemon_id="" r="" remove="" the="" current="" pokemon="" from="" the="" pokedex="" f="" set="" the="" current="" pokemon="" to="" be="" found="" c="" print="" out="" the="" count="" of="" pokemon="" who="" have="" been="" found="" t="" print="" out="" the="" total="" count="" of="" pokemon="" in="" the="" pokedex="" e="" [pokemon_a]="" [pokemon_b]="" add="" an="" evolution="" from="" pokemon="" a="" to="" pokemon="" b="" s="" show="" evolutions="" of="" the="" currently="" selected="" pokemon="" q="" quit="" show="" help="" enter="" command:="" a="" 1="" bulbasaur="" 0.7="" 6.9="" poison="" grass="" added="" bulbasaur="" to="" the="" pokedex!="" your="" pokedex.c="" (compiled="" with="" the="" supplied="" pokemon.c="" and="" main.c)="" should="" match="" the="" behaviour="" of="" the="" reference="" implementation.="" provision="" of="" a="" reference="" implementation="" is="" a="" common="" method="" to="" provide="" an="" operational="" specification,="" and="" it's="" something="" you="" will="" likely="" need="" to="" do="" outside="" unsw.="" if="" you="" discover="" what="" you="" believe="" to="" be="" a="" bug="" in="" the="" reference="" implementation,="" report="" it="" in="" the="" class="" forum.="" we="" may="" fix="" the="" bug="" or="" indicate="" that="" you="" do="" not="" need="" to="" match="" the="" reference="" implementation's="" behaviour="" in="" this="" case.="" 3/30/2020="" assignment="" 2="" -="" pokedex="" https://cgi.cse.unsw.edu.au/~dp1091/20t1/assignments/ass2/index.html="" 5/22="" stage="" 1:="" adding="" and="" printing="" when="" you="" compile="" and="" run="" the="" given="" code,="" you="" will="" get="" the="" following="" message="" if="" you="" try="" to="" add="" a="" pokemon:="" $="" dcc="" -o="" pokedex="" main.c="" pokedex.c="" pokemon.c="" $="" ./pokedex="==========================[" pokedex="" ]="=========================" welcome="" to="" the="" pokedex!="" how="" can="" i="" help?="===============================================================" enter="" command:="" a="" 1="" bulbasaur="" 0.7="" 6.9="" poison="" grass="" exiting="" because="" you="" have="" not="" implemented="" the="" add_pokemon="" function="" in="" poke="" dex.c="" when="" you="" run="" the="" a="" command,="" this="" function="" in="" pokedex.c="" is="" called:="" void="" add_pokemon(pokedex="" pokedex,="" pokemon="" pokemon)="" {="" fprintf(stderr,="" "exiting="" because="" you="" have="" not="" implemented="" the="" add_pokemon="" function="" in="" pokedex.c\n");="" exit(1);="" }="" your="" first="" task="" is="" to="" implement="" add_pokemon.="" all="" the="" functions="" you="" have="" to="" implement="" in="" pokedex.c="" have="" descriptions="" in="" pokedex.h:="" note:="" should="" be="" just="" add_pokemon="" prototype="" https://cgi.cse.unsw.edu.au/~dp1091/20t1/assignments/ass2/pokedex.c="" https://cgi.cse.unsw.edu.au/~dp1091/20t1/assignments/ass2/pokedex.c="" https://cgi.cse.unsw.edu.au/~dp1091/20t1/assignments/ass2/pokedex.h="" 3/30/2020="" assignment="" 2="" -="" pokedex="" https://cgi.cse.unsw.edu.au/~dp1091/20t1/assignments/ass2/index.html="" 6/22="" do="" not="" change="" this="" file="" you="" do="" not="" submit="" this="" file.="" this="" file="" is="" not="" marked.="" if="" you="" think="" you="" need="" to="" change="" this="" file="" you="" have="" misunderstood="" the="" assignment="" -="" ask="" in="" the="" course="" forum.="" assignment="" 2="" 20t1="" cp1511:="" pokedex="" pokedex.h="" you="" must="" not="" change="" this="" file.="" version="" 1.0.0:="" assignment="" released.="" version="" 1.0.1:="" minor="" clarifications="" to="" `get_current_pokemon`.="" version="" 1.0.2:="" minor="" clarifications="" to="" `add_pokemon`.="" version="" 1.0.3:="" added="" examples="" about="" pokemon="" order="" in="" a="" pokedex.="" version="" 1.0.4:="" renamed="" "pokemon_id"="" to="" "id"="" in="" change_current_pokemon.="" version="" 1.0.5:="" clarify="" "encountering"="" pokemon="" in="" go_exploring.="" version="" 1.0.6:="" add="" info="" about="" not="" copying="" evolution="" info="" +="" fix="" typos.="" version="" 1.0.7:="" clarifications="" about="" valid="" types="" in="" get_pokemon_of_type.="" #include="" "pokemon.h"="" #ifndef="" _pokedex_h_="" #define="" _pokedex_h_="" typedef="" struct="" pokedex="" *pokedex;="" #define="" does_not_evolve="" (-42)="" create="" a="" new="" pokedex="" and="" return="" a="" pointer="" to="" it.="" the="" pointer="" is="" to="" a="" malloced="" piece="" of="" memory,="" and="" it="" is="" the="" caller's="" responsibility="" to="" call="" 'destroy_pokedex'="" to="" free="" that="" memory.="" pokedex="" new_pokedex(void);="" stage="" 1="" functions="" add="" a="" new="" pokemon="" to="" the="" pokedex.="" note:="" just="" adding="" the="" pokemon="" to="" the="" pokedex="" does="" not="" mean="" it="" has="" been="" 'found'.="" the="" new="" pokemon="" should="" be="" added="" to="" the="" end="" of="" the="" pokedex="" (i.e.="" directly="" after="" the="" pokemon="" that="" was="" added="" when="" add_pokemon="" was="" last="" called).="" when="" the="" first="" pokemon="" is="" added="" to="" the="" pokédex,="" the="" currently="" selected="" pokemon="" becomes="" this="" pokemon.="" the="" currently="" selected="" pokemon="" remains="" the="" first="" pokemon="" that="" was="" inserted="" into="" the="" pokedex,="" until="" the="" `change_current_pokemon`,="" `next_pokemon`,="" or="" `prev_pokemon`="" functions="" are="" called.="" if="" there="" is="" already="" a="" pokemon="" in="" the="" pokedex="" with="" the="" same="" pokemon_id="" as="" this="" pokemon,="" the="" function="" should="" print="" an="" appropriate="" error="" message="" and="" exit="" the="" program.="" pokedex="" order:="" --------------="" the="" pokemon="" in="" the="" pokedex="" are="" stored="" in="" the="" order="" in="" which="" they="" were="" added,="" i.e.="" the="" first="" pokemon="" in="" the="" pokedex="" will="" be="" the="" first="" pokemon="" that="" was="" added,="" the="" second="" pokemon="" in="" the="" pokedex="" will="" be="" the="" second="" pokemon="" that="" was="" added="" etc,="" and="" the="" last="" pokemon="" in="" the="" pokedex="" will="" be="" the="" pokemon="" that="" was="" added="" most="" recently.="" for="" example,="" if="" pikachu="" (#025)="" was="" added="" into="" an="" empty="" pokedex,="" the="" pokedex="" would="" now="" contain="" pikachu="" at="" the="" start="" of="" the="" list,="" and="" pikachu="" would="" be="" the="" currently="" selected="" pokemon.="" [start="" of="" pokedex]="" 3/30/2020="" assignment="" 2="" -="" pokedex="" https://cgi.cse.unsw.edu.au/~dp1091/20t1/assignments/ass2/index.html="" 7/22="" #025:="" pikachu=""><-- currently="" selected="" pokemon="" [end="" of="" pokedex]="" if="" squirtle="" (#007)="" was="" then="" added,="" it="" would="" be="" the="" second="" pokemon="" in="" the="" pokedex,="" after="" pikachu.="" the="" currently="" selected="" pokemon="" would="" remain="" pikachu.="" [start="" of="" pokedex]="" #025:="" pikachu=""><-- currently="" selected="" pokemon="" #003:="" squirtle="" [end="" of="" pokedex]="" if="" diglett="" (#050)="" was="" then="" added,="" it="" would="" be="" the="" third="" pokemon="" in="" the="" pokedex,="" after="" squirtle.="" [start="" of="" pokedex]="" #025:="" pikachu=""><-- currently selected pokemon // #003: squirtle // #050: diglett // [end of pokedex] void add_pokemon(pokedex pokedex, pokemon pokemon); // print out the details of the currently selected pokemon in the form: // id: 007 // name: squirtle // height: 0.51m // weight: 9.0kg // type: water // // if the pokemon has not been found, the output should be: // id: 007 // name: ******** // height: -- // weight: -- // type: -- // // if the pokemon has multiple types, they should be separated by a space: // id: 006 // name: charizard // height: 1.7m // weight: 90.5kg // type: fire flying void detail_pokemon(pokedex pokedex); // return the currently selected pokemon (i.e. the pointer to the // pokemon struct, which was originally passed in to new_pokemon). // // the currently selected pokemon starts out as the first pokemon that // was added to the pokedex, and can be changed by calling the functions // you will implement in stage 2 (e.g. `next_pokemon`). // // see the `test_next_pokemon` function in test_pokedex.c for a concrete // example of this function being used. // // if the pokedex currently="" selected="" pokemon="" #003:="" squirtle="" #050:="" diglett="" [end="" of="" pokedex]="" void="" add_pokemon(pokedex="" pokedex,="" pokemon="" pokemon);="" print="" out="" the="" details="" of="" the="" currently="" selected="" pokemon="" in="" the="" form:="" id:="" 007="" name:="" squirtle="" height:="" 0.51m="" weight:="" 9.0kg="" type:="" water="" if="" the="" pokemon="" has="" not="" been="" found,="" the="" output="" should="" be:="" id:="" 007="" name:="" ********="" height:="" --="" weight:="" --="" type:="" --="" if="" the="" pokemon="" has="" multiple="" types,="" they="" should="" be="" separated="" by="" a="" space:="" id:="" 006="" name:="" charizard="" height:="" 1.7m="" weight:="" 90.5kg="" type:="" fire="" flying="" void="" detail_pokemon(pokedex="" pokedex);="" return="" the="" currently="" selected="" pokemon="" (i.e.="" the="" pointer="" to="" the="" pokemon="" struct,="" which="" was="" originally="" passed="" in="" to="" new_pokemon).="" the="" currently="" selected="" pokemon="" starts="" out="" as="" the="" first="" pokemon="" that="" was="" added="" to="" the="" pokedex,="" and="" can="" be="" changed="" by="" calling="" the="" functions="" you="" will="" implement="" in="" stage="" 2="" (e.g.="" `next_pokemon`).="" see="" the="" `test_next_pokemon`="" function="" in="" test_pokedex.c="" for="" a="" concrete="" example="" of="" this="" function="" being="" used.="" if="" the="">
Apr 04, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here