|
|
"Nekar Xenos" <nek### [at] gmailcom> wrote:
> I still get 3 of the same bricks in a row. Any ideas on how to get it more
> random?
Besides not having the same brick appear twice in a row, you probably don't want
the same brick appearing directly above or below. One possible method (although
not as cool as the previous suggestion) could be to create a two-dimensional
array (or three-dimensional, if you also want to worry about the corners of the
wall). Assign a number to each brick type, and store that number in the
corresponding array location as the bricks are placed in the wall. As you add a
new brick, compare the new brick type to the two bricks below and the one
already placed on the same row. If the new brick matches any of the already
created bricks, select a different type and compare again.
Regards,
Dave Blandston
Post a reply to this message
|
|