- def make_new_world(self, yx, seed):
-
- def add_thing_at_random(type_):
- while True:
- new_pos = (YX(0,0),
- YX(self.rand.randint(0, yx.y - 1),
- self.rand.randint(0, yx.x - 1)))
- if self.maps[new_pos[0]][new_pos[1]] != '.':
- continue
- if len(self.things_at_pos(new_pos)) > 0:
- continue
- return self.add_thing_at(type_, new_pos)
-
+ def add_thing_at_random(self, big_yx, type_):
+ while True:
+ new_pos = (big_yx,
+ YX(self.rand.randint(0, self.map_size.y - 1),
+ self.rand.randint(0, self.map_size.x - 1)))
+ if self.maps[new_pos[0]][new_pos[1]] != '.':
+ continue
+ if len(self.things_at_pos(new_pos)) > 0:
+ continue
+ return self.add_thing_at(type_, new_pos)
+
+ def make_map_chunk(self, big_yx):
+ map_ = self.get_map(big_yx)
+ for pos in map_:
+ map_[pos] = self.rand.choice(('.', '.', '.', '~', 'x'))
+ self.add_thing_at_random(big_yx, 'monster')
+ self.add_thing_at_random(big_yx, 'monster')
+ self.add_thing_at_random(big_yx, 'monster')
+ self.add_thing_at_random(big_yx, 'monster')
+ self.add_thing_at_random(big_yx, 'monster')
+ self.add_thing_at_random(big_yx, 'monster')
+ self.add_thing_at_random(big_yx, 'monster')
+ self.add_thing_at_random(big_yx, 'monster')
+ self.add_thing_at_random(big_yx, 'food')
+ self.add_thing_at_random(big_yx, 'food')
+ self.add_thing_at_random(big_yx, 'food')
+ self.add_thing_at_random(big_yx, 'food')
+
+ def make_new_world(self, size, seed):