3,114 karma · joined June 12, 2012
That is how every real estate / rental,contract works in the real world.
If I had a million dollars, I could buy your love.
x2 for 2 wage earners.
$1/day(!) per person is another $5 each.
Replacing worn out clothes adds a touch.
Water/sewer is ~$5/wk/person for very light use. Energy for light/heat/cooking is similar.
That is bare minimum for survival.
Even still, I myself that groceries I eat are super cheap compare to food I throw away and restaurant meals. (And I avoid packaged meals and name brand cereal, which are near restaurant priced)
Every now and then I remember that the vast majority of people don't or can't think about food costs, and shudder. Paying $2 for a bottle of water with a scoop of sugar poured in. $5 for a box of Kellogs instead of $3 for generic. $4 for the frozen brocolli with fake cheese sprinkled top instead of $2 for plain. Etc
And can you code an AABB tree on a whiteboard? :-)
One could try placing the new window at (100x, 200y) for integer x,y, and check for intersection each time with all the existing windows. 3600 overlap tests in the worst case, but you get huge benefits in practice by hinting the location of the last new window.
Optimize a bit by sorting lists of windows by x and y, so you can binary search for the few candidates to overlap test, and you are down to about 1000 window checks. You miss some cases if windows are very maliciously aligned off grid, but you can mitigate that by using a slightly finer grid.
Or test the 8 neighbors (edges and corners) of each existing window (if any), as it is nearly impossible for available space to be not one of those positions.
(You can compute the next window position after the previous window creation or move, so there is no latency when rendering a new window.)
Remember that simcity is a socialist fantasy world: all development is directly purchased by central government. In the real world, zoning doesn't cost money, and stadiums are sometimes owner financed.