@@ -23,11 +23,11 @@ def __init__(self, agent_type, uniform_number) -> None:
2323 self .debug_mode : bool = False
2424
2525 def GetAction (self , state : pb2 .State ):
26- if self .agent_type == pb2 .AgentType .Player :
26+ if self .agent_type == pb2 .AgentType .PlayerT :
2727 return self .GetPlayerActions (state )
28- elif self .agent_type == pb2 .AgentType .Coach :
28+ elif self .agent_type == pb2 .AgentType .CoachT :
2929 return self .GetCoachActions (state )
30- elif self .agent_type == pb2 .AgentType .Trainer :
30+ elif self .agent_type == pb2 .AgentType .TrainerT :
3131 return self .GetTrainerActions (state )
3232
3333 def GetPlayerActions (self , state : pb2 .State ):
@@ -124,21 +124,21 @@ def Register(self, register_request: pb2.RegisterRequest, context):
124124 f"agent_type: { register_request .agent_type } " )
125125 with shared_lock :
126126 shared_number_of_connections .value += 1
127- logging .debug (f"Number of connections { shared_number_of_connections .value } " )
128- team_name = register_request .team_name
129- uniform_number = register_request .uniform_number
130- agent_type = register_request .agent_type
131- self .agents . append ( shared_number_of_connections .value , GrpcAgent (agent_type , uniform_number ) )
132- res = pb2 .RegisterResponse (client_id = shared_number_of_connections .value ,
133- team_name = team_name ,
134- uniform_number = uniform_number ,
135- agent_type = agent_type )
127+ logging .debug (f"Number of connections { shared_number_of_connections .value } " )
128+ team_name = register_request .team_name
129+ uniform_number = register_request .uniform_number
130+ agent_type = register_request .agent_type
131+ self .agents [ shared_number_of_connections .value ] = GrpcAgent (agent_type , uniform_number )
132+ res = pb2 .RegisterResponse (client_id = shared_number_of_connections .value ,
133+ team_name = team_name ,
134+ uniform_number = uniform_number ,
135+ agent_type = agent_type )
136136 return res
137137
138- def SendByeCommand (self , register_response : pb2 .RegisterResponse ):
138+ def SendByeCommand (self , register_response : pb2 .RegisterResponse , context ):
139139 logging .debug (f"Bye command received unum { register_response .uniform_number } " )
140- with shared_lock :
141- self .agents .pop (register_response .client_id )
140+ # with shared_lock:
141+ self .agents .pop (register_response .client_id )
142142
143143 res = pb2 .Empty ()
144144 return res
0 commit comments