class Abstracta::TerritoryDeveloper

Public Instance Methods

collection() click to toggle source
# File lib/abstracta/developer.rb, line 35
def collection; territory.occupants end
develop(targets: adjacent) click to toggle source
# File lib/abstracta/developer.rb, line 37
def develop(targets: adjacent)
  grow(targets) if growth_indicated?
  cull!
end
grow(targets, n=growth) click to toggle source
# File lib/abstracta/developer.rb, line 48
def grow(targets, n=growth)
  targets.sample(n).map(&method(:occupy!))
end
growth_indicated?() click to toggle source
# File lib/abstracta/developer.rb, line 42
def growth_indicated?
  in_cycle = age % territory.period == 0
  under_bound = size <= territory.limit
  in_cycle && under_bound
end
territory() click to toggle source
# File lib/abstracta/developer.rb, line 34
def territory; @entity end