GameOfLife implements RainbowInputController.RainbowInteractionListener, OnCellUpdatedCallback2D, RainbowDrawer.PointDetectedListener { @Override public void onPointDetected(float px, float py, float x, float y) { int cellX = (int) (x / CELL_SIZE); int cellY = (int) (y / CELL_SIZE); if (cellX >= 0 && cellX < gameOfLifeAutomata.getWidth() && cellY >= 0 && cellY < gameOfLifeAutomata.getHeight()) { gameOfLifeAutomata.getCells()[cellX][cellY] = ALIVE; } } @VisibleForTesting  GameOfLife(AutomataDiscrete2D gameOfLifeAutomata, GameOfLifeDrawer gameOfLifeDrawer, RainbowInputController rainbowInputController); static GameOfLife newInstance(RainbowDrawer rainbowDrawer,
                                         RainbowInputController rainbowInputController); void doStep(); @Override void onCellDetected(int x, int y, int state); @Override void onSketchTouched(MotionEvent motionEvent); @Override void onSketchReleased(MotionEvent motionEvent); @Override void onFingerDragged(MotionEvent motionEvent); @Override void onPointDetected(float px, float py, float x, float y); @Override void onMotionEvent(MotionEvent motionEvent); void startEdition(); void endEdition(); void clear(); void restoreLastWorld(); void loadWorldFrom(RainbowImage image);  }
@Test public void testThatWhenOnPointDetectedIsCalledThenTheDetectedCellIsAlive() { givenThatAutomataHasAllCellsDead(); assertThat(gameOfLifeAutomata.getCells()[ANY_CELL_X][ANY_CELL_Y]).isEqualTo(DEAD); gameOfLife.onPointDetected(ANY_CELL_X, ANY_CELL_Y, ANY_CELL_X, ANY_CELL_Y); assertThat(gameOfLifeAutomata.getCells()[ANY_CELL_X][ANY_CELL_Y]).isEqualTo(ALIVE); }