Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class GraWzycia {
- public static class Board {
- private int x;
- private int y;
- private Cell[][] plansza;
- public Board(int x, int y) {
- plansza = new Cell[x][y];
- }
- public void wstawKomórke(Cell cell){}
- public Board nowaEwolucja(){
- return this;
- }
- public void rysujPlansze(){}
- }
- public static class Cell{
- private boolean zywa;
- private int x;
- private int y;
- public Cell(int x, int y){
- this.x = x;
- this.y = y;
- this.zywa = true;
- }
- public void flipKomórka(){};
- public boolean czyZywa(){
- return zywa;
- }
- public int liczbaSasiadow(Board board){
- return 1;
- }
- }
- public static void main(String[] args) {
- Board plansza = new Board(10,10);
- ///dodaje sobie komórki do mojej planszy i za kazdym razem sprawdzam ewolucje
- for(int i = 0; i <= 5; i++){
- for(int j = 9; j >=4; j--){
- Cell komorka = new Cell(i,j);
- plansza.wstawKomórke(komorka);
- }
- }
- ////dodam sobie teraz kolejna
- Cell komorka = new Cell(1,1);
- plansza.wstawKomórke(komorka);
- //rysuje plansze
- plansza.rysujPlansze();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment