Working
This commit is contained in:
@@ -1 +1,3 @@
|
||||
*.pyc
|
||||
ai_manager
|
||||
ai_manager_old
|
||||
|
||||
@@ -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)]
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user