MCPcopy Create free account
hub / github.com/JoshuaPostel/texaform / HUD

Class HUD

python/hud.py:6–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4from agent import Agent
5
6class HUD(Agent):
7
8 # TODO left off here
9 def accumulator_charge(self) -> int:
10 resp = self.send("STAT POWR")
11 parts = resp.split()
12 return int(parts[2])
13
14
15 def get_research_status(self) -> Dict[str, str]:
16 research_status = {}
17
18 while True:
19 resp = self.send("LIST RESR")
20 parts = resp.split()
21 research = parts[0]
22 status = parts[1]
23 if research_status.get(research):
24 return research_status
25 else:
26 research_status[research] = status
27
28
29 def completed_research(self) -> List[str]:
30 research_status = self.get_research_status()
31 return [r for (r, s) in research_status.items() if s == "RESEARCHED"]
32
33
34 def get_existing_agents(self) -> Dict[str, List[int]]:
35 existing_agents = defaultdict(list)
36
37 while True:
38 resp = self.send("LIST AGNT")
39 parts = resp.split()
40 port = int(parts[0])
41 kind = parts[1]
42
43 if port in existing_agents[kind]:
44 return existing_agents
45 else:
46 existing_agents[kind].append(port)

Callers 1

make.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected