Advertisement
Guest User

15. Neighbour Wars

a guest
Jan 29th, 2018
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. using System;
  2.  
  3. namespace NeighbourWars
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. var peshoDamage = int.Parse(Console.ReadLine());
  10. var goshoDamage = int.Parse(Console.ReadLine());
  11.  
  12. var peshoHealth = 100;
  13. var goshoHealth = 100;
  14.  
  15. var attacker = "";
  16. var attackName = "";
  17. var defender = "";
  18. var defenderHealth = 0;
  19. var winner = "";
  20. var counter = 0;
  21.  
  22. while (peshoHealth > 0 || goshoHealth > 0)
  23. {
  24. counter++;
  25. if (counter % 2 == 0)
  26. {
  27. attacker = "Gosho";
  28. attackName = "Thunderous fist";
  29. defender = "Pesho";
  30. peshoHealth -= goshoDamage;
  31. defenderHealth = peshoHealth;
  32. winner = "Gosho";
  33. }
  34. else
  35. {
  36. attacker = "Pesho";
  37. attackName = "Roundhouse kick";
  38. defender = "Gosho";
  39. goshoHealth -= peshoDamage;
  40. defenderHealth = goshoHealth;
  41. winner = "Pesho";
  42. }
  43.  
  44. if (counter % 3 == 0)
  45. {
  46. peshoHealth += 10;
  47. goshoHealth += 10;
  48. }
  49.  
  50. if (!(goshoHealth <= 0 || peshoHealth <= 0))
  51. {
  52. Console.WriteLine($"{attacker} used {attackName} and reduced {defender} to {defenderHealth} health.");
  53. }
  54. else
  55. {
  56. break;
  57. }
  58. }
  59. Console.WriteLine($"{winner} won in {counter}th round.");
  60. }
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement