So I've got a string of bytes which represents cubes in three dimensions. The coordinates are ordered like this:
[x0y0z0, x0y1z0, x0y2z0, ..., x0y127z0, x0y0z1, x0y1z1, ..., x15y127z15]
I'd like to split this into 128 lists, one for each Y coordinate. This code already does that, but I think inefficiently. Is there some way to split this list based on mod(128) of the index?
From the original code:
col.extend(izip_longest(*[iter(file["Level"]["Blocks"].value)]*128))
That takes quite a while, and I think it should be possible to make something better performing by avoiding the *128
part of this. But zipping is definitely not my strong side, and neither is binary file handling.