Skip to content
Snippets Groups Projects
Select Git revision
  • b37c71b1351d502639ba20f973f3e98eb169665b
  • main default protected
  • correction_video
  • going_further
  • ImprovedMouseInteraction
  • final2023
  • template
  • ModifGUI
8 results

Lens.java

Blame
  • Forked from YAGOUBI Rim / Game of life Template
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    GameOfLifeAutomaton.java 593 B
    package model.automata;
    
    import model.CellularAutomaton;
    
    import java.util.Random;
    
    public class GameOfLifeAutomaton extends AbstractAutomaton<GameOfLifeState> {
    
        protected GameOfLifeAutomaton(int numberOfColumns, int numberOfRows) {
            super(numberOfColumns, numberOfRows);
        }
    
        @Override
        public GameOfLifeState defaultState() {
            return GameOfLifeState.DEAD;
        }
    
        @Override
        public GameOfLifeState randomState(Random generator) {
            return generator.nextBoolean()?
                     GameOfLifeState.ALIVE:
                     GameOfLifeState.DEAD;
        }
    }