private void GenerateBlock() { _blocks = new Grid<bool>(_gridSize); _blocks.SetEach( ( block, point ) => !_paths[ point ] && ( _trees[ point ] != '.' || _walls[ point ] || _rivers[ point ] ) ); var blocks = new Grid<byte>(_gridSize); blocks.SetEach( (value, point) => (byte)(_blocks[point] ? 0 : 255) ); File.WriteAllText( "blocks.pgm", blocks.ToPgm() ); }