<mosaic.cnfolio.com>
PROGRAM
  1. /* Pseudo Code
  2. START
  3.  
  4. Obtain amount of pidgey pokemon
  5. IF  Player has less than 1 pidgey
  6. THEN 
  7.    Display not enough pidgeys to be able to evolve
  8. ELSE   
  9.    Display player can evolve pidgey
  10. END IF
  11.  
  12. Obtain amount of pidgeycandies player has
  13. IF Player has 12 or more pidgeycandies
  14. THEN
  15.    Display player is able to evolve pidgey
  16. ELSE
  17.    Display player cannot evolve pidgey
  18. END IF
  19.  
  20. While Player has 12 or more pidgeycandies and 1 or more pidgeys
  21.    
  22.    Start evolution process
  23.    Decrease pidgey by 1
  24.    Decrease candies by 12
  25.    Increase XP by 1000
  26.    Increase pidgeycandies by 1
  27. END While
  28. Show total amount of XP gained
  29. END
  30.  
  31. */
  32. #include <stdio.h>
  33.  
  34. int main (void)
  35.  
  36. {
  37.    
  38. int pidgey = 0;
  39.    
  40. int pidgeyCandy = 0;
  41.    
  42. int xp = 0;
  43.  
  44. int numVariables;
  45.  
  46. printf("Enter number of pidgey and pidgeyCandy : \n");
  47. numVariables=scanf("%d %d", &pidgey, &pidgeyCandy); // Scanf will return how many inputs are stored in this example we have 2.
  48. printf("numVariables is %d \n", numVariables);
  49. if (numVariables != 2) // numVariables value set to 2 so that we know 2 inputs is all the program will allow.
  50. {
  51. printf("Must enter 2 variables \n"); //Error checking which will make sure 2 integer inputs are entered at all times.
  52. }
  53. if (pidgey == 0)
  54. {
  55. printf("Player has no pidgey in their inventory \n");
  56. }
  57. if (pidgeyCandy <12)
  58. {
  59. printf("Player doesnt have enough pidgeyCandy in their inventory \n");
  60. }
  61.  
  62. printf("pidgey is %d\n", pidgey); //This will print number of pidgeys entered as the first variable in the sequence.
  63.  
  64.    
  65. printf("pidgeyCandy is %d\n\n", pidgeyCandy); //This will print the second variable of the sequence which will show how many candies are being used.
  66.  
  67.    
  68. while (pidgey >= 1 && pidgeyCandy >= 12) //The loop will run if the criteria of 1 or more pidgeys and 12 or more candies is met.
  69.    
  70. {
  71.       pidgey--; //The two negatives means every time a successful loop cycle is completed one pidgey will be taken from the total.
  72.       pidgeyCandy = pidgeyCandy - 12; //Every time the loop is complete 12 pidgeyCandy will be taken from the total.
  73.       xp = xp + 1000; //After each successful evolution the player is granted with 1000xp as the lucky egg doubles the original xp which would be 500xp.
  74.       pidgeyCandy++; //After evolving player gets one pidgeyCandy back into their inventory.
  75.    }
  76.  
  77.    
  78.  
  79. printf("\npidgey value is %d\n", pidgey); //This printf show how many pidgeys are leftover from an evolving pidgey.
  80.    
  81.  
  82. printf("pidgeyCandy value is %d\n\n", pidgeyCandy); //This printf will show how much pideyCandy is leftover from evolving pidgey.
  83.  
  84.    
  85.  
  86. printf("The total amount of XP is %d\n", xp); //Final printf is to show the total amount of xp which is given at the end of the evoltuions.
  87.  
  88.  
  89. }