示例#1
0
    def load(self, filename):
        data = Data.load(filename)

        random.setstate(data['random'])
        self.tiles = data['tiles']
        self.initindexes()
        self.popcache = {}
示例#2
0
 def update(self):
   self.sim.update()
   self._ticks[self._stage] += 1
   if self._stage == 0 and self.sim.haslife:
     if self._peopleticks == 0:
       data = self.sim.savedata()
       self._stage += 1
       self._ticks += [0]
       self.sim.loaddata(Data.loaddata(data))
     else:
       self._peopleticks -= 1
示例#3
0
 def load(self):
     filename = QFileDialog.getOpenFileName(self._view,
                                            'Load simulation state',
                                            '',
                                            '*{0}'.format(Data.EXTENSION))[0]
     if len(filename) > 0:
         data = Data.load(filename)
         self.create(data['gridsize'])
         self._model.loaddata(data)
         self._view.content.update()
         self.tick()
示例#4
0
    def load(self, filename):
        data = Data.load(filename)

        random.setstate(data['random'])
        self._dp = data['dp']
        self._build = data['build']
        self._splitnum = data['splitnum']
        self.tiles = data['tiles']
        self._shapes = data['shapes']

        self.initindexes()
        self.dirty = True
示例#5
0
 def load(self, filename):
     data = Data.load(filename)
     self.tiles = data['tiles']
     self.erode()
示例#6
0
 def save(self, filename):
     Data.save(filename, self.savedata())
示例#7
0
 def savedata(self):
     return Data.savedata(random.getstate(), self._grid.size, 0, self.spin, self.cells, self.tilt, None, None, None, self.tiles, self.shapes, self._glaciationt, self.populated, self.agricultural, True, True, False, [], {}, {}, [], {}, {}, [], [])
示例#8
0
 def load(self, filename):
     loadt = self._timing.routine('loading state')
     loadt.start('reading file')
     self.loaddata(Data.load(filename), loadt)
     loadt.done()
示例#9
0
 def savedata(self):
     return Data.savedata(random.getstate(), self._grid.size, 0, self.spin, self.cells, self.tilt, None, None, None, self.tiles, self.shapes, self._glaciationt, self.populated, self.agricultural, True, True, self._inited, self._species, self._capacity, self._population, self.statecolors, self.boundaries, self._tilespecies, self._languages, self._statespecies)
示例#10
0
 def savedata(self):
     return Data.savedata(random.getstate(), self._grid.size, 0, self.spin, self.cells, self.tilt, self._dp, self._build, self._splitnum, self.tiles, self._shapes, 0, {}, set(), self._atmosphereticks, self._lifeticks, False, [], {}, {}, [], {}, {}, [], [])
示例#11
0
 def load(self, filename):
     self.loaddata(Data.load(filename))
示例#12
0
 def load(self, filename):
     data = Data.load(filename)
     self.tiles = data['tiles']
     self.classify()
示例#13
0
 def save(self, filename):
   data = self.sim.savedata()
   data['stage'] = self._stage
   data['peoplet'] = self._peopleticks
   Data.save(filename, data)
示例#14
0
 def save(self, filename):
     Data.save(filename, random.getstate(), self._dp, self._build, self._splitnum, self.tiles, self._shapes)