+ water = 0
+ positions_to_wet = []
+ for i in range(world_db["MAP_LENGTH"] ** 2):
+ if world_db["MAP"][i] == ord("0") \
+ and world_db["wetmap"][i] < ord("5"):
+ positions_to_wet += [i]
+ i_positions_to_wet = len(positions_to_wet)
+ for pos in range(world_db["MAP_LENGTH"] ** 2):
+ if 0 == rand.next() % 5 \
+ and ((world_db["wetmap"][pos] > ord("0")
+ and not world_db["MAP"][pos] == ord("0"))
+ or world_db["wetmap"][pos] > ord("1")):
+ world_db["wetmap"][pos] -= 1
+ water += 1
+ i_positions_to_wet -= 1
+ if i_positions_to_wet == 0:
+ break
+ if water > 0:
+ while water > 0:
+ select = rand.next() % len(positions_to_wet)
+ pos = positions_to_wet[select]
+ world_db["wetmap"][pos] += 1
+ positions_to_wet.remove(pos)
+ water -= 1