Minotaur’s labyrinth
Minotaur’s labytinth in Python
Requieres Python 2.6 with TK.
For windows you can just grab the default python installation packages and do a full install. Then doubleclick the game py file.
To write bots to play in the game:
class AI0(AI):
def __init__(self):
self.name = "Bot Sample code"
self.lastgoal = 10000
self.option = 0
self.options = [1,3,2,4]
self.optionsrev = [2,4,1,3]
def move(self,options,sensors):
if sensors[1] < self.lastgoal:
while 1:
m = self.options[self.option % 4]
if m in options: break
self.option = self.option + 1
else:
m = self.optionsrev[self.option % 4]
self.option = self.option + 1
self.lastgoal = sensors[1]
return m
To create a new game:
g1 = Grid(260,Point(20,20),8)
p.drawtiles(g1)
x = GameController(g1,1,0,0)
while 1:
p.canvas.delete("player")
p.canvas.delete("goal")
x.update()
p.canvas.update()
p.canvas.after(10)
I’ll be glad in you sent me your bots!
Download:
class AI8(AI):
def __init__(self):
self.name = “Midas2″
self.lastgoal = 10000
self.option = 0
self.options = [1,3,2,4]
self.optionsrev = [2,4,1,3]
def move(self,options,sensors):
if sensors[1] < self.lastgoal:
while 1:
m = self.options[self.option % 4]
if m in options: break
self.option = self.option + 1
else:
m = self.optionsrev[self.option % 4]
self.option = self.option + 1
self.lastgoal = sensors[1]
return m
def __init__(self):
self.name = “Midas2″
self.lastgoal = 10000
self.option = 0
self.options = [1,3,2,4]
self.optionsrev = [2,4,1,3]
def move(self,options,sensors):
if sensors[1] < self.lastgoal:
while 1:
m = self.options[self.option % 4]
if m in options: break
self.option = self.option + 1
else:
m = self.optionsrev[self.option % 4]
self.option = self.option + 1
self.lastgoal = sensors[1]
return m



