<mosaic.cnfolio.com>
PROGRAM
  1. /*
  2. START
  3.  
  4. Define Pokemon, Candies, Evolves and Poketype as intergers
  5. Initilaise pokemon at 0
  6. Initilaise candies at 0
  7. Initialise evolves at 0
  8. Initialise pokemon type at 12
  9.  
  10. SCAN the input data and add them to the relevant integer
  11.  
  12. IF Pokemon Type is not valid
  13.    THEN
  14.    Print an error message informing the user of this.
  15. END IF
  16. ELSE IF If there is enough candies, pokemon and the pokemon type has been selected as a valid input
  17.    THEN
  18.    WHILE there are enough candies and pokemon
  19.       Decrement the Pokemon count by one
  20.       Decrement the Candy count by the Pokemon Type cost
  21.       Increment the Candy by one to account for the candy returned
  22.       Increment the evolve count by one.
  23.    END WHILE
  24.    THEN
  25.    Print a message informing how many pokemon they can evolve, based on Evolve integer
  26.    IF The pokemon type is set to 12
  27.       THEN
  28.       Print a message informing the user of what Pokemon this applies to
  29.    END IF
  30.    IF The pokemon type is set to 25
  31.       THEN
  32.       Print a message informing the user what Pokemon this applies to
  33.    END IF
  34.    IF The pokemon type is set to 50
  35.       THEN
  36.       Print a message informing the user what Pokemon this applies to
  37.    END IF
  38.    IF The pokemon type is set to 100
  39.       THEN
  40.       Print a message informing the user what Pokemon this applies to
  41.    END IF
  42.    IF The pokemon type is set to 400
  43.       THEN
  44.       Print a message informing the user what Pokemon this applies to
  45.    IF there are more than 60 Pokemon
  46.       THEN
  47.       Print a message informing the user they may have to use more than one lucky egg.
  48.    END IF
  49. END IF
  50.  
  51. ELSE IF There are not enough Pokemon (Minium 1)
  52.    THEN
  53.    Print an error message informing the user of there not being enough Pokemon
  54. END IF
  55. ELSE IF There are not a not enough candies, based on the selected pokemon type
  56.    THEN
  57.    Print an error message informing them there are not enough Candies
  58. END IF
  59. IF There are more than 0 Pokemon left and an evolution has occured
  60.    THEN
  61.    Print a message informing the user how many Pokemon they will have left
  62. END IF
  63. IF There are more than 0 candies left and an evolution has occured
  64.    THEN
  65.    Print a message informing the user how many candies they will have left.
  66. END IF
  67. THEN
  68.    Print a message informing the user that the calculator is able to handle other Pokemon
  69. END
  70. */
  71. #include <stdio.h>
  72. #include <math.h>
  73.  
  74. int main(void)
  75. {
  76.    int pokemon, candies, evolves, poketype; /*Define as integers */
  77.    pokemon = 0;
  78.    candies = 0;
  79.    evolves = 0; /* Resetting all inputs */
  80.    poketype = 12; /* Default run argument */
  81.      
  82.    scanf( "%d %d %d", &pokemon, &candies, &poketype); /* Scan inputs */
  83.    
  84.    if (poketype != 12 && poketype != 25 && poketype != 50 && poketype != 100 && poketype != 400) /*Verify that the Poketype is valid */
  85.    {
  86.       printf("Incorrect Pokemon type entered, valid numbers are 12, 25, 50, 100 and 400 you have entered %d", poketype); /* Print an error message if they aren't */
  87.    }
  88.    
  89.    else if (candies >= 12 && pokemon >= 1 && poketype == 12 || candies >= 25 && pokemon >= 1 && poketype == 25 || candies >= 50 && pokemon >=1 && poketype == 50 || candies >= 100 && pokemon >=1 && poketype == 100 || candies >= 400 && pokemon >= 1 && poketype == 400) /* Check there are enough candies and pidgeys */
  90.    {
  91.       
  92.       while (candies >= poketype && pokemon > 0)
  93.       {
  94.       pokemon--;
  95.       candies -= poketype;
  96.       candies++;
  97.       evolves++;
  98.       }
  99.       printf("You can evolve a maximum of %d pokemon(s), for which you will recieve %d experience, assuming you use a lucky egg.\n", evolves, evolves * 1000);
  100.       if (poketype == 12)
  101.       printf("This applies to Pidgeys, Weedle and Caterpie.\n");
  102.       if (poketype == 25)
  103.       printf("This applies to all Pokemon listed here under the header 25 candies, E.g, Squirtle, Rattata etc. \nhttp://segmentnext.com/2016/07/20/pokemon-go-evolution-requirements-how-many-candies-you-need-to-evolve-every-pokemon/\n");
  104.       if (poketype == 50)
  105.       printf("This applies to all Pokemon listed here under the header 50 candies, E.g, Drowzee, Metapod etc. \nhttp://segmentnext.com/2016/07/20/pokemon-go-evolution-requirements-how-many-candies-you-need-to-evolve-every-pokemon/\n");
  106.       if (poketype == 100)
  107.       printf("This applies to all Pokemon listed here under 100 candies, E.g, Ivysaur, Gloom etc. \nhttp://segmentnext.com/2016/07/20/pokemon-go-evolution-requirements-how-many-candies-you-need-to-evolve-every-pokemon/\n");
  108.       if (poketype == 400)
  109.       printf("This applies only to the Magikarp\n");
  110.       if (pokemon > 60)
  111.       printf("NOTE: You have over 60 pokemon, %d infact, you may have to use more than one lucky egg to evolve this many pokemon.\n", pokemon);   
  112.   }
  113.      
  114.    else if (pokemon < 1) /* Print an error if not enough pidgeys */
  115.    {
  116.     printf("Invalid input: please enter a valid amount of pokemon! You currently have %d\n", pokemon);
  117.    }
  118.    else if (candies < 12 && poketype == 12 || candies < 25 && poketype == 25 || candies < 50 && poketype == 50 || candies < 100 && poketype == 100 || candies < 400 & poketype == 400) /* Print an error if not enough candies */
  119.    {
  120.       printf( "Whoops, you don't have enough candies to evolve any pokemon, you need %d, you have %d\n", poketype, candies);   
  121.    }
  122.    if(pokemon > 0 && evolves > 0) /* Inform user how many Pokemon they will have left, if any */
  123.    {
  124.       printf("You will have %d Pokemon left\n", pokemon);
  125.    }
  126.    if(candies >= 1 && evolves > 0) /* Inform user how many Candies they will have left, is any */
  127.    {
  128.       printf("You will have %d candy left\n", candies);
  129.    }
  130.    
  131.    printf("\n\nThis calculator can calculate other forms of pokemon too! By default it calculates Pidgeys (12 candies)\nE.g, Bulbsaur (25 candies), Metapod (50 candies), Ivysaur (100 candies) and the infamous Magikarp (400 Candies)");
  132.    printf("\nTo use other forms of Pokemon enter the number of candies required for their first evolve as a third number in the input data box (25, 50, 100, 400)");
  133. }