import logging
from time import sleep

from pyglet import app
from pyglet.window import Window
from pyglet.clock import schedule_interval
from pyglet.gl import glClearColor

from render import MapView
from mutations import Map
from mutations import Body
from mutations import EnergyBank


logging.basicConfig(level=logging.INFO)


def test():
	map_ = Map(1000, 1000)
	for i in range(2):
		map_.add(EnergyBank(map_))
	for i in range(5):
		map_.add(Body(map_))

	for i in range(1000):
		map_.tick()


def test_view():
	map_ = Map(1000, 1000)
	for i in range(3):
		map_.add(EnergyBank(map_))
	for i in range(50):
		map_.add(Body(map_))

	def update(dt):
		map_.tick()

	window = Window(map_.width, map_.height)
	map_view = MapView(map_)
	schedule_interval(update, 0.1)

	@window.event
	def on_draw():
		glClearColor(.5, .6, .6, 1)
		window.clear()
		map_view.draw()


	app.run()


if __name__ == '__main__':
	test_view()

@@ -17,20 +17,22 @@
 rom 
-time
+random
  import 
 slee
@@ -31,13 +31,25 @@
 ort 
+getrandbits, 
 s
-l
 ee
-p
+d
 %0A%0Afr
@@ -519,24 +519,35 @@
 est_view():%0A
+%09# seed(5)%0A
 %09map_ = Map(
@@ -542,32 +542,30 @@
 %09map_ = Map(
-10
+5
 00, 
-10
+5
 00)%0A%09for i i
@@ -576,9 +576,9 @@
 nge(
-3
+1
 ):%0A%09
@@ -621,17 +621,17 @@
 n range(
-5
+1
 0):%0A%09%09ma
@@ -642,24 +642,41 @@
 dd(Body(map_
+, getrandbits(32)
 ))%0A%0A%09def upd

update to seed DNA