Advertisement
Talar97

Lab PD (Wojna) - Main

Dec 2nd, 2017
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.06 KB | None | 0 0
  1. package com.Talar;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner inp = new Scanner(System.in);
  9.         Scanner inp2 = new Scanner(System.in);
  10.  
  11.         System.out.println("Gra w wojne");
  12.         System.out.print("Wprowadź swoją nazwę: "); String nazwaGracza = inp.nextLine();
  13.         Gracz ja = new Gracz(nazwaGracza);
  14.         Gracz komputer = new Gracz("NPC");
  15.  
  16.         while(true){
  17.             System.out.println("\n =============================================");
  18.             System.out.println("| 1: WOJNA!\t\t\t\t\t\t\t\t\t |");
  19.             System.out.println("| 2: Wyświetl moją talię\t\t\t\t\t |");
  20.             System.out.println("| 3: Wyświetl talie przeciwnika\t\t\t\t |");
  21.             System.out.println("| 4: Wyświetl wszystkie karty z talii\t\t |");
  22.             System.out.println("| 5: Wylosuj ponownie moją talię\t\t\t |");
  23.             System.out.println("| 6: Wylosuj ponownie talię przeciwnika\t\t |");
  24.             System.out.println("| 7: Wylosuj ponownie talię dla obu graczy\t |");
  25.             System.out.println(" =============================================");
  26.             System.out.print("\nWybierz opcje: "); int wybor = inp2.nextInt();
  27.             switch(wybor){
  28.                 case 1:
  29.                     ja.wojna(komputer);
  30.                     break;
  31.                 case 2:
  32.                     ja.wyswietlTalieGracza();
  33.                     break;
  34.                 case 3:
  35.                     komputer.wyswietlTalieGracza();
  36.                     break;
  37.                 case 4:
  38.                     ja.wszystkieKarty.wyswietlTalie();
  39.                     break;
  40.                 case 5:
  41.                     ja.losujKarty();
  42.                     break;
  43.                 case 6:
  44.                     komputer.losujKarty();
  45.                     break;
  46.                 case 7:
  47.                     ja.losujKarty();
  48.                     komputer.losujKarty();
  49.                     break;
  50.                 default:
  51.                     break;
  52.             }
  53.         }
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement