1 package cz.cuni.amis.pogamut.ut2004.analyzer.stats;
2
3 import com.google.inject.Inject;
4
5 import cz.cuni.amis.pogamut.base.communication.command.IAct;
6 import cz.cuni.amis.pogamut.base.component.bus.IComponentBus;
7 import cz.cuni.amis.pogamut.base.utils.logging.IAgentLogger;
8 import cz.cuni.amis.pogamut.ut2004.agent.module.sensor.AgentStats;
9 import cz.cuni.amis.pogamut.ut2004.analyzer.UT2004AnalyzerObserver;
10 import cz.cuni.amis.pogamut.ut2004.analyzer.UT2004AnalyzerObserverParameters;
11 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.ConfigurationObserver;
12 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.InitializeObserver;
13 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.BotKilled;
14 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.MyInventory;
15 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Self;
16 import cz.cuni.amis.pogamut.ut2004.communication.worldview.UT2004WorldView;
17
18
19
20
21
22 public class UT2004AnalyzerObsStats extends UT2004AnalyzerObserver {
23
24 private AgentStats stats;
25
26 @Inject
27 public UT2004AnalyzerObsStats(UT2004AnalyzerObserverParameters params,
28 IComponentBus bus, IAgentLogger agentLogger,
29 UT2004WorldView worldView, IAct act) {
30 super(params, bus, agentLogger, worldView, act);
31 stats = new AgentStats(this);
32 stats.setObserver(true);
33 if (getParams().isWaitForMatchRestart()) {
34 stats.setLogBeforeMatchRestart(false);
35 } else {
36 stats.startOutput(getOutputFilePath(), true);
37 }
38 }
39
40
41
42
43
44 public AgentStats getStats() {
45 return stats;
46 }
47
48 @Override
49 protected void gameRestartEnd() {
50 stats.startOutput(getOutputFilePath(), true);
51 }
52
53
54
55
56
57
58
59 protected void configureObserver() {
60 getAct().act(new ConfigurationObserver().setUpdate(0.25).setAll(true).setSelf(true).setAsync(true).setGame(false).setSee(false).setSpecial(false));
61 }
62
63 }