Advertisement
AskTomorrow

Untitled

Feb 9th, 2020
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.26 KB | None | 0 0
  1. package xyz.antonkazakov;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.List;
  5.  
  6. //N игроков
  7. //K костей
  8. //M побед
  9.  
  10. public class Game extends Thread {
  11.  
  12.     int playersCount;
  13.     int winsCount;
  14.  
  15.     public int getPlayersCount() {
  16.         return playersCount;
  17.     }
  18.  
  19.     public void setPlayersCount(int playersCount) {
  20.         this.playersCount = playersCount;
  21.     }
  22.  
  23.     public int getWinsCount() {
  24.         return winsCount;
  25.     }
  26.  
  27.     public void setWinsCount(int winsCount) {
  28.         this.winsCount = winsCount;
  29.     }
  30.  
  31.     Game(int m, int n, int k) {
  32.         this.setPlayersCount(n);
  33.         this.setWinsCount(m);
  34.         for (int i = 0; i < getPlayersCount(); i++) {
  35.             players.add(new Player(k, i + 1));
  36.         }
  37.     }
  38.  
  39.     ArrayList<Player> players = new ArrayList<>();
  40.  
  41.     public boolean isCommentatorSpeaking = false;
  42.  
  43.     private Commentator commentator;
  44.  
  45.     public Commentator getCommentator() {
  46.         return commentator;
  47.     }
  48.  
  49.     public void setCommentator(Commentator commentator) {
  50.         this.commentator = commentator;
  51.     }
  52.  
  53.     @Override
  54.     public void run() {
  55.         notifyAll();
  56.         for (int i = 0; i < players.size(); i++) {
  57.             players.get(i).run();
  58.         }
  59.     }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement