- start_time = time.time()
- self._mould.tick(gamestate, self._space)
- end_time = time.time()
- if DEBUG:
- print "Night Tick", end_time - start_time
+ if self._total_ticks < NIGHT_LENGTH:
+ self._mould.tick(gamestate, self._space, self._lights)
+ self._lights.tick()
+ print "Power usage: ", self._lights.total_power_usage()
+ else:
+ self._to_day()
+ if not self._mould.alive():
+ self._to_day()
+
+ def exit(self, gamestate):
+ turnip_data = [turnip.serialize() for turnip in self._turnips]
+ gamestate.turnips = turnip_data