Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class ZaTriene {
- public static void main(String[] args) throws java.lang.Exception {
- Scanner scanner = new Scanner(System.in);
- int peshoDamage = Integer.parseInt(scanner.nextLine());
- int goshoDamage = Integer.parseInt(scanner.nextLine());
- String pesho = "Pesho";
- String gosho = "Gosho";
- String peshoAttack = "Roundhouse kick";
- String goshoAttack = "Thunderous fist";
- int peshoHealth = 100;
- int goshoHealth = 100;
- int restoration = 10;
- int loopCounter = 1;
- for (int i = 1; i <= loopCounter; i++) {
- if (peshoHealth <= 0){
- loopCounter--;
- System.out.printf("%s won in %dth round.", gosho, loopCounter);
- return;
- }else if (goshoHealth <= 0){
- loopCounter--;
- System.out.printf("%s won in %dth round.", pesho, loopCounter);
- return;
- }if (i % 2 != 0){
- goshoHealth -= peshoDamage;
- if (goshoHealth > 0){
- System.out.printf("%s used %s and reduced %s to %d health.", pesho, peshoAttack, gosho, goshoHealth);
- System.out.println();
- }
- }else{
- peshoHealth -= goshoDamage;
- if (peshoHealth > 0){
- System.out.printf("%s used %s and reduced %s to %d health.", gosho, goshoAttack, pesho, peshoHealth);
- System.out.println();
- }
- }if (i % 3 == 0){
- goshoHealth += restoration;
- peshoHealth += restoration;
- }
- loopCounter++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement