当前位置: 首页>>代码示例>>Python>>正文


Python soccersimulator.KeyboardStrategy类代码示例

本文整理汇总了Python中soccersimulator.KeyboardStrategy的典型用法代码示例。如果您正苦于以下问题:Python KeyboardStrategy类的具体用法?Python KeyboardStrategy怎么用?Python KeyboardStrategy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了KeyboardStrategy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: build_apprentissage

def build_apprentissage(fn,generator):
    ex_raw = KeyboardStrategy.read(fn)
    exemples = []
    labels = []
    for x in ex_raw:
        exemples.append(generator(x[1],x[0][0],x[0][1]))
        labels.append(x[0][2])
    return exemples,labels
开发者ID:jordanupmc,项目名称:soccersimulator,代码行数:8,代码来源:decisiontree.py

示例2: KeyboardStrategy

        aa = self.decideur(SoccerStateDecorator(state,id_team,id_player,self.info))
        return aa



#team1=SoccerTeam("team1",[Player("t1j1",StateLessStrategy(random))])
#team2=SoccerTeam("team2",[Player("t2j1",StateLessStrategy(Smart1v1))])

team1=SoccerTeam("team1",[Player("t1j1",StateLessStrategy(random)),Player("t1j2",StateLessStrategy(Smart1v1))])
team2=SoccerTeam("team1",[Player("t2j1",StateLessStrategy(Smart2v2)),Player("t2j2",StateLessStrategy(Smart2v2))])

#team1=SoccerTeam("team1",[Player("t1j1",StateLessStrategy(fonceur)),Player("t1j2",StateLessStrategy(fonceur)),Player("t1j3",StateLessStrategy(fonceur)),Player("t1j4",StateLessStrategy(fonceur))])
#team2=SoccerTeam("team1",[Player("t1j1",StateLessStrategy(Smart1v1)),Player("t1j2",StateLessStrategy(Smart1v1)),Player("t1j3",StateLessStrategy(Smart1v1)),Player("t1j4",StateLessStrategy(Smart1v1))])


strat = KeyboardStrategy() #ou pour une sauvegarde automatique
#KeyboardStrategy(fn="monfichier.exp")
FS = StateLessStrategy(fonceur)
GK = StateLessStrategy(QuickFollow)

strat.add("d",FS)
strat.add("a",GK)
player1 = Player("j1",strat)

team1=SoccerTeam("team1",[player1])
team2=SoccerTeam("team2",[Player("t2j1",StateLessStrategy(Smart1v1))])
match=SoccerMatch(team1,team2)

show(match)
strat.write("monfichier.exp")
开发者ID:ad50144124,项目名称:mon_projet,代码行数:30,代码来源:project.py

示例3: len

# -*- coding: utf-8 -*-
from soccersimulator import SoccerMatch, show, SoccerTeam, Player, KeyboardStrategy
from strategies import *
import sys


if __name__ == "__main__":
    prefix = "test"
    if len(sys.argv) > 1:
        prefix = sys.argv[1]
    strat_g = KeyboardStrategy()
    strat_g.add("t", MarquerStrategy())
    strat_g.add("y", DribleStrategy())
    strat_g.add("z", PasseStrategy())

    team45 = SoccerTeam(
        "team4", [Player("Al", strat_g), Player("xxx", strat_g), Player("Samounette", strat_g), Player("Sam", strat_g)]
    )
    team46 = SoccerTeam(
        "team4",
        [
            Player("S", Defenseur1Strategy()),
            Player("am", Defenseur2Strategy()),
            Player("l", GoalStrategy()),
            Player("As", DribleStrategy()),
        ],
    )
    match = SoccerMatch(team45, team46, 10000)
    show(match)
    strat_g.write(prefix + ".exp", True)
开发者ID:fifa2016,项目名称:projet_foot,代码行数:30,代码来源:entrainer.py

示例4: len

""" Permet de jouer et d'entrainer une strategie
    * changer les strategies ajoutees
    * utilisation : python entrainer prefix_fichier_exemple
    par defaut ajoute au fichier d'exemples sil existe deja
    (extension : .exp pour le fichier exemple)
"""

from soccersimulator import SoccerMatch, show, SoccerTeam,Player,KeyboardStrategy
from strat import *
import sys

if __name__=="__main__":
	prefix = "tree"
	if len(sys.argv)>1:
		prefix = sys.argv[1]
	strat_key = KeyboardStrategy()
	strat_key.add("a",StrategyF())
	strat_key.add("g",StrategyG())
	
	team_noob = SoccerTeam("lobIA",[Player("lobIA", strat_key)])
	team_bad = SoccerTeam("teamTest",[Player("Fonceur",StrategyP())])
	#match = SoccerMatch(team_noob,team_bad,1000)
	match = SoccerMatch(team_bad,team_noob,1000)
	#show(match)
	strat_key.write(prefix+".exp",True)
开发者ID:nihaakey,项目名称:projet2I013,代码行数:25,代码来源:entrainer.py

示例5: KeyboardStrategy

from soccersimulator import Vector2D, Player, SoccerTournament
from Strategies import *
from StratsSpecialise import*
from Outils import *

#############################################################
###### CREATION ET AFFECTATION DES KEYBOARD STRATEGIES  #####
#############################################################


############################################
## Keyb Strategies a tester sur le Milieu ##
############################################


KBS_Milieu = KeyboardStrategy()
KBS_Milieu.add("d",Def4vs4_Strat)
KBS_Milieu.add("g",Attack4vs4_Strat)



############################################
## Keyb Strategies a tester sur le Gardien #
############################################

#creation d'une petite strategie a utiliser
def degager(me):
	res=me.degager
	res.name="degager"
	return res
开发者ID:3408247,项目名称:MonProj,代码行数:30,代码来源:keyb_strats.py

示例6: len

""" Permet de jouer et d'entrainer une strategie
    * changer les strategies ajoutees
    * utilisation : python entrainer prefix_fichier_exemple
    par defaut ajoute au fichier d'exemples sil existe deja
    (extension : .exp pour le fichier exemple)
"""

from soccersimulator import SoccerMatch, show, SoccerTeam,Player,KeyboardStrategy
from strategies import FonceurStrategy, DefenseStrategy, RandomStrategy
import sys

if __name__=="__main__":
    prefix = "tree"
    if len(sys.argv)>1:
        prefix = sys.argv[1]
    strat_key = KeyboardStrategy()
    strat_key.add("a",RandomStrategy())
    strat_key.add("z",FonceurStrategy())
    strat_key.add("e",DefenseStrategy())
    team_noob = SoccerTeam("keyb",[Player("KBs", strat_key),Player("Defense",DefenseStrategy())])
    team_bad = SoccerTeam("foncteam",[Player("Fonceur",FonceurStrategy()),Player("Defense", DefenseStrategy())])
    match = SoccerMatch(team_noob,team_bad,1000)
    show(match)
    strat_key.write(prefix+".exp",True)
开发者ID:jordanupmc,项目名称:soccersimulator,代码行数:24,代码来源:entrainer.py

示例7: __init__

    def __init__(self,comportement,name):
        BaseStrategy.__init__(self,name)
        self.comportement = comportement
    def compute_strategy(self, state, id_team, id_player):
        s_miroir = state
        if id_team==1 :
            Mystate = PlayerDecorator(s_miroir,id_team , id_player)
            return self.comportement(Mystate)
        else :
            s_miroir = miroir_st(state)
            Mystate = PlayerDecorator(s_miroir,id_team , id_player)
            return miroir_sa(self.comportement(Mystate))
    
    

keytest = KeyboardStrategy(fn = "mon_fichier2.exp")

############## strategies principales ############

goalG = Strat(goal, "goal")
attaqueG = Strat(scoreG,"attaquant")
defenseG = Strat(defence,"defenseur")
lateralG = Strat(lateral,"lateral")
pointe = Strat(fullStrike,"pointe")
millieu = Strat(millieu,"millieu")
central = Strat(Dcentral,"dc")
joueur1 = Strat(j1,"j1")

######## strategies standards #############

conserver = Strat(conserver,"conserver")
开发者ID:redxrdx,项目名称:2iO13,代码行数:31,代码来源:strategie.py

示例8: miroir_st

            s_miroir = miroir_st(state)
            Mystate = PlayerStateDecorator(s_miroir,id_team , id_player)
            return miroir_sa(self.comportement(Mystate))


attaquant_fonceur = Strat(attaquant_fonceur, "A")
attaquant_pointe = Strat(attaquant_pointe, "AP")
defenseur_central = Strat(defenseur_central, "DC")
defenseur_gauche = Strat(defenseur_gauche, "DG")
defenseur_droit = Strat(defenseur_droit, "DD")
milieu = Strat(milieu, "M")
milieu_defensif = Strat(milieu_defensif, "MD")


#### Arbres de decisions

tree = cPickle.load(file("./arbre.pkl"))
dic = {"A":attaquant_fonceur,"AP":attaquant_pointe,"DC":defenseur_central, "DG":defenseur_gauche, "DD":defenseur_droit, "M":milieu, "MD":milieu_defensif}
treeStrat = DTreeStrategy(tree,dic,gen_features)

#### Controle avec commandes 

keytest = KeyboardStrategy(fn="arbre")

keytest.add("a", attaquant_fonceur)
keytest.add("z", attaquant_pointe)           
keytest.add("d", defenseur_central)  
keytest.add("e", milieu)  
keytest.add("r", milieu_defensif)

开发者ID:Raouf16,项目名称:2i013,代码行数:29,代码来源:Strat.py

示例9: KeyboardStrategy

from soccersimulator import SoccerMatch, show, SoccerTeam,Player,KeyboardStrategy,KeyboardStrategy
from strategy import MaStrategyFonceur
from strategy import MaStrategyDefensive
from strategy import MaStrategyCampeur
from strategy import MaStrategyUtilitaire
from strategy import MaStrategyGoal


strat = KeyboardStrategy()
strat.add("a",MaStrategyFonceur())
strat.add("z",MaStrategyDefensive())
strat.add("e",MaStrategyUtilitaire())
strat.add("r",MaStrategyGoal())

joueur1 = Player("Alpha", strat)
joueur2 = Player("Dourou", MaStrategyCampeur())
joueur3=  Player("Kiba", MaStrategyGoal())
joueur4=  Player("Soro", MaStrategyFonceur())
joueur5 = Player("Dadan", MaStrategyDefensive())
joueur6 = Player("Manque d'inspi", MaStrategyUtilitaire())

team1 = SoccerTeam("Equipe 1", [joueur1,joueur4])
team2 = SoccerTeam("Equipe 2", [joueur4,joueur5])

	
	
match = SoccerMatch(team1,team2,2000)
show(match)
strat.write("training.exp",True)
开发者ID:Asparodia,项目名称:soccersimulator,代码行数:29,代码来源:training.py

示例10: DTreeStrategy

from decisiontree import *
import cPickle

#tree = cPickle.load(file("./test.pkl"))
#dic = {"Random":RandomStrategy(),"Fonceur":FoncerStrategy(),"Marquer":MarquerStrategy()}
#treeStrat = DTreeStrategy(tree,dic,gen_features)

tree2 = cPickle.load(file("test.pkl"))
dic_exemple = {"Passe":PasseStrategy(),"Random":RandomStrategy(),"Marquer":MarquerStrategy()}
tree2Strat = DTreeStrategy(tree2,dic_exemple,gen_features)

tree3 = cPickle.load(file("goal.pkl"))
dic_exemple = {"Goal":GoalStrategy(),"Defenseur1":Defenseur1Strategy(),"Defenseur2":Defenseur2Strategy()}
tree_goal_strat = DTreeStrategy(tree3,dic_exemple,gen_features)

goal_strat = KeyboardStrategy() 
goal_strat.add("c",GoalStrategy())
#goal_strat.add("v",DefenseStrategy())
goal_strat.add("b",PasseStrategy())

strat2 = KeyboardStrategy() 
strat2.add("j",GoalStrategy())
strat2.add("k",PasseStrategy())
strat2.add("b", DribleStrategy())




team1 = SoccerTeam("team1",[Player("Alexous",strat2)])
team2 = SoccerTeam("team2",[Player("Sam",tree_goal_strat), Player("Slex",RandomStrategy())])
team3 = SoccerTeam("team3",[Player("A", PasseStrategy()), Player("x",RandomStrategy())])
开发者ID:fifa2016,项目名称:projet_foot,代码行数:31,代码来源:team.py

示例11: KeyboardStrategy

from strategy import MaStrategyCampeur
from strategy import MaStrategyGoal
from strategy import MaStrategyUtilitaire
from soccersimulator import DecisionTreeClassifier, SoccerMatch, show, SoccerTeam,Player,KeyboardStrategy

from strategy import DTreeStrategy
#from tree_1v1 import gen_features
#from tree_4v4 import gen_features
from tree_2v2 import gen_features
import cPickle
import os

f=os.path.join(os.path.dirname(os.path.realpath(__file__)),"tree.pkl")


strat = KeyboardStrategy()
strat.add("a",MaStrategyFonceur())
strat.add("z",MaStrategyDefensive())
strat.add("e",MaStrategyUtilitaire())
strat.add("r",MaStrategyGoal())

tree = cPickle.load(file(f))
dic = {"Campeur":MaStrategyCampeur(),"Fonceur":MaStrategyFonceur(),"Defenseur":MaStrategyDefensive(),"Utilitaire":MaStrategyUtilitaire(), "Goal":MaStrategyGoal()}
treeIA = DTreeStrategy(tree,dic,gen_features)

joueur1 = Player("Alpha", strat)
joueur2 = Player("Dourou", MaStrategyCampeur())
joueur3=  Player("Kiba", MaStrategyGoal())
joueur4=  Player("Soro", MaStrategyFonceur())
joueur5 = Player("Dadan", MaStrategyDefensive())
joueur6 = Player("Manque d'inspi", MaStrategyUtilitaire())
开发者ID:Asparodia,项目名称:soccersimulator,代码行数:31,代码来源:test2.py

示例12: len

""" Permet de jouer et d'entrainer une strategie
    * changer les strategies ajoutees
    * utilisation : python entrainer prefix_fichier_exemple
    par defaut ajoute au fichier d'exemples sil existe deja
    (extension : .exp pour le fichier exemple)
"""

from soccersimulator import  SoccerMatch, show, SoccerTeam,Player,KeyboardStrategy
from strategie import *
import sys

if __name__=="__main__":
    prefix = "tree"
    if len(sys.argv)>1:
        prefix = sys.argv[1]    
    keytest = KeyboardStrategy(fn = "mon_fichier")
    keytest.add("d",defenseG)
   # keytest.add("a",attaqueG)
    keytest.add("z",millieu)
    keytest.add("f",finition)
    keytest.add("t",tirer)
    keytest.add("c",conserver)
    keytest.add("g",dribbler)
    keytest.add("q",passer)
    keytest.add("x",position)   
#    keytest.add("c",central)
#    keytest.add("g",posG)
#    keytest.add("d",posGH)
#    keytest.add("c",posGB)   
#    keytest.add("x",degG)
    
开发者ID:redxrdx,项目名称:TMESOLO,代码行数:30,代码来源:entrainer.py

示例13: SousStrat

			return me.alligne_sur_demi_cercle
	else:
		if me.test_peut_shooter:
			return me.shoot_intercepter_contrecarE

		else:
			return me.aller_vers_ball + me.shoot_alea
	
	

FonceurStrat = SousStrat(fonceur_pass)
Gard_shoot_but = SousStrat(gardien_shoot_vers_but)
Gard_shoot_alea = SousStrat(gardien_shoot_alea)
DefStrat = SousStrat(def_mouvement_et_shoot)

keystrat1 = KeyboardStrategy()
keystrat1.add("a", Gard_shoot_alea)
keystrat1.add("b", Gard_shoot_but)

keystrat2= KeyboardStrategy()
keystrat2.add("c", FonceurStrat)
keystrat2.add("d", DefStrat)

milieustrat = KeyboardStrategy()
milieustrat.add("x", FonceurStrat)
milieustrat.add("w", DefStrat)




开发者ID:ad50144124,项目名称:mon_projet,代码行数:26,代码来源:Strategies.py

示例14: __init__

    def __init__(self,comportement,name):
        BaseStrategy.__init__(self,name)
        self.comportement = comportement
    def compute_strategy(self, state, id_team, id_player):
        s_miroir = state
        if id_team==1 :
            Mystate = PlayerStateDecorator(s_miroir,id_team , id_player)
            return self.comportement(Mystate)
        else :
            s_miroir = miroir_st(state)
            Mystate = PlayerStateDecorator(s_miroir,id_team , id_player)
            return miroir_sa(self.comportement(Mystate))
    
    
    
keyatt = KeyboardStrategy()
keygoal = KeyboardStrategy()
keydef = KeyboardStrategy()

    


goal_strat = Strat(goal , "1")
attaque_Strategy = Strat(attaque_pointe,"attaquant")
defense_Strategy = Strat(defenseur1,"def")
milieu = Strat(milieu_centre , "mil")      
milieu_deffa = Strat(milieu_def , "milOf")
test = Strat(test1, "test")
P1_fonceur = Strat(attaquant1 , "foncer")
T2_All = Strat(player_go , "tout")
attaquant_gauche = Strat(attaque_gauche , "7")
开发者ID:lounisAmazigh,项目名称:Projet_SS,代码行数:31,代码来源:Strategie.py

示例15: __init__

    def __init__(self,tree,dic,gen_feat):
        BaseStrategy.__init__(self,"Tree Strategy")
        self.dic = dic
        self.tree = tree
        self.gen_feat= gen_feat
    def compute_strategy(self, state, id_team, id_player):
        label = self.tree.predict([self.gen_feat(state,id_team,id_player)])[0]
        if label not in self.dic:
            print("Erreur : strategie %s non trouve" %(label,))
            return SoccerAction()
        return self.dic[label].compute_strategy(state,id_team,id_player)

dic = {"fonceur":StateLessStrategy(fonceur),"reflexion":StateLessStrategy(reflexion),"defent":StateLessStrategy(defent),"defent_l":StateLessStrategy(defent_l), "shooter":StateLessStrategy(shooter)}
st=DTreeStrategy(tree,dic,gen_features)

strat = KeyboardStrategy() #ou pour une sauvegarde automatique
#KeyboardStrategy(fn="monfichier.exp")
FS = StateLessStrategy(demarque2v1)
RF = StateLessStrategy(reflexion)
PA = StateLessStrategy(passage2v1)
RI = StateLessStrategy(rien)

strat.add("d",FS)
strat.add("q",RF)
strat.add("a",PA)
strat.add("r",RI)

player1 = Player("j1",strat)
player2 = Player("j2",strat)

开发者ID:ad50144124,项目名称:mon_projet,代码行数:29,代码来源:tmesolo.py


注:本文中的soccersimulator.KeyboardStrategy类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。