static IFastImage Visualize(CellBoard board, bool showOnlyLargestArea, int scale = 1) { if (showOnlyLargestArea) { var(area, size) = ConnectedAreaAnalyzer .FindForegroundAreas(board.Dimensions, p => board[p] == CellType.Dead) .MaxBy(component => component.Area) ?.TrimExcess(1) ?? throw new InvalidOperationException("This can't happen"); return(GenericVisualizer.RenderBinary(size, isTrue: area.Contains, trueColor: SKColors.White, falseColor: SKColors.Black, scale: scale)); } else { return(GenericVisualizer.RenderBinary(board.Dimensions, isTrue: p => board[p] == CellType.Dead, trueColor: SKColors.White, falseColor: SKColors.Black, scale: scale)); } }
static IFastImage Visualize(CellBoard board, int scale = 1) => GenericVisualizer.RenderBinary(board.Dimensions, isTrue: p => board[p] == CellType.Dead, trueColor: SKColors.White, falseColor: SKColors.Black, scale: scale);