示例#1
0
def exempleIA(IA,team1, team2, it, ip):
    match = SoccerMatch(team1,team2)
    #on reinitisalise fichier
    a = open("Match","w")
    a.close()
    match.play()
    match.save("Match")
    Monte_Carlo("Match","action",it,ip,IA.dico)
    a = open("action","w")
    a.close()
示例#2
0
def affiche_joue_IA(IA,teamIA, teamAdv,it, ip):
    #si le fichier d'action n'est pas vide on apprend
    if os.path.getsize("action") != 0:
        Monte_Carlo("Match","action",it,ip,IA.dico)
        #on supprime les anciennes actions
        a = open("action","w")
        a.close()
    match = SoccerMatch(teamIA, teamAdv)
    a = open("Match","w")
    a.close()
    match.play()
    soccersimulator.show(match)
    match.save("Match")
示例#3
0
def joue_IA(IA,teamIA, teamAdv,it, ip):
    #si le fichier d'action n'est pas vide on apprend
    if os.path.getsize("action") != 0:
        Monte_Carlo("Match","action",it,ip,IA.dico)
        #on supprime les anciennes actions
        a = open("action","w")
        a.close()
    match = SoccerMatch(teamIA, teamAdv)
    #on reinitisalise fichier
    a = open("Match","w")
    a.close()
    match.play()
    match.save("Match")
示例#4
0
t1= SoccerTeam("Qq",[Player("QPlayer",QStrat)])
t2 = SoccerTeam("Adv",[Player("j1",J_1vs1_Strat)])

mat = SoccerMatch(t1,t2)
#soccersimulator.show(mat)
print
cpt = 0
while cpt<=0:
    print "CPT", cpt
    print "      "

    print "BEGIN match.play()"
    #mat.play()
    soccersimulator.show(mat)
    SoccerMatch.save(mat,"matchQlearn4")

    print "      "
    print "### FIn match.play Now MAJ ##"


    # FAIRE LA MISE A JOUR APRES AVOIR JOUE MATCH 
    maj(mat,1,0,NOM_FICHIER_DIC)
    print " ## FIN MAJJJ##"

    print "CA CETAIT POUR MATCH CPT", cpt

    cpt+=1

print "FIN FINALE"
示例#5
0
# nom et strategie du premier joueur
print team1.player_name(0), team1.strategy(0)

joueur1 = Player("Joueur 2", BaseStrategy("fonceetshoot"))
joueur2 = Player("Goal 2", BaseStrategy("defenseduGoal"))
print joueur1.name, joueur2.strategy, joueur2.name, joueur2.strategy
team2 = SoccerTeam("Equipe 2", [Joueur 2, Goal 2])
# nombre de joueurs de l equipe
print team1.nb_players
# renvoie la liste des noms, la liste des strategies
print team1.players_name, team1.strategies
# nom et strategie du premier joueur
print team1.player_name(0), team1.strategy(0)

#Creer un match entre 2 equipes et de duree 2000 pas
match = SoccerMatch(team1, team2, 2000)
#Jouer le match (sans le visualiser)
match.play()
#Jouer le match en le visualisant
show(match)
#Attention !! une fois le match joue, la fonction play() permet de faire jouer le replay
# mais pas de relancer le match !!!
# Pour regarder le replay d un match
show(match)
# Pour sauvegarder un match
match.save("fichier")
# Pour charger un match
match = SoccerMatch.load("fichier")
# Pour reinitialiser un match
match.reset()
示例#6
0
def init_fichier(team1 ,team2):
    if os.path.getsize("Match") == 0:
        match = SoccerMatch(team1,team2)
        match.save("Match")