Advertisement
Ivakis

Neighbour Wars

Nov 22nd, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int peshosDamage = Integer.parseInt(scanner.nextLine());
  8. int goshosDamage = Integer.parseInt(scanner.nextLine());
  9.  
  10. int peshosHealth = 100;
  11. int goshosHealth = 100;
  12.  
  13. int round = 0;
  14.  
  15. while (peshosHealth > 0 && goshosHealth > 0) {
  16. round++;
  17.  
  18. if (round % 2 != 0) {
  19. goshosHealth -= peshosDamage;
  20.  
  21. if (goshosHealth < 1) {
  22. System.out.printf("Pesho won in %dth round.", round);
  23. break;
  24. }
  25. System.out.printf("Pesho used Roundhouse kick and reduced Gosho to %d health.%n", goshosHealth);
  26. } else {
  27. peshosHealth -= goshosDamage;
  28.  
  29. if (peshosHealth < 1) {
  30. System.out.printf("Gosho won in %dth round.", round);
  31. break;
  32. }
  33. System.out.printf("Gosho used Thunderous fist and reduced Pesho to %d health.%n", peshosHealth);
  34. }
  35. if (round % 3 == 0) {
  36. peshosHealth += 10;
  37. goshosHealth += 10;
  38. }
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement