package kata.gameoflife.a20170806; /** * Game of Life Kata. * Copyright (c) 2017, Peter Kofler, licensed under BSD License. */ public class ClassifyReproduction implements Classify { private final int numberOfAliveNeigbours; public static ClassifyReproduction havingNeighbours(int count) { return new ClassifyReproduction(count); } private ClassifyReproduction(int numberOfAliveNeigbours) { this.numberOfAliveNeigbours = numberOfAliveNeigbours; } @Override public boolean asOptimal() { return numberOfAliveNeigbours == 3; } // DeadHavingNeighbours does not sound like a verb. // The Dead in front is indicating state. Sigh. // What it really does is: Checking for reproduction. }