當前位置: 首頁>>代碼示例>>Python>>正文


Python KeyboardStrategy.add方法代碼示例

本文整理匯總了Python中soccersimulator.KeyboardStrategy.add方法的典型用法代碼示例。如果您正苦於以下問題:Python KeyboardStrategy.add方法的具體用法?Python KeyboardStrategy.add怎麽用?Python KeyboardStrategy.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在soccersimulator.KeyboardStrategy的用法示例。


在下文中一共展示了KeyboardStrategy.add方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: len

# 需要導入模塊: from soccersimulator import KeyboardStrategy [as 別名]
# 或者: from soccersimulator.KeyboardStrategy import add [as 別名]
""" 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 projet import *
import sys

if __name__=="__main__":
    prefix = "train"
    if len(sys.argv)>1:
        prefix = sys.argv[1]
    strat_key = KeyboardStrategy()
    strat_key.add("f",fonceStrat)
    strat_key.add("g",gardien)
    strat_key.add("a",attaque)
    strat_key.add("d",defense)
    team_noob = SoccerTeam("keyb",[Player("KBs", strat_key)])
    team_bad = SoccerTeam("foncteam",[Player("toto",j_solo)])
    match = SoccerMatch(team_noob,team_bad,1000)
    show(match)
    strat_key.write(prefix+".exp",True)
開發者ID:Kabegami,項目名稱:Projet-foot,代碼行數:27,代碼來源:entrainer.py

示例2: len

# 需要導入模塊: from soccersimulator import KeyboardStrategy [as 別名]
# 或者: from soccersimulator.KeyboardStrategy import add [as 別名]
""" 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,代碼行數:26,代碼來源:entrainer.py

示例3: PlayerStateDecorator

# 需要導入模塊: from soccersimulator import KeyboardStrategy [as 別名]
# 或者: from soccersimulator.KeyboardStrategy import add [as 別名]
        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))
    
keytest = KeyboardStrategy()
keytest1 = KeyboardStrategy()

goal_strat = Strat(goal , "1")
attaque_Strategy = Strat(attaque_pointe,"attaquant")
defense_Strategy = Strat(defenseur1,"def")
milieu = Strat(milieu_centre , "mil")      
milieu_attaquant = Strat(milieu_att , "milOf")
test = Strat(test1, "test")
P1_fonceur = Strat(attaquant1 , "att")
T2_All = Strat(player_go , "tout")

keytest.add("d" , defense_Strategy  )
keytest.add("a" , attaque_Strategy  )           
keytest.add("z" , milieu )  
keytest.add("g" , goal_strat  )     

keytest1.add("q" , defense_Strategy  )
keytest1.add("s" , attaque_Strategy  )           
keytest1.add("x" , milieu )  
keytest1.add("w" , goal_strat  )   
開發者ID:ad50144124,項目名稱:mon_projet,代碼行數:32,代碼來源:Strategie.py

示例4: Strat

# 需要導入模塊: from soccersimulator import KeyboardStrategy [as 別名]
# 或者: from soccersimulator.KeyboardStrategy import add [as 別名]
######## strategies standards #############

conserver = Strat(conserver,"conserver")
tirer = Strat(tirer,"tirer")
dribbler = Strat(dribbler,"dribbler")
passer = Strat(passer,"passer")
finition = Strat(finition,"finition")
position = Strat(position,"position")
posG= Strat(posG,"position")
posGH = Strat(posGH,"position")
posGB = Strat(posGB,"position")
degG = Strat(degG,"position")

############## stratregies associés au clavier ##########

keytest.add("d",defenseG)
keytest.add("a",attaqueG)
keytest.add("z",millieu)
#keytest.add("c",central)
keytest.add("t",tirer)
keytest.add("c",conserver)
keytest.add("g",dribbler)
keytest.add("q",passer)
keytest.add("f",finition)
keytest.add("x",position)





開發者ID:redxrdx,項目名稱:2iO13,代碼行數:27,代碼來源:strategie.py

示例5: len

# 需要導入模塊: from soccersimulator import KeyboardStrategy [as 別名]
# 或者: from soccersimulator.KeyboardStrategy import add [as 別名]
# -*- 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,代碼行數:32,代碼來源:entrainer.py

示例6: Strat

# 需要導入模塊: from soccersimulator import KeyboardStrategy [as 別名]
# 或者: from soccersimulator.KeyboardStrategy import add [as 別名]
T2_All = Strat(player_go , "tout")
attaquant_gauche = Strat(attaque_gauche , "7")
att_def_droit = Strat(marcelo , "att_def_droit")
def_gauche = Strat(deff_gauche , "3")
foncer = Strat(foncer , "9")
tire_alea = Strat(tire_aleatoire,"tire_alea")
PasseStrategy = Strat(Passe , "passe")

#BASIC 
att_droit_basic = Strat(attaquant_droit_basic , "att_droit")
att_gauche_basic = Strat(attaquant_gauche_basic , "att_gauche")
deffa_droit_basic = Strat(deff_droit_basic , "def_droit")
deffa_gauche_basic = Strat(deff_gauche_basic , "def_gauche")

# ATT DEF GAUCHE
keyatt.add("d" ,   P1_fonceur ) 
keyatt.add("s" , att_gauche_basic  )
keyatt.add("z" , att_droit_basic  )           
keyatt.add("q" , deffa_gauche_basic ) 
keyatt.add("a" ,  deffa_droit_basic ) 

# Goal Strategie 
keygoal.add("g" , goal_strat)
keygoal.add("f" , defense_Strategy)
keygoal.add("h" , tire_alea)
  
#DEF STRATEGIE
  
keydef.add("d" ,   P1_fonceur ) 
keydef.add("s" , att_gauche_basic  )
keydef.add("z" , att_droit_basic  )    
開發者ID:lounisAmazigh,項目名稱:Projet_SS,代碼行數:33,代碼來源:Strategie.py

示例7: len

# 需要導入模塊: from soccersimulator import KeyboardStrategy [as 別名]
# 或者: from soccersimulator.KeyboardStrategy import add [as 別名]
    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 = "goal")
   # 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)

############## pour le gardien #########"""


    keytest.add("g",posG)
    keytest.add("d",posGH)
    keytest.add("c",posGB)   
    keytest.add("x",degG)
開發者ID:redxrdx,項目名稱:2iO13,代碼行數:33,代碼來源:entrainer.py

示例8: len

