GoralWMoro

Untitled

Apr 16th, 2020
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.49 KB | None | 0 0
  1. public class GraWzycia {
  2.  
  3.     public static class Board {
  4.         private int x;
  5.         private int y;
  6.         private Cell[][] plansza;
  7.  
  8.         public Board(int x, int y) {
  9.             plansza = new Cell[x][y];
  10.         }
  11.  
  12.         public void wstawKomórke(Cell cell){}
  13.  
  14.         public Board nowaEwolucja(){
  15.             return this;
  16.         }
  17.  
  18.  
  19.         public void rysujPlansze(){}
  20.  
  21.  
  22.     }
  23.  
  24.  
  25.     public static class Cell{
  26.  
  27.         private boolean zywa;
  28.         private int x;
  29.         private int y;
  30.  
  31.         public Cell(int x, int y){
  32.             this.x = x;
  33.             this.y = y;
  34.             this.zywa = true;
  35.         }
  36.  
  37.         public void flipKomórka(){};
  38.  
  39.  
  40.         public boolean czyZywa(){
  41.             return zywa;
  42.         }
  43.  
  44.         public int liczbaSasiadow(Board board){
  45.             return 1;
  46.         }
  47.  
  48.  
  49.  
  50.  
  51.     }
  52.  
  53.     public static void main(String[] args) {
  54.             Board plansza = new Board(10,10);
  55.             ///dodaje sobie komórki do mojej planszy i za kazdym razem sprawdzam ewolucje
  56.             for(int i = 0; i <= 5; i++){
  57.                 for(int j = 9; j >=4; j--){
  58.                     Cell komorka = new Cell(i,j);
  59.                     plansza.wstawKomórke(komorka);
  60.                 }
  61.             }
  62.            
  63.             ////dodam sobie teraz kolejna
  64.             Cell komorka = new Cell(1,1);
  65.             plansza.wstawKomórke(komorka);
  66.            
  67.             //rysuje plansze
  68.             plansza.rysujPlansze();
  69.  
  70.     }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment