nboughton/swnt

New Sector hangs on sector size 38x38 or greater

nboughton opened this issue · 2 comments

Reproduce:

swnt new sector -l -e 38 -w 38

Sector creation succeeds at either version 37x38 but hangs on anything greater. The number of cells created in 37x37 is 1406, whereas the next increment produce 1444.

The problem is name.System. The current list has 501 items however the number of cells occupied on a 38x38 map is

cells := s.Rows * s.Cols
stars := (rand.Intn(cells/4) / 2) + (cells / 4)

This is will be more than 501 and as the names picked must be unique a loop occurs when it can no longer find unused names.

Solution:
Write a name generator so that no such limit occurs.

Commit 98ce744 implements a primitive name generator that can improved later.