# 需要導入模塊: from soccersimulator import KeyboardStrategy [as 別名]
# 或者: from soccersimulator.KeyboardStrategy import add [as 別名]
""" 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,代碼行數:27,代碼來源:entrainer.py

示例9: compute_strategy

# 需要導入模塊: from soccersimulator import KeyboardStrategy [as 別名]
# 或者: from soccersimulator.KeyboardStrategy import add [as 別名]
    def compute_strategy(self,state,idteam,idplayer): #ou faire miroir ici
	self.state = state
     
        action,self.name=self.strat(MyState(self.state,idteam,idplayer))
	#print action
        #if(idteam!=1):
	   #action= miroir_action(action)

        #print action
        return action

QDribbut= SStrat(qdribler_vers_but)
QDriblerzone = SStrat(qdribler_vers_zone)
QDegager = SStrat(qdegager)
QShootBas = SStrat(qshooter_bas)
QShootHaut= SStrat(qshooter_haut)
QShooterMalin= SStrat(qshooter_malin)
QShootFort= SStrat(qshooter_fort)
QDegager = SStrat(qdegager)

KBS=KeyboardStrategy()
KBS.add("y",QShootHaut)
KBS.add("h",QShootBas)
KBS.add("b",QShootFort)
KBS.add("d",QDribbut)
KBS.add("u",QShooterMalin)
KBS.add("e",QDegager)


開發者ID:3408247,項目名稱:MonProj,代碼行數:29,代碼來源:newqkbs.py

示例10: KeyboardStrategy

# 需要導入模塊: from soccersimulator import KeyboardStrategy [as 別名]
# 或者: from soccersimulator.KeyboardStrategy import add [as 別名]
#team2=SoccerTeam("team2",[Player("t2j1",StateLessStrategy(Smart1v1))])


#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)
RF = StateLessStrategy(reflexion)
DF = StateLessStrategy(defent)
DL = StateLessStrategy(defent_l)
SH = StateLessStrategy(shooter)
PA = StateLessStrategy(passage)

strat.add("d",FS)
strat.add("q",RF)
strat.add("s",DF)
strat.add("z",DL)
strat.add("f",SH)
strat.add("a",PA)





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


team1=SoccerTeam("team1",[Player("t1j2",StateLessStrategy(Smart2v2)),Player("t1j2",StateLessStrategy(Smart2v2))])
開發者ID:ad50144124,項目名稱:mon_projet,代碼行數:33,代碼來源:project.py

示例11: DTreeStrategy

# 需要導入模塊: from soccersimulator import KeyboardStrategy [as 別名]
# 或者: from soccersimulator.KeyboardStrategy import add [as 別名]
from strategies import *
from decisiontree import DTreeStrategy
from soccersimulator import SoccerMatch, SoccerTeam,Player,KeyboardStrategy
from decisiontree import *
import cPickle

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_exemple2 = {"Goal":GoalStrategy(),"Defenseur1":Defenseur1Strategy(),"Defenseur2":Defenseur2Strategy(),"Passe":PasseStrategy(),"Drible":DribleStrategy(),"Marquer":MarquerStrategy()}
tree_goal_strat = DTreeStrategy(tree3,dic_exemple2,gen_features)

strat1 = KeyboardStrategy() 
strat1.add("a",GoalStrategy())
strat1.add("z",PasseStrategy())
strat1.add("e", Defenseur1Strategy())
strat1.add("r", Defenseur2Strategy())
strat1.add("t", MarquerStrategy())
strat1.add("y", DribleStrategy())
strat1.add("u", FoncerStrategy())




team1 = SoccerTeam("team1",[Player("Arbre",tree_goal_strat)])
team2 = SoccerTeam("team2",[Player("Arbre",tree2Strat), Player("Passeur",PasseStrategy())])
team4 = SoccerTeam("team4",[Player("Defenseur",Defenseur1Strategy()), Player("Passeur",PasseStrategy()), Player("Goal",GoalStrategy()), Player("Attaquant",MarquerStrategy())])

開發者ID:fifa2016,項目名稱:projet_foot,代碼行數:31,代碼來源:team.py

示例12: SousStrat

# 需要導入模塊: from soccersimulator import KeyboardStrategy [as 別名]
# 或者: from soccersimulator.KeyboardStrategy import add [as 別名]
	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)





class RandomStrategy(BaseStrategy):
開發者ID:ad50144124,項目名稱:mon_projet,代碼行數:33,代碼來源:Strategies.py

示例13: KeyboardStrategy

# 需要導入模塊: from soccersimulator import KeyboardStrategy [as 別名]
# 或者: from soccersimulator.KeyboardStrategy import add [as 別名]
from soccersimulator import SoccerTeam, SoccerMatch
from soccersimulator import Player, SoccerTournament
from soccersimulator import BaseStrategy, SoccerAction
from soccersimulator import Vector2D, Player, SoccerTournament
from soccersimulator.settings import *
from strategy import MaStrategyFonceur
from strategy import MaStrategyDefensive
from strategy import MaStrategyCampeur
from strategy import MaStrategyGoal
from strategy import MaStrategyUtilitaire
import soccersimulator
from tools import PlayerStateDeco
from soccersimulator import KeyboardStrategy

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,joueur3])
team2 = SoccerTeam("Equipe 2", [joueur5,joueur3])
team3 = SoccerTeam("Equipe 3", [joueur1,joueur2,joueur3,joueur5]) 
team4 = SoccerTeam("Equipe 4", [joueur6,joueur2,joueur3,joueur5])
開發者ID:Asparodia,項目名稱:soccersimulator,代碼行數:33,代碼來源:test.py

示例14: SoccerMatch

# 需要導入模塊: from soccersimulator import KeyboardStrategy [as 別名]
# 或者: from soccersimulator.KeyboardStrategy import add [as 別名]
from soccersimulator import show
from soccersimulator import SoccerMatch
from soccersimulator import KeyboardStrategy
from team import lalya1, lalya2, lalya4, lalya1bis, lalya0
from coordination import *

match_lalya1 = SoccerMatch(lalya1, lalya1)
match_lalya2 = SoccerMatch(lalya2, lalya2)
match_lalya4 = SoccerMatch(lalya4, lalya4)


match_lalya5 = SoccerMatch(lalya4, lalya2)
if __name__ == "__main__":
    strat = KeyboardStrategy(fn="monfichier.exp")
    #fn veut dire filename
    strat.add("d", defenseur)
    #Ensuite on ajoute les joueurs, bref...
    show(match_lalya5)
開發者ID:ad50144124,項目名稱:mon_projet,代碼行數:20,代碼來源:test.py

示例15: KeyboardStrategy

# 需要導入模塊: from soccersimulator import KeyboardStrategy [as 別名]
# 或者: from soccersimulator.KeyboardStrategy import add [as 別名]
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

Strat_protect= SousStrat(protect_cage)
開發者ID:3408247,項目名稱:MonProj,代碼行數:33,代碼來源:keyb_strats.py


注:本文中的soccersimulator.KeyboardStrategy.add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。