LifeController

Download Raw Clone


  1. package life;
  2. public class LifeController {
  3. public static void main(String[] args) {
  4. LifeBoard board = new LifeBoard(9, 9);
  5. LifeView window = new LifeView(board);
  6. Life game = new Life(board);
  7. window.drawBoard();
  8. while (true) {
  9. int a = window.getCommand();
  10. if (a == 1) {
  11. game.flip(window.getRow(), window.getCol());
  12. window.update();
  13. } else if (a == 2) {
  14. game.newGeneration();
  15. window.update();
  16. } else if (a == 3) {
  17. System.exit(0);
  18. }
  19. }
  20. }
  21. }

Raw paste data: