[Home]FloodGrapher/Design

Robo Home | FloodGrapher | Changes | Preferences | AllPages

package kawigi.tools;

Grapher back-end

public GrapherSegmentation? segmentAt(int index)
public int size()
public void add(GrapherSegmentation? seg)

private Scheme scheme
private Object statsbuffer : a multi-dimensional array of numbers whose dimensionality is one more than the size of the scheme. Shouldn't be jagged (so a finite number of buckets can be used to take any cross-section of the data).
public SegmentedData(Scheme scheme, Object stats) : Creates a new SegmentedData object. stats should be a non-jagged multi-dimensional array of doubles, the size of the scheme should be one less than the dimensionality of the stats (if not, expect crashes later).
public void createSelectionGUI?(GraphControlWindow? window) : Sets up the GraphControlWindow? to have all the necessary widgets to select a graph. The components added to this window will come from the GrapherSegmentation? objects in the Scheme. The window is also an ActionListener? and ItemListener? and should be added as a listener to the relevant components.
public GraphData? getSelectedGraphData?() : This is the main point of this class, to get the data selected through the various GUI components.
public void setData(SegmentedData reload) : sets the data in this object to the data in reload. This is used to "refresh" the graph and keep the same UI.

public String getName() : gets the name of this segmentation axis
public void addSelectionWidget?(GraphControlWindow? window) : adds a component (most often a JComboBox?) to select information from this segmentation, as well as necessary listeners, to the window. The object should keep a reference to this component and only one such widget should ever be associated with each GrapherSegmentation? object.
public boolean accept(int index) : returns true if the current state of the widget accepts this segment index. Returns false if it does not or if the widget has not yet been created.

public GraphData?(Color c, double[] data)
public GraphData?(double[] data)
public Color getColor()
public void setColor(Color newcolor)
public double[] getData()

public SegmentedData getData(File datafile) throws IOException, InvalidFileException?
public String getFormatName?() : Used when the object is dynamically loaded with other FileFormat? objects to create a list of possible objects to use on a given file.

public InvalidFileException?(String message)


Grapher front-end

	Color getSelectedColor?()

public void addGraph(GraphData? graph, GraphControlWindow? source) : adds the new graph or replaces the old one from this source if one exists
public void removeGraph(GraphControlWindow? source) : removes the graph associated with the given frame from the display. Called when the GraphControlWindow? is closed.

public GraphControlWindow?(SegmentedData data, String name, GraphDisplayer? ) : the name is set on the title bar of the window, the GUI components are added to it for the segmentation of the graph as well as a GraphColorSelector? and a refresh button.
public void actionPerformed(ActionEvent? event) : for interface ActionListener?. Updates the GraphDisplayer?.
public void itemStateChanged?(ItemEvent? event) : for interface ItemListener?. Updates the GraphDisplayer?
public void internalFrameClosing?(InternalFrameEvent? event) : disposes of the window after removing the graph associated with this window from the GraphDisplay?
public void internalFrameDidWhatever?(InternalFrameEvent? event) : whatever else is necessary to satisfy interface InternalFrameListener?, these probably won't do anything exciting.


Robot Design

public void onEvent(Event, AdvancedRobot)
public void run(AdvancedRobot) : called in the run loop of the robot

public double getPower(ScannedRobotEvent e, AdvancedRobot ar) : returns the power that should be used, or return <= 0 if no shot should be fired.
FloodMiniPower? : The energy management I use in most of my bots, FloodHTPower? : A little more complex and strategy oriented power management, ConservativePower? : A power management scheme that favors lower powers than 3 most of the time, RandomPower? : Might be worthwhile, SparkPower? : Might also be interesting, LowPower? : Shoots fast bullets

public int numSegments() : returns the total number of possible segments that could be chosen
public GraphingSegmentation? getGraphingSegmentation?() : This information will probably be stored in the data files, the idea is to convert it directly into a GraphingSegmentation? object. There should basically be a corresponding GraphingSegmentation? class for each Segmentation class.
public int getSegmentIndex?(ScannedRobotEvent e, AdvancedRobot ar, PowerManagement? em) : Gets the index of the segment that should be used in the given situation.


While some of this design was changed by the time it was released (most notably that the GUI panels became plugins themselves), I really stuck to this design in general, not just for the design's sake, but because it just all fit together on paper, and fit together almost as well in code. I suspect that future changes to this design will allow better flexibility for modules and such. -- Kawigi


Robo Home | FloodGrapher | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited March 9, 2004 23:58 EST by Kawigi (diff)
Search: