original_docstring: 
          If the Pop needs a Good to perform production, buy it
          If the Pop has surplus Resources, sell them
          
docstring: If the Pop needs a Good to perform production, buy it
  If the Pop has surplus Resources, sell them
docstring_tokens: If the Pop needs a Good to perform production buy it If the Pop has surplus Resources sell them
code: def generate_orders(self, good):
          """
          If the Pop needs a Good to perform production, buy it
          If the Pop has surplus Resources, sell them
          """
          surplus = self.inventory.surplus(good)
          if surplus >= 1: # sell inventory
              # the original only old one item here
              sell_amount = surplus
              order = self.create_sell_order(good, surplus)
              if order:
                  # print('{} sells {} {}'.format(self.pop_job.title, sell_amount, good.name))
                  self.market.sell(order)
          else: # buy more
              shortage = self.inventory.shortage(good)
              free_space = self.inventory.empty_space
  
              if shortage > 0:
                  if shortage <= free_space:
                      # enough space for ideal order
                      limit = shortage
                  else:
                      # not enough space for ideal order
                      limit = math.floor(free_space / shortage)
  
                  if limit > 0:
                      order = self.create_buy_order(good, limit)
                      if order:
                          # print('{} buys {} {}'.format(self.pop_job.title, limit, good.name))
                          self.market.buy(order)
              # else:
              #     print("{} has no shortage of {} (has shortage: {})".format(self.pop_job.title, good.title, shortage))
code_tokens: def generate_orders ( self , good ) : surplus = self . inventory . surplus ( good ) if surplus >= 1 : sell_amount = surplus order = self . create_sell_order ( good , surplus ) if order : self . market . sell ( order ) else : shortage = self . inventory . shortage ( good ) free_space = self . inventory . empty_space if shortage > 0 : if shortage <= free_space : limit = shortage else : limit = math . floor ( free_space / shortage ) if limit > 0 : order = self . create_buy_order ( good , limit ) if order : self . market . buy ( order )
short_docstring: If the Pop needs a Good to perform production, buy it
  If the Pop has surplus Resources, sell them
short_docstring_tokens: If the Pop needs a Good to perform production buy it If the Pop has surplus Resources sell them
comment: """
          If the Pop needs a Good to perform production, buy it
          If the Pop has surplus Resources, sell them
          """$SEP$# sell inventory$SEP$# the original only old one item here$SEP$# print('{} sells {} {}'.format(self.pop_job.title, sell_amount, good.name))$SEP$# buy more$SEP$# enough space for ideal order$SEP$# not enough space for ideal order$SEP$# print('{} buys {} {}'.format(self.pop_job.title, limit, good.name))$SEP$# else:$SEP$#     print("{} has no shortage of {} (has shortage: {})".format(self.pop_job.title, good.title, shortage))