You're rushing things! :)
My first approach was:
- Randomly position N dots on the tray.
- Grow them in parallel, in steps, until one of them touches something -- an edge or another cookie.
- Move them half way into any adjacent space. Outer ones first towards the nearest edge(s). Inner ones toward the 'new edge' formed by a box 'drawn' inside the outer ones.
- goto step 2 if any of them are not touching in (at least) 4 places.
- end.
But, a) it is a pain to program; b) it runs like a dog.
My thoughts so far are summed up in this image.
- A diamond pattern is never the right answer.
Unless you want to make exactly 5 cookies.
Despite that TV chef's seem to use it exclusively!
Of course, it could be that their practiced eyes are actually doing a honeycomb arrangement -- whether they know it or not -- and it is just my observation that it looks more like a diamond pattern.
- Despite the literature, a grid arrangement is the most efficient for any square, or tending to square tray.
- With honeycomb arrangements, it is important that you go for long/short/long(...) when odd numbers of long-edge aligned rows are required.
- The choice between grid and honeycomb depends upon the ratio of the sides.
- There are at least 6 different ratio break points.
- A table-driven lookup of the ratios to arrangements is probably the best/simplest selection mechanism.
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.