This commit is contained in:
2019-03-22 10:56:49 +01:00
parent 7f926fd15e
commit 5fb61b9956
9 changed files with 432 additions and 25 deletions
+2
View File
@@ -1 +1,3 @@
*.pyc
ai_manager
ai_manager_old
-4
View File
@@ -1,4 +0,0 @@
from os.path import dirname, basename, isfile
import glob
modules = glob.glob(dirname(__file__)+"/*/ai.py")
__all__ = ['.'.join(f.split('.')[:-1]) for f in modules if isfile(f)]
-11
View File
@@ -1,11 +0,0 @@
"""An AI to try things"""
from tron.player import Player, Direction
class Ai(Player):
"""" A basic AI"""
def __init__(self):
super(Ai, self).__init__()
def action(self, game):
return Direction.RIGHT
-8
View File
@@ -1,8 +0,0 @@
from tron.player import Player, Direction
class Ai(Player):
def __init__(self):
super(Ai, self).__init__()
def action(self, game):
return Direction.LEFT
+3
View File
@@ -70,6 +70,7 @@ def run_battle(ai1, ai2):
def main():
print('Welcome to pytron run!')
dictionnary = {"ais": list(map(lambda x: x.name, ais)), "battles": {}}
for (id1, ai1) in enumerate(ais):
@@ -84,6 +85,8 @@ def main():
with open("assets/data.json", "w") as f:
f.write(json.dumps(dictionnary))
print('Pytron run has finished')
if __name__ == '__main__':
main()