Monday, 2 December 2019

Imaginary Bricks! (In Search Of Studless Models - Part 3)

I'd returned to just using 1x1 tiles to try to isolate stud availability.  I had been using my brickalo code to generate the models that I would then try to add tiles to, however my brickalo code was an unmanagable mess (of my own making) so I decided to rewrite my code to better support the isolation of studs within a model.

Initially my new code focused purely on the placement of tiles on "imaginary" studs of imaginary bricks!  I coded a mechanism of creating a numpy matrix that could represent the bricks and plates added to a model (without actually bothering to add the brick to the LDraw model).  However it quickly became apparent that having made a functional matrix that could track imaginary bricks and plates - I may as well use it to add real bricks to the LDraw model.  It's worth noting that this approach was very different to the code I'd used for brickalo.  

With brickalo, the code selected a random LDraw part (from a list of parts) and then drilled down into the part to work out what the dimensions (1x2,2x2,2x4 plate or brick etc) of the LDraw part were which then allows the code to calculated the part matrix which is then added to the larger build matrix.  With my new code, that I was using for tile placement, the part matrix is randomly generated, and the corresponding part selected according to the dimensions and size of the randomly generated part matrix.   As it turns out, this new approach would allow for the selection of  many more variations of similar parts.