Stop using recursion in random_grid(), fix bug

Avoids hitting against Python's recursion limit. Fixed a bug in symmetry
where the wrong index was being appended to assigned_squares.