Creating a grid of adjacent squares of the same side length in netlogo -


grid of patches in adjacent squares of equal side lengthis there code implementing grid of squares (of patches) in netlogo? each square must directly adjacent , aligned neighboring squares , squares must have same length of side (like graphing paper). functionality control or vary side lengths of squares ideal ...

below, believe sample code generating grid random, undefined edges:

to generate-habitats [ habitat-spots ]   let habitat-id 0   ask n-of habitat-spots patches [     set pcolor item habitat-id base-colors     set habitat-id habitat-id + 1   ]   while [ any? patches [ pcolor = black ] ] [     ask patches [ pcolor != black ] [       ask neighbors [ pcolor = black ] [ set pcolor [ pcolor ] of myself ]     ]   ] end 

but edges straight , adjacent each other in aligned square configurations opposed random , jagged.


Comments