You can submit this task online or view your submission status if you are a part of this course when you login to WebCMS3.

Latest specification and accompanying files:

  • Version 1.2: http://www.cse.unsw.edu.au/~simm/assign2/v1.2/
    • Changed reading of selection to use scanf(" %c", &selection);
    • Specification change: findPkmn: numberOfPkmn parameter: This number should indicate the number of Pokemon found, not the number of *new* Pokemon found.
      • If an id is generated, that is not in the Pokedex at all, then it doesn't count towards the number of Pokemon encountered.
      • Encountering the same Pokemon twice, does count as two distinct encounters contributing to the number of Pokemon encountered.
  • Version 1.1: http://www.cse.unsw.edu.au/~simm/assign2/v1.1/
    • Added line 13 to main.c. Now the newline after the selection is entered, is removed by an extra getchar();
    • Added #define for length of a Pokemon name to Pkmn.h.
  • Version 1.0: http://www.cse.unsw.edu.au/~simm/assign2/v1.0/
    • Added Stages 3 to 5 inclusive.
    • This is the first complete specification.
    • Minor changes may still occur, but most will be in the form of specification clarifications which will appear at the bottom of this page as FAQs.
  • Version 0.4: http://www.cse.unsw.edu.au/~simm/assign2/v0.4/
    • In Stage 1: Changed printPkmn(Pkmn pokemon) to printCurrentPkmn(PkmnList list). This includes the change of function prototype in Pkmn.h, change of function in Pkmn.c and a clarification in the spec about what the function should do.
    • Added stdio.h to Pkmn.c.
  • Version 0.3: http://www.cse.unsw.edu.au/~simm/assign2/v0.3/
    • Added Stage 0.
    • Added Stage 2.
    • Added code to the bottom of Pkmn.h and Pkmn.c to include Stage 2 functions.
    • main.c remains unchanged from v0.2.
  • Version 0.2: http://www.cse.unsw.edu.au/~simm/assign2/v0.2/
    • Updated Pkmn.c and Pkmn.h and main.c files. (Small fixes to enable compilation.)
    • Stage 1 only.

Why are there so many variables passed into createPkmn?

These variables should have values read into them while still in main.c, and then when createPkmn is called, they should have values in them. This is so that createPkmn can be tested without the use of standard input.

What's the format for entering Pokemon details?

Id: 007
Name: Squirtle
Height: 0.51
Weight: 9
Type: 17
Type: -1

Note: The name of Pokemon is a single word.

What's the format for entering which Pokemon to jump to? (For function jumpToPkmn)

Prompt for the id to be entered.

For example:

Id: 007

What's the format for entering the seed, factor and number of Pokemon? (For function findPkmn)

Prompt for each value to be entered independently as shown below.

For example:

Seed: 5
Factor: 192

Number to find: 7

Is there a maximum length for the Pokemon's name?

Yes (though you don't need to use it). It is 50 characters.

What input validation do we need to do?

None. This includes capital letters being entered as a command - it won't happen.

How do we format the display for the Pokemon details, if the Pokemon has more than one type?

Id: 041
Name: Zubat

Height: 0.79m

Weight: 7.50kg

Type: Flying/Poison

The types should be listed like this in alphabetical order, regardless of the order in which they were entered when creating the Pokemon.

Are we allowed to use other libraries, such as string.h?

You may include string.h and use any functions it provides, unless the specification for a specific function says you may not use string.h functions.

Do we print the Pokemon List in a specific order?

Yes. Print the Pokemon List in the order in which the Pokemon are stored in the list.

If an unfound Pokemon has 2 types, how should it be displayed?

Type: --

More output formatting details:

  • How to print the number of Pokemon found: 3 Pokemon found.
  • How to print list/details if the list is empty: No Pokemon in list.
  • Evolution printing: #007 Squirtle --> #008 Wartortle --> #009 Blastoise
  • Evolution printing when a Pokemon has not yet been found:
    • #007 Squirtle --> #008 ********* --> #009 Blastoise
  • Evolution printing for a Pokemon not yet currently in the list:
    • #007 Squirtle --> #008 Wartortle --> #009 ?????
    • There should always be 5 question marks indicating a Pokemon which is not in the list.
    • When adding an evolution to a Pokemon, if the original Pokemon is not already in the Pokedex, then addEvolution should do nothing. This means, that the only time that ????? should be printed is at the end of an evolution chain.
  • In this scenario, if the current Pokemon is #008, when we showEvolutions, it should only print #008 Wartortle --> #009 ?????
  • Evolution printing for a Pokemon which doesn't have any evolutions:
    • #007 Squirtle

Input format for Evolutions?

Id of original Pokemon: 007
Id of evolution: 008

What do we do if asked to add a Pokemon which is already in the list? (Or one with the same id.)

When adding a Pokemon to the list, if there is already a Pokemon in the list with that id, the new Pokemon should not be added to the list. (No error message or output is needed.)

Can we use ctype.h library for Stage 5?

Yes.

How will Stage 5 be marked?

We will be calling these functions in isolation, along with your printList function. You can add extra commands to main.c if you'd like and use that to test it. We don't mind (you won't lose marks for having extra commands in main.c).

Can a Pokemon sometimes evolve into more than one new Pokemon?

No.

How many decimal places should height and weight be printed in? How do we do this?

Height and weight should be printed to 2 decimal places. You can do this either by storing the number of cm, and then printing height/100, the decimal point, then height%100. Or you can store the number of metres and use printf("%.2f", height).

If a Pokemon has only one type, how should the type be displayed?

If a Pokemon has only one type:

Type: Bug

If a Pokemon has two types:

Type: Bug/Poison

What order should the names be displayed in the produced list in searchByName function?

Same order as the appear in the original list

Should searchByName/getPkmnOfType functions only extract found Pokemon or any Pokemon that matches the criteria?

Any pokemon that matches criteria should be extracted and placed into the new list. The fact that it hasn't been found should be preserved in the new list as well.

Stage 5 - Search by Name. What order should the returned list be?

Same as original list.

Sample solution uses srand/rand to generate random numbers. If you have a mismatch in output, try using the same function.

Resource created Saturday 24 September 2016, 10:01:32 AM, last modified Monday 17 October 2016, 10:44:33 AM.


Back to top

COMP1917 16s2 (Computing 1) is powered by WebCMS3
CRICOS Provider No. 00098G