def main():
	cerebellum.registerMessageHandler(TestHandler())
	
	staticMap = StaticMap()
	cerebellum.registerMessageHandler(staticMap)
	
	logic = SimpleStackLogic(cerebellum,staticMap)
	cerebellum.registerMessageHandler(logic)

	if visualize:
		from visualizer import Visualizer
		import simple_stack_visualizer
		vis = Visualizer(cerebellum, staticMap)
		vis.registerDrawer(simple_stack_visualizer.createDrawer(logic))
		vis.start()
		vis.registerDrawer(cerebellum.insurance.draw)
	
	mainLoop()
	
	if visualize:
	    vis.terminate = True
	    vis.join()
#!/usr/bin/python
import psyco
psyco.full()

from misc import *
from controller import connection,cerebellum,visualize,mainLoop,staticMap
##############

cerebellum.registerMessageHandler(TestHandler())

#cerebellum.command = ("moveTo",0,0)

if visualize:
    from visualizer import Visualizer
    vis = Visualizer(cerebellum, staticMap)
    vis.start()

mainLoop()

if visualize:
    vis.terminate = True
    vis.join()