Grapher back-end

class SegmentedData : A sort of database using the Scheme that can be "selected" from to collect actual data. It should be flexible enough that it should be unnecessary to subclass it. This class should be easily createable from the information saved by the Graphing bot, and may also have a constructor to take the array of data and scheme, so that it can be extended to analyze data from other bots.

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 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 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.

NewGraphWindow? extends JDialog : includes components to choose a file and a FileFormat? to use to open it and OK/Cancel? buttons, has some sort of callback mechanism to add a GraphControlWindow? back into the main GUI when the OK button is pressed. The JDesktopPane? will probably be passed into the constructor or something.

FloodGrapherGUI? extends JFrame : This is the container for the entire Graphing utility. It contains mainly a GraphDisplayer?, a JDesktopPane?, and a JMenuBar?. The menus have the ability to open files and select from available FileFormat? objects, close the application, and possibly some other features with the display. The JDesktopPane? will contain some number of GraphControlWindow? which will control the GraphDisplayer?.

Robot Design

FloodGrapher extends AdvancedRobot : robot that creates and uses the configured modules. If robots are allowed to do so, it should try to dynamically load these classes based on what it reads from a config file:

Subclasses: StationaryMovement? : for TC-type tests, sort of an oxymoron, FloodMovement: Like FloodMini, FhqwhgadsMovement?: Like Fhqwhgads, CigaretMovement?: Like Cigaret, LinebackerMovement?: Tries to corner you. Good to test against.

interface PowerManagement? : Used to play with power management. These should be easily dynamically loadable, i.e. - have a parameterless constructor.

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