Advertisement
TheMantyke

MatlabPokemon

Feb 6th, 2012
421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. %==========================================================================
  2. % PROBLEM 2. Battles with Starter Pokemon
  3. %--------------------------------------------------------------------------
  4. %
  5. % Function Name: iChooseYou
  6. % Inputs (2): - (char) a string containing the Pokemon that you are using
  7. % - (char) a string containing the Pokemon that your rival is
  8. % using
  9. % Outputs (1): - (char) a string telling which player has the type
  10. % advantage
  11. %
  12. % Function Description:
  13. % You have just chosen a starter Pokemon, and now your rival wants to
  14. % battle! You want to determine which of your Pokemon has the type
  15. % advantage over the other, so you use MATLAB to help you in this
  16. % endeavor.
  17. %
  18. % Write a function called "iChooseYou" that takes in a string containing
  19. % the Pokemon that you are using and a string containing the Pokemon that
  20. % your rival is using. The strings will only contain 'Charmander',
  21. % 'Squirtle', or 'Bulbasaur'. The function should then output a string
  22. % describing which person has the type advantage. If you have the type
  23. % advantage, then the function should return 'No sweat!', but if your
  24. % rival has the type advantage, then the string should say 'This will be
  25. % difficult...'
  26. %
  27. % For those who are unfamiliar with Pokemon, the type advantages are as
  28. % follows:
  29. %
  30. % - Charmander has a type advantage over Bulbasaur
  31. % - Bulbasaur has a type advantage over Squirtle
  32. % - Squirtle has a type advantage over Charmander
  33. %
  34. % Notes:
  35. % - You and your rival will never have the same Pokemon, i.e. the inputs
  36. % will never be the same string.
  37. %
  38. % Test Cases:
  39. %
  40. % poke1 = iChooseYou('Squirtle', 'Bulbasaur');
  41. % poke1 => 'This will be difficult...'
  42. %
  43. % poke2 = iChooseYou('Charmander', 'Bulbasaur');
  44. % poke2 => 'No sweat!'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement