Move code to new getCellIndex() method and add validation
Optimise: replace generateCellStatePixelColour() with new constants