diff --git a/.gitignore b/.gitignore index b9b0534498c5bcad2640876ea5800d971726a528..66bcf07a13a23429be6a053affae3ad41c012c9b 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,6 @@ buildNumber.properties # intellij idea project paths .idea/workspace.xml -.idea/tasks.xml \ No newline at end of file +.idea/tasks.xml +.idea/ +*.iml diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index 460a809744a93e622430dc4852b91b05c2130888..0000000000000000000000000000000000000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -SimpleAsteroids \ No newline at end of file diff --git a/.idea/ant.xml b/.idea/ant.xml deleted file mode 100644 index f6e673adc243ba90475f82ef457704e9f62624bb..0000000000000000000000000000000000000000 --- a/.idea/ant.xml +++ /dev/null @@ -1,3 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4" /> - diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index ff2e67dad0358a6f5e05bf2c289eea31fdb299fc..0000000000000000000000000000000000000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="CompilerConfiguration"> - <option name="DEFAULT_COMPILER" value="Javac" /> - <resourceExtensions> - <entry name=".+\.(properties|xml|html|dtd|tld)" /> - <entry name=".+\.(gif|png|jpeg|jpg)" /> - </resourceExtensions> - <wildcardResourcePatterns> - <entry name="?*.properties" /> - <entry name="?*.xml" /> - <entry name="?*.gif" /> - <entry name="?*.png" /> - <entry name="?*.jpeg" /> - <entry name="?*.jpg" /> - <entry name="?*.html" /> - <entry name="?*.dtd" /> - <entry name="?*.tld" /> - <entry name="?*.ftl" /> - </wildcardResourcePatterns> - <annotationProcessing> - <profile default="true" name="Default" enabled="false"> - <processorPath useClasspath="true" /> - </profile> - </annotationProcessing> - </component> -</project> - diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml deleted file mode 100644 index e7bedf3377d40335424fd605124d4761390218bb..0000000000000000000000000000000000000000 --- a/.idea/copyright/profiles_settings.xml +++ /dev/null @@ -1,3 +0,0 @@ -<component name="CopyrightManager"> - <settings default="" /> -</component> \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index e206d70d8595e2a50675ba11de48efcfa012497d..0000000000000000000000000000000000000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" /> -</project> - diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index b000e48a65557049b1f3ba8f23c8f12d32cd9141..0000000000000000000000000000000000000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,76 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="EntryPointsManager"> - <entry_points version="2.0" /> - </component> - <component name="IdProvider" IDEtalkID="6427611FBB036B0FE26E95BC19991EFB" /> - <component name="JavadocGenerationManager"> - <option name="OUTPUT_DIRECTORY" /> - <option name="OPTION_SCOPE" value="protected" /> - <option name="OPTION_HIERARCHY" value="true" /> - <option name="OPTION_NAVIGATOR" value="true" /> - <option name="OPTION_INDEX" value="true" /> - <option name="OPTION_SEPARATE_INDEX" value="true" /> - <option name="OPTION_DOCUMENT_TAG_USE" value="false" /> - <option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" /> - <option name="OPTION_DOCUMENT_TAG_VERSION" value="false" /> - <option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" /> - <option name="OPTION_DEPRECATED_LIST" value="true" /> - <option name="OTHER_OPTIONS" value="" /> - <option name="HEAP_SIZE" /> - <option name="LOCALE" /> - <option name="OPEN_IN_BROWSER" value="true" /> - </component> - <component name="ProjectInspectionProfilesVisibleTreeState"> - <entry key="Project Default"> - <profile-state /> - </entry> - </component> - <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> - <output url="file://$PROJECT_DIR$/out" /> - </component> - <component name="WebServicesPlugin" addRequiredLibraries="true" /> - <component name="masterDetails"> - <states> - <state key="ArtifactsStructureConfigurable.UI"> - <settings> - <artifact-editor /> - <splitter-proportions /> - </settings> - </state> - <state key="FacetStructureConfigurable.UI"> - <settings> - <splitter-proportions /> - </settings> - </state> - <state key="GlobalLibrariesConfigurable.UI"> - <settings> - <splitter-proportions /> - </settings> - </state> - <state key="ModuleStructureConfigurable.UI"> - <settings> - <splitter-proportions /> - </settings> - </state> - <state key="ProjectJDKs.UI"> - <settings> - <last-edited>1.6</last-edited> - <splitter-proportions> - <option name="proportions"> - <list> - <option value="0.2" /> - </list> - </option> - </splitter-proportions> - </settings> - </state> - <state key="ProjectLibrariesConfigurable.UI"> - <settings> - <splitter-proportions /> - </settings> - </state> - </states> - </component> -</project> - diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 928ff5d49f3e07c853ff6fcab90e623b80523525..0000000000000000000000000000000000000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="ProjectModuleManager"> - <modules> - <module fileurl="file://$PROJECT_DIR$/SimpleAsteroids.iml" filepath="$PROJECT_DIR$/SimpleAsteroids.iml" /> - </modules> - </component> -</project> - diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml deleted file mode 100644 index 922003b8433bcad6ce9778a37628d738faa26389..0000000000000000000000000000000000000000 --- a/.idea/scopes/scope_settings.xml +++ /dev/null @@ -1,5 +0,0 @@ -<component name="DependencyValidationManager"> - <state> - <option name="SKIP_IMPORT_STATEMENTS" value="false" /> - </state> -</component> \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml deleted file mode 100644 index 3b0002030884f78f1562177d81eb2f42c5acbd43..0000000000000000000000000000000000000000 --- a/.idea/uiDesigner.xml +++ /dev/null @@ -1,125 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="Palette2"> - <group name="Swing"> - <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false"> - <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" /> - </item> - <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false"> - <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" /> - </item> - <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false"> - <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" /> - </item> - <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true"> - <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" /> - </item> - <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false"> - <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" /> - <initial-values> - <property name="text" value="Button" /> - </initial-values> - </item> - <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false"> - <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> - <initial-values> - <property name="text" value="RadioButton" /> - </initial-values> - </item> - <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false"> - <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> - <initial-values> - <property name="text" value="CheckBox" /> - </initial-values> - </item> - <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false"> - <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" /> - <initial-values> - <property name="text" value="Label" /> - </initial-values> - </item> - <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true"> - <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> - <preferred-size width="150" height="-1" /> - </default-constraints> - </item> - <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true"> - <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> - <preferred-size width="150" height="-1" /> - </default-constraints> - </item> - <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true"> - <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> - <preferred-size width="150" height="-1" /> - </default-constraints> - </item> - <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true"> - <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> - <preferred-size width="150" height="50" /> - </default-constraints> - </item> - <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true"> - <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> - <preferred-size width="150" height="50" /> - </default-constraints> - </item> - <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true"> - <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> - <preferred-size width="150" height="50" /> - </default-constraints> - </item> - <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true"> - <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" /> - </item> - <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false"> - <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> - <preferred-size width="150" height="50" /> - </default-constraints> - </item> - <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false"> - <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3"> - <preferred-size width="150" height="50" /> - </default-constraints> - </item> - <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false"> - <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> - <preferred-size width="150" height="50" /> - </default-constraints> - </item> - <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false"> - <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3"> - <preferred-size width="200" height="200" /> - </default-constraints> - </item> - <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false"> - <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3"> - <preferred-size width="200" height="200" /> - </default-constraints> - </item> - <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true"> - <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" /> - </item> - <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false"> - <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" /> - </item> - <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false"> - <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" /> - </item> - <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false"> - <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" /> - </item> - <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false"> - <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1"> - <preferred-size width="-1" height="20" /> - </default-constraints> - </item> - <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false"> - <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" /> - </item> - <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false"> - <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" /> - </item> - </group> - </component> -</project> - diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index c80f2198b5f6863fd489ec8ac6c40a50ac1f7b30..0000000000000000000000000000000000000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="VcsDirectoryMappings"> - <mapping directory="$PROJECT_DIR$" vcs="Git" /> - </component> -</project> - diff --git "a/.idea/workspace (Simon\303\224\303\207\303\226s MacBook Pro's conflicted copy 2015-06-08).xml" "b/.idea/workspace (Simon\303\224\303\207\303\226s MacBook Pro's conflicted copy 2015-06-08).xml" deleted file mode 100644 index 40ab656c780700586c883f9f2ccfa73147e3a798..0000000000000000000000000000000000000000 --- "a/.idea/workspace (Simon\303\224\303\207\303\226s MacBook Pro's conflicted copy 2015-06-08).xml" +++ /dev/null @@ -1,1276 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="ChangeListManager"> - <list default="true" id="ebda1064-4e7d-40c4-8a89-ad3f47ecbaf1" name="Default" comment="" /> - <ignored path="SimpleAsteroids.iws" /> - <ignored path=".idea/workspace.xml" /> - <ignored path="$PROJECT_DIR$/out/" /> - <ignored path=".idea/dataSources.local.xml" /> - <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> - <option name="TRACKING_ENABLED" value="true" /> - <option name="SHOW_DIALOG" value="false" /> - <option name="HIGHLIGHT_CONFLICTS" value="true" /> - <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> - <option name="LAST_RESOLUTION" value="IGNORE" /> - </component> - <component name="ChangesViewManager" flattened_view="true" show_ignored="false" /> - <component name="CreatePatchCommitExecutor"> - <option name="PATCH_PATH" value="" /> - </component> - <component name="DaemonCodeAnalyzer"> - <disable_hints /> - </component> - <component name="DebuggerManager"> - <breakpoint_any default_suspend_policy="SuspendAll" default_condition_enabled="true" converted="true"> - <breakpoint> - <option name="NOTIFY_CAUGHT" value="true" /> - <option name="NOTIFY_UNCAUGHT" value="true" /> - <option name="ENABLED" value="false" /> - <option name="LOG_ENABLED" value="false" /> - <option name="LOG_EXPRESSION_ENABLED" value="false" /> - <option name="SUSPEND_POLICY" value="SuspendAll" /> - <option name="SUSPEND" value="true" /> - <option name="COUNT_FILTER_ENABLED" value="false" /> - <option name="COUNT_FILTER" value="0" /> - <option name="CONDITION_ENABLED" value="false" /> - <option name="CLASS_FILTERS_ENABLED" value="false" /> - <option name="INSTANCE_FILTERS_ENABLED" value="false" /> - <option name="CONDITION" value="" /> - <option name="LOG_MESSAGE" value="" /> - </breakpoint> - <breakpoint> - <option name="NOTIFY_CAUGHT" value="true" /> - <option name="NOTIFY_UNCAUGHT" value="true" /> - <option name="ENABLED" value="false" /> - <option name="LOG_ENABLED" value="false" /> - <option name="LOG_EXPRESSION_ENABLED" value="false" /> - <option name="SUSPEND_POLICY" value="SuspendAll" /> - <option name="SUSPEND" value="true" /> - <option name="COUNT_FILTER_ENABLED" value="false" /> - <option name="COUNT_FILTER" value="0" /> - <option name="CONDITION_ENABLED" value="false" /> - <option name="CLASS_FILTERS_ENABLED" value="false" /> - <option name="INSTANCE_FILTERS_ENABLED" value="false" /> - <option name="CONDITION" value="" /> - <option name="LOG_MESSAGE" value="" /> - </breakpoint> - </breakpoint_any> - <ui_properties converted="true" /> - <breakpoint_rules converted="true" /> - </component> - <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" /> - <component name="FavoritesManager"> - <favorites_list name="SimpleAsteroids" /> - </component> - <component name="FileEditorManager"> - <leaf> - <file leaf-file-name="Game.java" pinned="false" current-in-tab="true"> - <entry file="file://$PROJECT_DIR$/src/asteroids/Game.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.75" vertical-offset="585" max-vertical-offset="1485"> - <caret line="56" column="5" selection-start-line="56" selection-start-column="5" selection-end-line="56" selection-end-column="5" /> - <folding /> - </state> - </provider> - </entry> - </file> - <file leaf-file-name="Action.java" pinned="false" current-in-tab="false"> - <entry file="file://$PROJECT_DIR$/src/asteroids/Action.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="405" max-vertical-offset="525"> - <caret line="28" column="53" selection-start-line="28" selection-start-column="53" selection-end-line="28" selection-end-column="53" /> - <folding /> - </state> - </provider> - </entry> - </file> - <file leaf-file-name="Controller.java" pinned="false" current-in-tab="false"> - <entry file="file://$PROJECT_DIR$/src/asteroids/Controller.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="45" max-vertical-offset="195"> - <caret line="3" column="18" selection-start-line="3" selection-start-column="18" selection-end-line="3" selection-end-column="18" /> - <folding /> - </state> - </provider> - </entry> - </file> - <file leaf-file-name="GameObject.java" pinned="false" current-in-tab="false"> - <entry file="file://$PROJECT_DIR$/src/asteroids/GameObject.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="435" max-vertical-offset="525"> - <caret line="35" column="0" selection-start-line="35" selection-start-column="0" selection-end-line="35" selection-end-column="0" /> - <folding /> - </state> - </provider> - </entry> - </file> - <file leaf-file-name="GameState.java" pinned="false" current-in-tab="false"> - <entry file="file://$PROJECT_DIR$/src/asteroids/GameState.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="270" max-vertical-offset="3555"> - <caret line="24" column="5" selection-start-line="24" selection-start-column="5" selection-end-line="24" selection-end-column="5" /> - <folding /> - </state> - </provider> - </entry> - </file> - <file leaf-file-name="JAVA/asteroids" pinned="false" current-in-tab="false"> - <entry file="uml://JAVA/asteroids"> - <provider selected="true" editor-type-id="UmlEditorProvider"> - <state> - <ID>JAVA</ID> - <OriginalElement>asteroids</OriginalElement> - <nodes> - <node x="0.0" y="78.0">asteroids.Missile</node> - <node x="136.49999999999997" y="156.0">asteroids.LissajousAsteroid</node> - <node x="128.0" y="380.0">asteroids.LiveList</node> - <node x="351.0" y="380.0">asteroids.Game</node> - <node x="0.0" y="380.0">asteroids.Constants</node> - <node x="72.25" y="229.0">asteroids.Controller</node> - <node x="119.0" y="307.0">asteroids.RotateAndShoot</node> - <node x="255.74999999999997" y="0.0">asteroids.PolyContains</node> - <node x="251.99999999999997" y="78.0">asteroids.Column</node> - <node x="0.0" y="307.0">asteroids.KeyController</node> - <node x="83.99999999999997" y="78.0">asteroids.Ship</node> - <node x="105.0" y="453.0">asteroids.View</node> - <node x="106.49999999999997" y="0.0">asteroids.GameObject</node> - <node x="157.99999999999997" y="78.0">asteroids.Asteroid</node> - <node x="242.0" y="380.0">asteroids.Action</node> - <node x="278.0" y="229.0">asteroids.LiveListBackup</node> - <node x="426.0" y="229.0">asteroids.GameState</node> - <node x="0.0" y="453.0">asteroids.State</node> - </nodes> - <notes /> - <edges> - <edge source="asteroids.Ship" target="asteroids.GameObject"> - <point x="0.0" y="-14.0" /> - <point x="110.99999999999997" y="58.0" /> - <point x="141.37499999999997" y="58.0" /> - <point x="-11.625" y="14.0" /> - </edge> - <edge source="asteroids.Column" target="asteroids.PolyContains"> - <point x="17.25" y="-14.0" /> - <point x="0.0" y="14.0" /> - </edge> - <edge source="asteroids.LissajousAsteroid" target="asteroids.Asteroid"> - <point x="0.0" y="-14.0" /> - <point x="0.0" y="14.0" /> - </edge> - <edge source="asteroids.Missile" target="asteroids.GameObject"> - <point x="0.0" y="-14.0" /> - <point x="32.0" y="48.0" /> - <point x="118.12499999999997" y="48.0" /> - <point x="-34.875" y="14.0" /> - </edge> - <edge source="asteroids.Column" target="asteroids.GameObject"> - <point x="-17.25" y="-14.0" /> - <point x="269.25" y="48.0" /> - <point x="187.87499999999997" y="48.0" /> - <point x="34.875" y="14.0" /> - </edge> - <edge source="asteroids.KeyController" target="asteroids.Controller"> - <point x="0.0" y="-14.0" /> - <point x="49.5" y="282.0" /> - <point x="92.5" y="282.0" /> - <point x="-20.25" y="14.0" /> - </edge> - <edge source="asteroids.Asteroid" target="asteroids.GameObject"> - <point x="0.0" y="-14.0" /> - <point x="194.99999999999997" y="58.0" /> - <point x="164.62499999999997" y="58.0" /> - <point x="11.625" y="14.0" /> - </edge> - <edge source="asteroids.RotateAndShoot" target="asteroids.Controller"> - <point x="0.0" y="-14.0" /> - <point x="176.0" y="282.0" /> - <point x="133.0" y="282.0" /> - <point x="20.25" y="14.0" /> - </edge> - </edges> - <settings layout="Hierarchic Group" zoom="1.3000000000000003" x="256.0" y="241.0" /> - <SelectedNodes> - <node>asteroids.GameObject</node> - </SelectedNodes> - <Categories /> - <SCOPE>All</SCOPE> - <VISIBILITY>private</VISIBILITY> - </state> - </provider> - </entry> - </file> - <file leaf-file-name="LiveList.java" pinned="false" current-in-tab="false"> - <entry file="file://$PROJECT_DIR$/src/asteroids/LiveList.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="315" max-vertical-offset="2460"> - <caret line="65" column="0" selection-start-line="65" selection-start-column="0" selection-end-line="65" selection-end-column="0" /> - <folding /> - </state> - </provider> - </entry> - </file> - <file leaf-file-name="ArrayListTest.java" pinned="false" current-in-tab="false"> - <entry file="file://$PROJECT_DIR$/src/test/ArrayListTest.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="450" max-vertical-offset="735"> - <caret line="30" column="46" selection-start-line="30" selection-start-column="46" selection-end-line="30" selection-end-column="46" /> - <folding /> - </state> - </provider> - </entry> - </file> - <file leaf-file-name="Missile.java" pinned="false" current-in-tab="false"> - <entry file="file://$PROJECT_DIR$/src/asteroids/Missile.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="150" max-vertical-offset="675"> - <caret line="14" column="18" selection-start-line="14" selection-start-column="18" selection-end-line="14" selection-end-column="18" /> - <folding /> - </state> - </provider> - </entry> - </file> - <file leaf-file-name="Ship.java" pinned="false" current-in-tab="false"> - <entry file="file://$PROJECT_DIR$/src/asteroids/Ship.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="690" max-vertical-offset="2280"> - <caret line="25" column="29" selection-start-line="25" selection-start-column="29" selection-end-line="25" selection-end-column="29" /> - <folding /> - </state> - </provider> - </entry> - </file> - </leaf> - </component> - <component name="FindManager"> - <FindUsagesManager> - <setting name="OPEN_NEW_TAB" value="false" /> - </FindUsagesManager> - </component> - <component name="IdeDocumentHistory"> - <option name="CHANGED_PATHS"> - <list> - <option value="$PROJECT_DIR$/src/asteroids/Ship.java" /> - <option value="$PROJECT_DIR$/src/asteroids/Game.java" /> - </list> - </option> - </component> - <component name="JsGulpfileManager"> - <detection-done>true</detection-done> - </component> - <component name="ModuleEditorState"> - <option name="LAST_EDITED_MODULE_NAME" /> - <option name="LAST_EDITED_TAB_NAME" /> - </component> - <component name="ProjectFrameBounds"> - <option name="y" value="23" /> - <option name="width" value="800" /> - <option name="height" value="548" /> - </component> - <component name="ProjectLevelVcsManager" settingsEditedManually="false"> - <OptionsSetting value="true" id="Add" /> - <OptionsSetting value="true" id="Remove" /> - <OptionsSetting value="true" id="Checkout" /> - <OptionsSetting value="true" id="Update" /> - <OptionsSetting value="true" id="Status" /> - <OptionsSetting value="true" id="Edit" /> - <OptionsSetting value="true" id="Undo Check Out" /> - <OptionsSetting value="true" id="Get Latest Version" /> - <ConfirmationsSetting value="0" id="Add" /> - <ConfirmationsSetting value="0" id="Remove" /> - </component> - <component name="ProjectReloadState"> - <option name="STATE" value="0" /> - </component> - <component name="ProjectView"> - <navigator currentView="ProjectPane" proportions="" version="1"> - <flattenPackages /> - <showMembers /> - <showModules /> - <showLibraryContents /> - <hideEmptyPackages /> - <abbreviatePackageNames /> - <autoscrollToSource /> - <autoscrollFromSource /> - <sortByType /> - </navigator> - <panes> - <pane id="PackagesPane" /> - <pane id="Scope" /> - <pane id="ProjectPane"> - <subPane> - <PATH> - <PATH_ELEMENT> - <option name="myItemId" value="SimpleAsteroids" /> - <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" /> - </PATH_ELEMENT> - </PATH> - <PATH> - <PATH_ELEMENT> - <option name="myItemId" value="SimpleAsteroids" /> - <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" /> - </PATH_ELEMENT> - <PATH_ELEMENT> - <option name="myItemId" value="SimpleAsteroids" /> - <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> - </PATH_ELEMENT> - </PATH> - <PATH> - <PATH_ELEMENT> - <option name="myItemId" value="SimpleAsteroids" /> - <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" /> - </PATH_ELEMENT> - <PATH_ELEMENT> - <option name="myItemId" value="SimpleAsteroids" /> - <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> - </PATH_ELEMENT> - <PATH_ELEMENT> - <option name="myItemId" value="src" /> - <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> - </PATH_ELEMENT> - </PATH> - <PATH> - <PATH_ELEMENT> - <option name="myItemId" value="SimpleAsteroids" /> - <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" /> - </PATH_ELEMENT> - <PATH_ELEMENT> - <option name="myItemId" value="SimpleAsteroids" /> - <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> - </PATH_ELEMENT> - <PATH_ELEMENT> - <option name="myItemId" value="src" /> - <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> - </PATH_ELEMENT> - <PATH_ELEMENT> - <option name="myItemId" value="asteroids" /> - <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> - </PATH_ELEMENT> - </PATH> - </subPane> - </pane> - <pane id="Favorites" /> - </panes> - </component> - <component name="PropertiesComponent"> - <property name="GoToFile.includeJavaFiles" value="false" /> - <property name="OverrideImplement.combined" value="true" /> - <property name="GoToClass.toSaveIncludeLibraries" value="false" /> - <property name="recentsLimit" value="5" /> - <property name="MemberChooser.sorted" value="false" /> - <property name="last_opened_file_path" value="$PROJECT_DIR$" /> - <property name="MemberChooser.showClasses" value="true" /> - <property name="GoToClass.includeLibraries" value="false" /> - <property name="dynamic.classpath" value="false" /> - <property name="MemberChooser.copyJavadoc" value="false" /> - <property name="WebServerToolWindowFactoryState" value="false" /> - <property name="OverrideImplement.overriding.sorted" value="false" /> - <property name="project.structure.last.edited" value="Project" /> - <property name="project.structure.proportion" value="0.0" /> - <property name="project.structure.side.proportion" value="0.0" /> - </component> - <component name="RecentsManager"> - <key name="CopyClassDialog.RECENTS_KEY"> - <recent name="asteroids" /> - <recent name="trackgen" /> - </key> - </component> - <component name="RunManager" selected="Application.Game"> - <configuration default="false" name="Game" type="Application" factoryName="Application" temporary="true"> - <extension name="coverage" enabled="false" merge="false" runner="idea" /> - <option name="MAIN_CLASS_NAME" value="asteroids.Game" /> - <option name="VM_PARAMETERS" /> - <option name="PROGRAM_PARAMETERS" /> - <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> - <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> - <option name="ALTERNATIVE_JRE_PATH" /> - <option name="ENABLE_SWING_INSPECTOR" value="false" /> - <option name="ENV_VARIABLES" /> - <option name="PASS_PARENT_ENVS" value="true" /> - <module name="SimpleAsteroids" /> - <envs /> - <RunnerSettings RunnerId="Debug"> - <option name="DEBUG_PORT" value="55114" /> - <option name="TRANSPORT" value="0" /> - <option name="LOCAL" value="true" /> - </RunnerSettings> - <RunnerSettings RunnerId="Run" /> - <ConfigurationWrapper RunnerId="Debug" /> - <ConfigurationWrapper RunnerId="Run" /> - <method /> - </configuration> - <configuration default="false" name="TrackTest" type="Application" factoryName="Application" temporary="true"> - <extension name="coverage" enabled="false" merge="false" runner="idea"> - <pattern> - <option name="PATTERN" value="trackgen.*" /> - <option name="ENABLED" value="true" /> - </pattern> - </extension> - <option name="MAIN_CLASS_NAME" value="trackgen.TrackTest" /> - <option name="VM_PARAMETERS" /> - <option name="PROGRAM_PARAMETERS" /> - <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> - <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> - <option name="ALTERNATIVE_JRE_PATH" /> - <option name="ENABLE_SWING_INSPECTOR" value="false" /> - <option name="ENV_VARIABLES" /> - <option name="PASS_PARENT_ENVS" value="true" /> - <module name="SimpleAsteroids" /> - <envs /> - <RunnerSettings RunnerId="Run" /> - <ConfigurationWrapper RunnerId="Run" /> - <method /> - </configuration> - <configuration default="false" name="LissajousTest" type="Application" factoryName="Application" temporary="true"> - <extension name="coverage" enabled="false" merge="false" runner="idea"> - <pattern> - <option name="PATTERN" value="trackgen.*" /> - <option name="ENABLED" value="true" /> - </pattern> - </extension> - <option name="MAIN_CLASS_NAME" value="trackgen.LissajousTest" /> - <option name="VM_PARAMETERS" /> - <option name="PROGRAM_PARAMETERS" /> - <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> - <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> - <option name="ALTERNATIVE_JRE_PATH" /> - <option name="ENABLE_SWING_INSPECTOR" value="false" /> - <option name="ENV_VARIABLES" /> - <option name="PASS_PARENT_ENVS" value="true" /> - <module name="SimpleAsteroids" /> - <envs /> - <RunnerSettings RunnerId="Run" /> - <ConfigurationWrapper RunnerId="Run" /> - <method /> - </configuration> - <configuration default="false" name="Calculator" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true"> - <extension name="coverage" enabled="false" merge="false" runner="idea" /> - <option name="MAIN_CLASS_NAME" value="test.Calculator" /> - <option name="VM_PARAMETERS" /> - <option name="PROGRAM_PARAMETERS" /> - <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> - <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> - <option name="ALTERNATIVE_JRE_PATH" /> - <option name="ENABLE_SWING_INSPECTOR" value="false" /> - <option name="ENV_VARIABLES" /> - <option name="PASS_PARENT_ENVS" value="true" /> - <module name="SimpleAsteroids" /> - <envs /> - <RunnerSettings RunnerId="Run" /> - <ConfigurationWrapper RunnerId="Run" /> - <method /> - </configuration> - <configuration default="false" name="ArrayListTest" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true"> - <extension name="coverage" enabled="false" merge="false" runner="idea" /> - <option name="MAIN_CLASS_NAME" value="test.ArrayListTest" /> - <option name="VM_PARAMETERS" /> - <option name="PROGRAM_PARAMETERS" /> - <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> - <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> - <option name="ALTERNATIVE_JRE_PATH" /> - <option name="ENABLE_SWING_INSPECTOR" value="false" /> - <option name="ENV_VARIABLES" /> - <option name="PASS_PARENT_ENVS" value="true" /> - <module name="SimpleAsteroids" /> - <envs /> - <RunnerSettings RunnerId="Run" /> - <ConfigurationWrapper RunnerId="Run" /> - <method /> - </configuration> - <configuration default="true" type="AndroidTestRunConfigurationType" factoryName="Android Tests"> - <module name="" /> - <option name="TESTING_TYPE" value="0" /> - <option name="INSTRUMENTATION_RUNNER_CLASS" value="" /> - <option name="METHOD_NAME" value="" /> - <option name="CLASS_NAME" value="" /> - <option name="PACKAGE_NAME" value="" /> - <option name="TARGET_SELECTION_MODE" value="EMULATOR" /> - <option name="USE_LAST_SELECTED_DEVICE" value="false" /> - <option name="PREFERRED_AVD" value="" /> - <option name="USE_COMMAND_LINE" value="true" /> - <option name="COMMAND_LINE" value="" /> - <option name="WIPE_USER_DATA" value="false" /> - <option name="DISABLE_BOOT_ANIMATION" value="false" /> - <option name="NETWORK_SPEED" value="full" /> - <option name="NETWORK_LATENCY" value="none" /> - <option name="CLEAR_LOGCAT" value="false" /> - <option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" /> - <option name="FILTER_LOGCAT_AUTOMATICALLY" value="true" /> - <method /> - </configuration> - <configuration default="true" type="Remote" factoryName="Remote"> - <option name="USE_SOCKET_TRANSPORT" value="true" /> - <option name="SERVER_MODE" value="false" /> - <option name="SHMEM_ADDRESS" value="javadebug" /> - <option name="HOST" value="localhost" /> - <option name="PORT" value="5005" /> - <method /> - </configuration> - <configuration default="true" type="JavascriptDebugType" factoryName="JavaScript Debug"> - <method /> - </configuration> - <configuration default="true" type="GradleRunConfiguration" factoryName="Gradle"> - <ExternalSystemSettings> - <option name="executionName" /> - <option name="externalProjectPath" /> - <option name="externalSystemIdString" value="GRADLE" /> - <option name="scriptParameters" /> - <option name="taskDescriptions"> - <list /> - </option> - <option name="taskNames"> - <list /> - </option> - <option name="vmOptions" /> - </ExternalSystemSettings> - <method /> - </configuration> - <configuration default="true" type="Applet" factoryName="Applet"> - <module name="" /> - <option name="MAIN_CLASS_NAME" /> - <option name="HTML_FILE_NAME" /> - <option name="HTML_USED" value="false" /> - <option name="WIDTH" value="400" /> - <option name="HEIGHT" value="300" /> - <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" /> - <option name="VM_PARAMETERS" /> - <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> - <option name="ALTERNATIVE_JRE_PATH" /> - <method /> - </configuration> - <configuration default="true" type="Application" factoryName="Application"> - <extension name="coverage" enabled="false" merge="false" runner="idea" /> - <option name="MAIN_CLASS_NAME" /> - <option name="VM_PARAMETERS" /> - <option name="PROGRAM_PARAMETERS" /> - <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> - <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> - <option name="ALTERNATIVE_JRE_PATH" /> - <option name="ENABLE_SWING_INSPECTOR" value="false" /> - <option name="ENV_VARIABLES" /> - <option name="PASS_PARENT_ENVS" value="true" /> - <module name="" /> - <envs /> - <method /> - </configuration> - <configuration default="true" type="JUnit" factoryName="JUnit"> - <extension name="coverage" enabled="false" merge="false" runner="idea" /> - <module name="" /> - <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> - <option name="ALTERNATIVE_JRE_PATH" /> - <option name="PACKAGE_NAME" /> - <option name="MAIN_CLASS_NAME" /> - <option name="METHOD_NAME" /> - <option name="TEST_OBJECT" value="class" /> - <option name="VM_PARAMETERS" /> - <option name="PARAMETERS" /> - <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> - <option name="ENV_VARIABLES" /> - <option name="PASS_PARENT_ENVS" value="true" /> - <option name="TEST_SEARCH_SCOPE"> - <value defaultName="moduleWithDependencies" /> - </option> - <envs /> - <patterns /> - <method /> - </configuration> - <configuration default="true" type="AndroidRunConfigurationType" factoryName="Android Application"> - <module name="" /> - <option name="ACTIVITY_CLASS" value="" /> - <option name="MODE" value="default_activity" /> - <option name="DEPLOY" value="true" /> - <option name="ARTIFACT_NAME" value="" /> - <option name="TARGET_SELECTION_MODE" value="EMULATOR" /> - <option name="USE_LAST_SELECTED_DEVICE" value="false" /> - <option name="PREFERRED_AVD" value="" /> - <option name="USE_COMMAND_LINE" value="true" /> - <option name="COMMAND_LINE" value="" /> - <option name="WIPE_USER_DATA" value="false" /> - <option name="DISABLE_BOOT_ANIMATION" value="false" /> - <option name="NETWORK_SPEED" value="full" /> - <option name="NETWORK_LATENCY" value="none" /> - <option name="CLEAR_LOGCAT" value="false" /> - <option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" /> - <option name="FILTER_LOGCAT_AUTOMATICALLY" value="true" /> - <method /> - </configuration> - <list size="5"> - <item index="0" class="java.lang.String" itemvalue="Application.Game" /> - <item index="1" class="java.lang.String" itemvalue="Application.TrackTest" /> - <item index="2" class="java.lang.String" itemvalue="Application.LissajousTest" /> - <item index="3" class="java.lang.String" itemvalue="Application.Calculator" /> - <item index="4" class="java.lang.String" itemvalue="Application.ArrayListTest" /> - </list> - <recent_temporary> - <list size="5"> - <item index="0" class="java.lang.String" itemvalue="Application.Game" /> - <item index="1" class="java.lang.String" itemvalue="Application.ArrayListTest" /> - <item index="2" class="java.lang.String" itemvalue="Application.TrackTest" /> - <item index="3" class="java.lang.String" itemvalue="Application.Calculator" /> - <item index="4" class="java.lang.String" itemvalue="Application.LissajousTest" /> - </list> - </recent_temporary> - <configuration name="<template>" type="WebApp" default="true" selected="false"> - <Host>localhost</Host> - <Port>5050</Port> - </configuration> - </component> - <component name="ShelveChangesManager" show_recycled="false" /> - <component name="SliceManager"> - <option name="analysisUIOptions"> - <AnalysisUIOptions /> - </option> - </component> - <component name="SvnConfiguration"> - <configuration>C:\Users\sml\AppData\Roaming\Subversion</configuration> - </component> - <component name="TaskManager"> - <task active="true" id="Default" summary="Default task"> - <changelist id="ebda1064-4e7d-40c4-8a89-ad3f47ecbaf1" name="Default" comment="" /> - <created>1324900484395</created> - <option name="number" value="Default" /> - <updated>1324900484395</updated> - <workItem from="1433002472767" duration="19536000" /> - <workItem from="1433330738007" duration="12181000" /> - <workItem from="1433701886377" duration="1612000" /> - <workItem from="1433761387314" duration="799000" /> - </task> - <servers /> - </component> - <component name="TimeTrackingManager"> - <option name="totallyTimeSpent" value="34128000" /> - </component> - <component name="ToolWindowManager"> - <frame x="0" y="23" width="800" height="548" extended-state="0" /> - <editor active="true" /> - <layout> - <window_info id="Palette	" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> - <window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> - <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> - <window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> - <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> - <window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> - <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> - <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> - <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.399137" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> - <window_info id="IDEtalk Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> - <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" /> - <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" /> - <window_info id="IDEtalk" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> - <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> - <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.19085173" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> - <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> - <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="true" content_ui="tabs" /> - <window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> - <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> - <window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> - <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.35125" sideWeight="0.12307692" order="0" side_tool="false" content_ui="combo" /> - <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.35699373" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> - <window_info id="Phing Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> - <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" /> - <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" /> - <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> - <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.7418655" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> - <window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> - <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" /> - </layout> - </component> - <component name="Vcs.Log.UiProperties"> - <option name="RECENTLY_FILTERED_USER_GROUPS"> - <collection /> - </option> - <option name="RECENTLY_FILTERED_BRANCH_GROUPS"> - <collection /> - </option> - </component> - <component name="VcsContentAnnotationSettings"> - <option name="myLimit" value="2678400000" /> - </component> - <component name="VcsManagerConfiguration"> - <option name="myTodoPanelSettings"> - <TodoPanelSettings /> - </option> - <option name="CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND" value="true" /> - <option name="MAKE_NEW_CHANGELIST_ACTIVE" value="true" /> - </component> - <component name="XDebuggerManager"> - <breakpoint-manager /> - <watches-manager /> - </component> - <component name="antWorkspaceConfiguration"> - <option name="IS_AUTOSCROLL_TO_SOURCE" value="false" /> - <option name="FILTER_TARGETS" value="false" /> - </component> - <component name="editorHistoryManager"> - <entry file="file://$PROJECT_DIR$/src/asteroids/LissajousAsteroid.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="550" max-vertical-offset="1012"> - <caret line="25" column="11" selection-start-line="25" selection-start-column="11" selection-end-line="25" selection-end-column="11" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/Missile.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="286" max-vertical-offset="1166"> - <caret line="13" column="11" selection-start-line="13" selection-start-column="11" selection-end-line="13" selection-end-column="11" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/Ship.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="2618" max-vertical-offset="3630"> - <caret line="119" column="15" selection-start-line="119" selection-start-column="15" selection-end-line="119" selection-end-column="15" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/Game.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="557" max-vertical-offset="1200"> - <caret line="55" column="39" selection-start-line="55" selection-start-column="39" selection-end-line="55" selection-end-column="39" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/GameObject.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="360" max-vertical-offset="525"> - <caret line="30" column="24" selection-start-line="30" selection-start-column="24" selection-end-line="30" selection-end-column="24" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/GameState.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="3525"> - <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/Asteroid.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="105" max-vertical-offset="1215"> - <caret line="14" column="42" selection-start-line="14" selection-start-column="42" selection-end-line="14" selection-end-column="42" /> - <folding> - <element signature="imports" expanded="true" /> - <element signature="e#782#783#0" expanded="true" /> - <element signature="e#809#810#0" expanded="true" /> - </folding> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/Column.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="1470" max-vertical-offset="1605"> - <caret line="98" column="83" selection-start-line="98" selection-start-column="83" selection-end-line="98" selection-end-column="83" /> - <folding> - <element signature="imports" expanded="true" /> - <element signature="e#2500#2501#0" expanded="true" /> - <element signature="e#2591#2592#0" expanded="true" /> - </folding> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/LiveList.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="330" max-vertical-offset="2235"> - <caret line="26" column="70" selection-start-line="26" selection-start-column="70" selection-end-line="26" selection-end-column="70" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/PolyContains.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="120" max-vertical-offset="240"> - <caret line="8" column="33" selection-start-line="8" selection-start-column="33" selection-end-line="8" selection-end-column="33" /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/View.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="510" max-vertical-offset="1275"> - <caret line="43" column="11" selection-start-line="43" selection-start-column="11" selection-end-line="43" selection-end-column="11" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/trackgen/TrackTest.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="60" max-vertical-offset="825"> - <caret line="8" column="13" selection-start-line="8" selection-start-column="13" selection-end-line="8" selection-end-column="13" /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/Ship.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="315" max-vertical-offset="2160"> - <caret line="47" column="20" selection-start-line="47" selection-start-column="20" selection-end-line="47" selection-end-column="20" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/Missile.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="135" max-vertical-offset="675"> - <caret line="13" column="11" selection-start-line="13" selection-start-column="11" selection-end-line="13" selection-end-column="11" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/GameObject.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="450"> - <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/State.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="75" max-vertical-offset="165"> - <caret line="5" column="0" selection-start-line="5" selection-start-column="0" selection-end-line="5" selection-end-column="0" /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/Game.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="375" max-vertical-offset="825"> - <caret line="27" column="35" selection-start-line="27" selection-start-column="35" selection-end-line="27" selection-end-column="35" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/../../src/DataTest/DataTest.iml"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="100"> - <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/LiveList.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="1965" max-vertical-offset="2055"> - <caret line="137" column="0" selection-start-line="137" selection-start-column="0" selection-end-line="137" selection-end-column="0" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/Constants.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="180" max-vertical-offset="780"> - <caret line="13" column="20" selection-start-line="13" selection-start-column="20" selection-end-line="13" selection-end-column="20" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/trackgen/TrackTest.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="735" max-vertical-offset="825"> - <caret line="57" column="0" selection-start-line="57" selection-start-column="0" selection-end-line="57" selection-end-column="0" /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/trackgen/LissajousTest.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="75" max-vertical-offset="900"> - <caret line="6" column="19" selection-start-line="6" selection-start-column="19" selection-end-line="6" selection-end-column="19" /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/utilities/JEasyFrame.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="90" max-vertical-offset="345"> - <caret line="8" column="11" selection-start-line="8" selection-start-column="11" selection-end-line="8" selection-end-column="11" /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/Constants.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="0"> - <caret line="13" column="20" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/test/Test.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="0"> - <caret line="10" column="50" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/utilities/JEasyFrame.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="90" max-vertical-offset="345"> - <caret line="8" column="11" selection-start-line="8" selection-start-column="11" selection-end-line="8" selection-end-column="11" /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/State.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="75" max-vertical-offset="165"> - <caret line="5" column="0" selection-start-line="5" selection-start-column="0" selection-end-line="5" selection-end-column="0" /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/../../src/DataTest/DataTest.iml"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.30326593" vertical-offset="0" max-vertical-offset="643"> - <caret line="13" column="18" selection-start-line="13" selection-start-column="18" selection-end-line="13" selection-end-column="18" /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/Constants.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="122" max-vertical-offset="825"> - <caret line="21" column="21" selection-start-line="21" selection-start-column="21" selection-end-line="21" selection-end-column="21" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/math/Vector2d.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="2805"> - <caret line="3" column="13" selection-start-line="3" selection-start-column="13" selection-end-line="3" selection-end-column="13" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/RotateAndShoot.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="510"> - <caret line="16" column="25" selection-start-line="16" selection-start-column="25" selection-end-line="16" selection-end-column="25" /> - <folding> - <element signature="e#183#184#0" expanded="false" /> - <element signature="e#220#221#0" expanded="false" /> - </folding> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/PolyContains.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="240"> - <caret line="8" column="33" selection-start-line="8" selection-start-column="33" selection-end-line="8" selection-end-column="33" /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/test/Calculator.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.64356434" vertical-offset="0" max-vertical-offset="606"> - <caret line="26" column="0" selection-start-line="26" selection-start-column="0" selection-end-line="26" selection-end-column="0" /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/View.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="330" max-vertical-offset="1305"> - <caret line="48" column="15" selection-start-line="48" selection-start-column="15" selection-end-line="48" selection-end-column="15" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/trackgen/LissajousTest.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="-0.2992126" vertical-offset="265" max-vertical-offset="900"> - <caret line="6" column="19" selection-start-line="6" selection-start-column="19" selection-end-line="6" selection-end-column="19" /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/KeyController.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="-0.3464567" vertical-offset="370" max-vertical-offset="1005"> - <caret line="12" column="0" selection-start-line="12" selection-start-column="0" selection-end-line="12" selection-end-column="0" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/trackgen/TrackTest.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="190" max-vertical-offset="825"> - <caret line="55" column="0" selection-start-line="55" selection-start-column="0" selection-end-line="55" selection-end-column="0" /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/Column.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="240" max-vertical-offset="1515"> - <caret line="31" column="0" selection-start-line="30" selection-start-column="0" selection-end-line="31" selection-end-column="0" /> - <folding> - <element signature="imports" expanded="true" /> - <element signature="e#2500#2501#0" expanded="true" /> - <element signature="e#2591#2592#0" expanded="true" /> - </folding> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/Asteroid.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.25984251" vertical-offset="0" max-vertical-offset="1350"> - <caret line="11" column="0" selection-start-line="11" selection-start-column="0" selection-end-line="11" selection-end-column="0" /> - <folding> - <element signature="imports" expanded="true" /> - <element signature="e#782#783#0" expanded="true" /> - <element signature="e#809#810#0" expanded="true" /> - </folding> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/LiveListBackup.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="3718"> - <caret line="17" column="26" selection-start-line="17" selection-start-column="26" selection-end-line="17" selection-end-column="26" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/LissajousAsteroid.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.4174107" vertical-offset="0" max-vertical-offset="896"> - <caret line="25" column="11" selection-start-line="25" selection-start-column="11" selection-end-line="25" selection-end-column="11" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/Controller.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="195"> - <caret line="3" column="18" selection-start-line="3" selection-start-column="18" selection-end-line="3" selection-end-column="18" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/test/ArrayListTest.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="116" max-vertical-offset="1078"> - <caret line="30" column="46" selection-start-line="30" selection-start-column="46" selection-end-line="30" selection-end-column="46" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/Action.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="814"> - <caret line="28" column="53" selection-start-line="28" selection-start-column="53" selection-end-line="28" selection-end-column="53" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/Missile.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="6" max-vertical-offset="990"> - <caret line="14" column="18" selection-start-line="14" selection-start-column="18" selection-end-line="14" selection-end-column="18" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/GameObject.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="525"> - <caret line="35" column="0" selection-start-line="35" selection-start-column="0" selection-end-line="35" selection-end-column="0" /> - <folding /> - </state> - </provider> - </entry> - <entry file="uml://JAVA/asteroids"> - <provider selected="true" editor-type-id="UmlEditorProvider"> - <state> - <ID>JAVA</ID> - <OriginalElement>asteroids</OriginalElement> - <nodes> - <node x="0.0" y="78.0">asteroids.Missile</node> - <node x="136.49999999999997" y="156.0">asteroids.LissajousAsteroid</node> - <node x="128.0" y="380.0">asteroids.LiveList</node> - <node x="351.0" y="380.0">asteroids.Game</node> - <node x="0.0" y="380.0">asteroids.Constants</node> - <node x="72.25" y="229.0">asteroids.Controller</node> - <node x="119.0" y="307.0">asteroids.RotateAndShoot</node> - <node x="255.74999999999997" y="0.0">asteroids.PolyContains</node> - <node x="251.99999999999997" y="78.0">asteroids.Column</node> - <node x="0.0" y="307.0">asteroids.KeyController</node> - <node x="83.99999999999997" y="78.0">asteroids.Ship</node> - <node x="105.0" y="453.0">asteroids.View</node> - <node x="106.49999999999997" y="0.0">asteroids.GameObject</node> - <node x="157.99999999999997" y="78.0">asteroids.Asteroid</node> - <node x="242.0" y="380.0">asteroids.Action</node> - <node x="278.0" y="229.0">asteroids.LiveListBackup</node> - <node x="426.0" y="229.0">asteroids.GameState</node> - <node x="0.0" y="453.0">asteroids.State</node> - </nodes> - <notes /> - <edges> - <edge source="asteroids.Ship" target="asteroids.GameObject"> - <point x="0.0" y="-14.0" /> - <point x="110.99999999999997" y="58.0" /> - <point x="141.37499999999997" y="58.0" /> - <point x="-11.625" y="14.0" /> - </edge> - <edge source="asteroids.Column" target="asteroids.PolyContains"> - <point x="17.25" y="-14.0" /> - <point x="0.0" y="14.0" /> - </edge> - <edge source="asteroids.LissajousAsteroid" target="asteroids.Asteroid"> - <point x="0.0" y="-14.0" /> - <point x="0.0" y="14.0" /> - </edge> - <edge source="asteroids.Missile" target="asteroids.GameObject"> - <point x="0.0" y="-14.0" /> - <point x="32.0" y="48.0" /> - <point x="118.12499999999997" y="48.0" /> - <point x="-34.875" y="14.0" /> - </edge> - <edge source="asteroids.Column" target="asteroids.GameObject"> - <point x="-17.25" y="-14.0" /> - <point x="269.25" y="48.0" /> - <point x="187.87499999999997" y="48.0" /> - <point x="34.875" y="14.0" /> - </edge> - <edge source="asteroids.KeyController" target="asteroids.Controller"> - <point x="0.0" y="-14.0" /> - <point x="49.5" y="282.0" /> - <point x="92.5" y="282.0" /> - <point x="-20.25" y="14.0" /> - </edge> - <edge source="asteroids.Asteroid" target="asteroids.GameObject"> - <point x="0.0" y="-14.0" /> - <point x="194.99999999999997" y="58.0" /> - <point x="164.62499999999997" y="58.0" /> - <point x="11.625" y="14.0" /> - </edge> - <edge source="asteroids.RotateAndShoot" target="asteroids.Controller"> - <point x="0.0" y="-14.0" /> - <point x="176.0" y="282.0" /> - <point x="133.0" y="282.0" /> - <point x="20.25" y="14.0" /> - </edge> - </edges> - <settings layout="Hierarchic Group" zoom="1.3000000000000003" x="256.0" y="241.0" /> - <SelectedNodes> - <node>asteroids.GameObject</node> - </SelectedNodes> - <Categories /> - <SCOPE>All</SCOPE> - <VISIBILITY>private</VISIBILITY> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/GameState.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="1478" max-vertical-offset="3555"> - <caret line="24" column="5" selection-start-line="24" selection-start-column="5" selection-end-line="24" selection-end-column="5" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/LiveList.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="1276" max-vertical-offset="3608"> - <caret line="65" column="0" selection-start-line="65" selection-start-column="0" selection-end-line="65" selection-end-column="0" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/Ship.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0" vertical-offset="690" max-vertical-offset="2280"> - <caret line="25" column="29" selection-start-line="25" selection-start-column="29" selection-end-line="25" selection-end-column="29" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/src/asteroids/Game.java"> - <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.75" vertical-offset="585" max-vertical-offset="1485"> - <caret line="56" column="5" selection-start-line="56" selection-start-column="5" selection-end-line="56" selection-end-column="5" /> - <folding /> - </state> - </provider> - </entry> - </component> - <component name="masterDetails"> - <states> - <state key="ArtifactsStructureConfigurable.UI"> - <settings> - <artifact-editor /> - <splitter-proportions> - <option name="proportions"> - <list> - <option value="0.2" /> - </list> - </option> - </splitter-proportions> - </settings> - </state> - <state key="FacetStructureConfigurable.UI"> - <settings> - <last-edited>No facets are configured</last-edited> - <splitter-proportions> - <option name="proportions"> - <list> - <option value="0.2" /> - </list> - </option> - </splitter-proportions> - </settings> - </state> - <state key="GlobalLibrariesConfigurable.UI"> - <settings> - <splitter-proportions> - <option name="proportions"> - <list> - <option value="0.2" /> - </list> - </option> - </splitter-proportions> - </settings> - </state> - <state key="JdkListConfigurable.UI"> - <settings> - <last-edited>1.8</last-edited> - <splitter-proportions> - <option name="proportions"> - <list> - <option value="0.2" /> - </list> - </option> - </splitter-proportions> - </settings> - </state> - <state key="ModuleStructureConfigurable.UI"> - <settings> - <last-edited>SimpleAsteroids</last-edited> - <splitter-proportions> - <option name="proportions"> - <list> - <option value="0.2" /> - </list> - </option> - </splitter-proportions> - </settings> - </state> - <state key="ProjectJDKs.UI"> - <settings> - <last-edited>1.6</last-edited> - <splitter-proportions> - <option name="proportions"> - <list> - <option value="0.2" /> - </list> - </option> - </splitter-proportions> - </settings> - </state> - <state key="ProjectLibrariesConfigurable.UI"> - <settings> - <splitter-proportions> - <option name="proportions"> - <list> - <option value="0.2" /> - </list> - </option> - </splitter-proportions> - </settings> - </state> - </states> - </component> -</project> \ No newline at end of file diff --git a/src/asteroids/Game.java b/src/asteroids/Game.java index 7ff7081d1382777db9d0d66434bd7f0d46c39e9e..25b59c142caffffb5f662d1de14713dc59f5750c 100644 --- a/src/asteroids/Game.java +++ b/src/asteroids/Game.java @@ -7,20 +7,15 @@ import static asteroids.Constants.*; public class Game { - // todo: Implement and Test Saucer - // todo: a high-score facility - // todo: experiment with steering mechanisms - // todo: make a string centering mechanism - View view; - GameState gameState; - JEasyFrame frame; - Controller controller; + private View view; + private GameState gameState; + private JEasyFrame frame; + private Controller controller; static boolean copyTest = false; public static void main(String[] args) { - System.out.println(font); boolean visible = true; int nTicks = 10000; Game game = new Game(visible); diff --git a/src/battle/BattleController.java b/src/battle/BattleController.java index edc375ab893ca813d13e1c525f2e29a901c98bc5..158b96f1a955c07d5f2d876540194917e1ccde29 100644 --- a/src/battle/BattleController.java +++ b/src/battle/BattleController.java @@ -8,6 +8,6 @@ import asteroids.Action; public interface BattleController { - Action getAction(SimpleBattle gameStateCopy, int playerId); + Action getAction(SimpleBattle gameStateCopy); } diff --git a/src/battle/BattleTest.java b/src/battle/BattleTest.java index c3c652b74bb28e72a5081dd6b0001c97b1f39072..18ee9861c5dbc75071efb636c6fcec5b74144889 100644 --- a/src/battle/BattleTest.java +++ b/src/battle/BattleTest.java @@ -4,6 +4,7 @@ import battle.controllers.EmptyController; import battle.controllers.FireForwardController; import battle.controllers.Human.WASDController; import battle.controllers.Naz.Naz_AI; +import battle.controllers.mmmcts.MMMCTS; import battle.controllers.webpigeon.StaticEvolver; import battle.controllers.webpigeon.StupidGAWrapper; @@ -11,15 +12,13 @@ import battle.controllers.webpigeon.StupidGAWrapper; * Created by simon lucas on 10/06/15. */ public class BattleTest { - BattleView view; public static void main(String[] args) { SimpleBattle battle = new SimpleBattle(); - BattleController player1 = new Naz_AI(); - BattleController player2 = new StupidGAWrapper(new double[]{2.7631328506251744, 0.746687716615824, 0.11574670823251669}); - battle.playGame(player1, player2); + BattleController player1 = new MMMCTS(); + battle.playGame(player1); } } diff --git a/src/battle/BattleView.java b/src/battle/BattleView.java index 345e9f41ff143ee1aff353fbcccdc8771c0e4dcb..52533368a584f69a0e6734b5761e3664eb37cc3a 100644 --- a/src/battle/BattleView.java +++ b/src/battle/BattleView.java @@ -34,10 +34,6 @@ public class BattleView extends JComponent { } public void paintComponent(Graphics gx) { - if (game.s1 == null || game.s2 == null) { - return; - } - Graphics2D g = (Graphics2D) gx; AffineTransform at = g.getTransform(); g.translate((1 - viewScale) * width / 2, (1-viewScale)*height / 2); @@ -69,18 +65,15 @@ public class BattleView extends JComponent { // FontMetrics fm = font. //String str = game.stats.get(0) + " " + game.stats.get(1) + " " + game.currentTick; - SimpleBattle.PlayerStats p1Stats = game.stats.get(0); - SimpleBattle.PlayerStats p2Stats = game.stats.get(1); - String strScores = "Score: " + p1Stats.getPoints() + " | " + p2Stats.getPoints(); - String strMissiles = "Missiles: " + p1Stats.getMissilesFired() + " | " + p2Stats.getMissilesFired(); - String strTicks = "Ticks: " + game.currentTick; - String p1 = "P1 Green " + game.p1.getClass().getSimpleName(); - String p2 = "P2 Blue " + game.p2.getClass().getSimpleName(); + SimpleBattle.PlayerStats p1Stats = game.stats; + String strScores = "Score: " + p1Stats.getPoints(); + String strMissiles = "Missiles: " + p1Stats.getMissilesFired(); + String strTicks = "Ticks: " + game.getTicks(); + String p1 = "P1 Green " + game.getP1().getClass().getSimpleName(); g.drawString(strScores, 10, 20); g.drawString(strMissiles, 10, 50); g.drawString(strTicks, 10, 80); g.drawString(p1, 10, 110); - g.drawString(p2, 10, 140); } diff --git a/src/battle/DaniBattleTest.java b/src/battle/DaniBattleTest.java deleted file mode 100644 index 8ba50834c5c974ba7459bbc01d319c11d8b95bfd..0000000000000000000000000000000000000000 --- a/src/battle/DaniBattleTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package battle; - -import javax.swing.*; - -import asteroids.Action; -import battle.controllers.EmptyController; -import battle.controllers.FireController; -import battle.controllers.RotateAndShoot; -import battle.controllers.Dani.DaniController; -import battle.controllers.Memo.MemoController1; -import battle.controllers.Memo.MemoControllerRandom; -import battle.controllers.mmmcts.MMMCTS; -import math.Vector2d; -import utilities.JEasyFrame; - -/** - * Created by simon lucas on 10/06/15. - */ -public class DaniBattleTest { - BattleView view; - - public static void main(String[] args) { - - SimpleBattle battle = new SimpleBattle(); - - BattleController fire1 = new DaniController(); - //BattleController fire2 = new MemoControllerRandom(); - BattleController fire2 = new MMMCTS(); - //BattleController fire2 = new MemoController1(); - - battle.playGame(fire1, fire2); - } - -} diff --git a/src/battle/MemoBattleTest.java b/src/battle/MemoBattleTest.java deleted file mode 100644 index cc71bcfdb6bff19d7de92cec053825bbed45272a..0000000000000000000000000000000000000000 --- a/src/battle/MemoBattleTest.java +++ /dev/null @@ -1,23 +0,0 @@ -package battle; - -import battle.controllers.Memo.MemoControllerRandom; -import battle.controllers.Memo.MemoController1; -import battle.controllers.mmmcts.MMMCTS; -import battle.controllers.Human.WASDController; - -/** - * Created by simon lucas on 10/06/15. - */ -public class MemoBattleTest { - BattleView view; - - public static void main(String[] args) { - - SimpleBattle battle = new SimpleBattle(); - - BattleController player1 = new MemoController1(); - BattleController player2 = new MMMCTS(); - battle.playGame(player1, player2); - } - -} diff --git a/src/battle/SimpleBattle.java b/src/battle/SimpleBattle.java index 1d9c7a0fb3b38d6a40ae08e73adf23a29b1027a4..027e3c677bf4511badc1b5dbf9844a5a27be95af 100644 --- a/src/battle/SimpleBattle.java +++ b/src/battle/SimpleBattle.java @@ -7,6 +7,7 @@ import utilities.JEasyFrame; import java.awt.event.KeyListener; import java.util.ArrayList; import java.awt.*; +import java.util.List; import static asteroids.Constants.*; @@ -31,15 +32,13 @@ public class SimpleBattle { boolean visible = true; - ArrayList<BattleController> controllers; + List<GameObject> objects; + PlayerStats stats; - ArrayList<GameObject> objects; - ArrayList<PlayerStats> stats; - - NeuroShip s1, s2; - BattleController p1, p2; - BattleView view; - int currentTick; + private NeuroShip s1; + private BattleController p1; + private BattleView view; + private int currentTick; public SimpleBattle() { this(true); @@ -47,7 +46,6 @@ public class SimpleBattle { public SimpleBattle(boolean visible) { this.objects = new ArrayList<>(); - this.stats = new ArrayList<>(); this.visible = visible; if (visible) { @@ -60,22 +58,14 @@ public class SimpleBattle { return currentTick; } - public int playGame(BattleController p1, BattleController p2) { - this.p1 = p1; - this.p2 = p2; + public int playGame(BattleController player) { + this.p1 = player; reset(); - stats.add(new PlayerStats(0, 0)); - stats.add(new PlayerStats(0, 0)); + stats = new PlayerStats(0, 0); if (p1 instanceof KeyListener) { - view.addKeyListener((KeyListener)p1); - view.setFocusable(true); - view.requestFocus(); - } - - if (p2 instanceof KeyListener) { - view.addKeyListener((KeyListener)p2); + view.addKeyListener((KeyListener) p1); view.setFocusable(true); view.requestFocus(); } @@ -85,24 +75,18 @@ public class SimpleBattle { } if (p1 instanceof KeyListener) { - view.removeKeyListener((KeyListener)p1); - } - if (p2 instanceof KeyListener) { - view.removeKeyListener((KeyListener)p2); + view.removeKeyListener((KeyListener) p1); } return 0; } public void reset() { - stats.clear(); objects.clear(); s1 = buildShip(100, 250, 0); - s2 = buildShip(500, 250, 1); this.currentTick = 0; - stats.add(new PlayerStats(0, 0)); - stats.add(new PlayerStats(0, 0)); + stats = new PlayerStats(0, 0); } protected NeuroShip buildShip(int x, int y, int playerID) { @@ -110,35 +94,34 @@ public class SimpleBattle { Vector2d speed = new Vector2d(true); Vector2d direction = new Vector2d(1, 0, true); - return new NeuroShip(position, speed, direction, playerID ); + return new NeuroShip(position, speed, direction, playerID); } public void update() { // get the actions from each player // apply them to each player's ship, taking actions as necessary - Action a1 = p1.getAction(this.clone(), 0); - Action a2 = p2.getAction(this.clone(), 1); - update(a1, a2); + Action a1 = p1.getAction(this.clone()); + update(a1); + } + + public BattleController getP1() { + return p1; } - public void update(Action a1, Action a2) { + public void update(Action a1) { // now apply them to the ships s1.update(a1); - s2.update(a2); checkCollision(s1); - checkCollision(s2); // and fire any missiles as necessary - if (a1.shoot) fireMissile(s1.s, s1.d, 0); - if (a2.shoot) fireMissile(s2.s, s2.d, 1); + if (a1.shoot) fireMissile(s1.s, s1.d); wrap(s1); - wrap(s2); // here need to add the game objects ... - java.util.List<GameObject> killList = new ArrayList<GameObject>(); + List<GameObject> killList = new ArrayList<>(); for (GameObject object : objects) { object.update(); wrap(object); @@ -160,17 +143,16 @@ public class SimpleBattle { public SimpleBattle clone() { SimpleBattle state = new SimpleBattle(false); state.objects = copyObjects(); - state.stats = copyStats(); + state.stats = new PlayerStats(this.stats.nMissiles, this.stats.nPoints); state.currentTick = currentTick; state.visible = false; //stop MCTS people having all the games :p state.s1 = s1.copy(); - state.s2 = s2.copy(); return state; } - protected ArrayList<GameObject> copyObjects() { - ArrayList<GameObject> objectClone = new ArrayList<GameObject>(); + protected List<GameObject> copyObjects() { + List<GameObject> objectClone = new ArrayList<>(); for (GameObject object : objects) { objectClone.add(object.copy()); } @@ -178,14 +160,6 @@ public class SimpleBattle { return objectClone; } - protected ArrayList<PlayerStats> copyStats() { - ArrayList<PlayerStats> statsClone = new ArrayList<PlayerStats>(); - for (PlayerStats object : stats) { - statsClone.add(new PlayerStats(object.nMissiles, object.nPoints)); - } - - return statsClone; - } protected void checkCollision(GameObject actor) { // check with all other game objects @@ -200,9 +174,6 @@ public class SimpleBattle { for (GameObject ob : objects) { if (overlap(actor, ob)) { // the object is hit, and the actor is also - - int playerID = (actor == s1 ? 1 : 0); - PlayerStats stats = this.stats.get(playerID); stats.nPoints += pointsPerKill; ob.hit(); @@ -230,10 +201,9 @@ public class SimpleBattle { } } - protected void fireMissile(Vector2d s, Vector2d d, int playerId) { + protected void fireMissile(Vector2d s, Vector2d d) { // need all the usual missile firing code here - NeuroShip currentShip = playerId == 0 ? s1 : s2; - PlayerStats stats = this.stats.get(playerId); + NeuroShip currentShip = s1; if (stats.nMissiles < nMissiles) { Missile m = new Missile(s, new Vector2d(0, 0, true)); m.v.add(d, releaseVelocity); @@ -248,7 +218,7 @@ public class SimpleBattle { public void draw(Graphics2D g) { // for (Object ob : objects) - if (s1 == null || s2 == null) { + if (s1 == null) { return; } @@ -264,45 +234,25 @@ public class SimpleBattle { s1.draw(g); if (p1 instanceof RenderableBattleController) { - RenderableBattleController rbc = (RenderableBattleController)p1; + RenderableBattleController rbc = (RenderableBattleController) p1; rbc.render(g, s1.copy()); } - - s2.draw(g); - if (p2 instanceof RenderableBattleController) { - RenderableBattleController rbc = (RenderableBattleController)p2; - rbc.render(g, s2.copy()); - } } - public NeuroShip getShip(int playerID) { - assert playerID < 2; - assert playerID >= 0; - - if (playerID == 0) { - return s1.copy(); - } else { - return s2.copy(); - } + public NeuroShip getShip() { + return s1.copy(); } - public ArrayList<GameObject> getObjects() - { + public List<GameObject> getObjects() { return new ArrayList<>(objects); } - public int getPoints(int playerID) { - assert playerID < 2; - assert playerID >= 0; - - return stats.get(playerID).nPoints; + public int getPoints() { + return stats.nPoints; } - public int getMissilesLeft(int playerID) { - assert playerID < 2; - assert playerID >= 0; - - return stats.get(playerID).nMissiles - nMissiles; + public int getMissilesLeft() { + return stats.nMissiles - nMissiles; } private void wrap(GameObject ob) { @@ -314,7 +264,7 @@ public class SimpleBattle { } public boolean isGameOver() { - if (getMissilesLeft(0) >= 0 && getMissilesLeft(1) >= 0) { + if (getMissilesLeft() >= 0 && getMissilesLeft() >= 0) { //ensure that there are no bullets left in play if (objects.isEmpty()) { return true; diff --git a/src/battle/controllers/Dani/DaniClimber.java b/src/battle/controllers/Dani/DaniClimber.java deleted file mode 100644 index 3e0244e6b3e8b823ce4eb764e68807503c5e11d3..0000000000000000000000000000000000000000 --- a/src/battle/controllers/Dani/DaniClimber.java +++ /dev/null @@ -1,111 +0,0 @@ -package ea; - -import java.util.Arrays; -import java.util.Random; - -public class DaniClimber -{ - - // Random mutation hill climber - // using a relative (hence co-evolutionary) - // fitness function - static Random random = new Random(); - - public double[] bestYet; - Eval2 eval; - - double stepFac = 0.1; - - // set stepAdjust to 1.0 to keep the stepFac fixed - - // on quadratic bowl 1.01 works much better than 1.0 - // which increases the step size every time a mutation - // is successful and decreases it every time it fails - // to improve - // but be careful: could it make things worse in some cases? - double stepAdjust = 1.01; - - // example ready for a minimal version of - // co-evolution - - public static void main(String[] args) { - int nEvals = 1000; - int nDim = 10; - // initial guess - double[] init = randVec(nDim); - // dnote: Seeding turns out to be very important - DaniClimber evo = new DaniClimber(init, new QuadraticBowl()); - - evo.run(nEvals); - - System.out.println("Best Found: " + Arrays.toString(evo.bestYet)); - System.out.println("Fitness: " + mag2(evo.bestYet)); - - } - - public DaniClimber(double[] bestYet, Eval2 eval) { - this.bestYet = bestYet; - this.eval = eval; - } - - public void run(int nEvals) { - for (int i=0; i<nEvals; i++) { - // randomly mutate the best yet - double[] mut = randMut(bestYet, stepFac); - double diff = eval.pointsDiff(bestYet, mut); - - // if it's better then adopt the mutation as the new best - if (diff >= 0) { - bestYet = mut; - // try making it bigger - make even faster progress - } else { - // try making the step size smaller - stepFac /= stepAdjust; - } - System.out.println(i + "\t " + mag2(bestYet)); - } - } - - // to evolve a game playing agent inject a and b into - // game agent controllers and return the points difference - // ensure to interpret the sign correctly - // the example is set up to MINIMIZE a fitness score - - static interface Eval2 { - double pointsDiff(double[] a, double[] b); - } - - static double[] randVec(int n) { - double[] x = new double[n]; - for (int i=0; i<n; i++) { - x[i] = random.nextGaussian(); - } - return x; - } - - static double[] randMut(double[] v, double stepFac) { - int n = v.length; - double[] x = new double[n]; - for (int i=0; i<n; i++) { - x[i] = v[i] + stepFac * random.nextGaussian(); - } - return x; - } - - static class QuadraticBowl implements Eval2 { - - @Override - public double pointsDiff(double[] a, double[] b) { - // simple example that evaluates quality as being - // the minimum squared magnitude of a vector - return mag2(a) - mag2(b); - } - } - - static double mag2(double[] v) { - // square of the magnitude of the vector - double tot = 0; - for (double x : v) tot += x * x; - return tot; - } -} diff --git a/src/battle/controllers/Dani/DaniController.java b/src/battle/controllers/Dani/DaniController.java deleted file mode 100644 index 01a4f463eb9499d5205507861822c6bcb7d75c25..0000000000000000000000000000000000000000 --- a/src/battle/controllers/Dani/DaniController.java +++ /dev/null @@ -1,405 +0,0 @@ -package battle.controllers.Dani; - -import asteroids.Action; -import static asteroids.Constants.*; -import asteroids.Controller; -import asteroids.GameState; -import asteroids.GameObject; -import asteroids.Ship; -import battle.RenderableBattleController; -import battle.BattleMissile; -import battle.NeuroShip; -import battle.SimpleBattle; -import asteroids.Missile; - -import java.awt.*; -import java.util.ArrayList; -import math.Vector2d; -import java.awt.geom.AffineTransform; - -/** - * Created by simonlucas on 30/05/15. - */ -public class DaniController implements RenderableBattleController -{ - int myPlayerId = 0; - - Action action; - Vector2d targetPos; - double viewRadius = 20.0; - double thrustAmt = 1.5; - double rotAmt = 2.5; - int shotWait = 0; - int shotDelay = 1; - - Vector2d meanMissilePos; - Vector2d meanMissileDir; - Vector2d missileLineA; - Vector2d missileLineB; - Vector2d segp; - Vector2d enemyLineA; - Vector2d enemyLineB; - Vector2d enemyTailPt; - - boolean anyMissiles = false; - - Vector2d targetPosition; - Vector2d targetDirection; - - ArrayList<Vector2d> grid; - ArrayList<Vector2d> rtGrid; - ArrayList<Vector2d> bulSegs; - - public DaniController() - - { - action = new Action(); - targetPos = new Vector2d(0,0); - thrustAmt = 0.5 + Math.random(); - } - - public Action action(GameState game) { - // action.thrust = 2.0; - action.shoot = true; - action.turn = 1; - - return action; - } - - public double angleBetween( Vector2d a, Vector2d b ) - { - return Math.atan2(a.x * b.y - a.y * b.x, a.x * b.x + a.y * b.y); - } - - public boolean inView( NeuroShip ship, NeuroShip enemy ) - { - Vector2d enemyPos = new Vector2d(enemy.s); - Vector2d thisPos = new Vector2d(ship.s); - double l = enemyPos.dist(thisPos); - Vector2d tp = new Vector2d(); - // Now tell me how to write this in one line in Java with vectors xcxicwerwx - // Porco dio porca madonna tutti gli angeli in colonna - Vector2d d = new Vector2d(ship.d, true); - d.normalise();; - tp.x = thisPos.x + d.x * l; - tp.y = thisPos.y + d.y * l; - targetPos = tp; - - if( tp.dist(enemyPos) <= viewRadius) - return true; - return false; - } - - ArrayList<Missile> getMissiles(SimpleBattle gstate) - { - ArrayList<GameObject> O = gstate.getObjects(); - ArrayList<Missile> M = new ArrayList<Missile>(); - - for( GameObject go : O ) - { - if( go instanceof Missile ) - { - M.add((Missile)go); - } - } - - return M; - } - - double dot( Vector2d a, Vector2d b ) - { - return a.x*b.x + a.y*b.y; - } - - Vector2d subtract( Vector2d a, Vector2d b ) - { - return new Vector2d(a.x-b.x, a.y-b.y); - } - - Vector2d closestPointOnSegment( Vector2d p, Vector2d a, Vector2d b ) - { - Vector2d v = Vector2d.subtract(b, a); - Vector2d w = Vector2d.subtract(p, a); - - double d1 = dot(w,v); - if( d1 <= 0.0 ) - return a; - double d2 = dot(v,v); - if( d2 <= d1 ) - return b; - - double t = d1/d2; - return Vector2d.add(a, Vector2d.multiply(v, t)); - } - - double distanceToSegment( Vector2d p, Vector2d a, Vector2d b ) - { - return p.dist( closestPointOnSegment(p,a,b) ); - } - - Vector2d getPerp( Vector2d v ) - { - return new Vector2d(-v.y, v.x); - } - - Vector2d keepDistanceVector( SimpleBattle gstate, Vector2d shipPos, Vector2d enemyPos ) - { - if( shipPos.dist(enemyPos) < 50 ) - return Vector2d.multiply( Vector2d.subtract(shipPos, enemyPos), 0.3 ); - - return new Vector2d(0,0); - } - - Vector2d avoidBulletsVector( SimpleBattle gstate, Vector2d shipPos ) - { - Vector2d v = new Vector2d(0,0,true); - bulSegs = new ArrayList<Vector2d>(); - ArrayList<Missile> M = getMissiles(gstate); - for(Missile m : M) - { - Vector2d bp2 = Vector2d.add(m.s, Vector2d.multiply(m.v, 10.0)); - bulSegs.add(m.s); - bulSegs.add(bp2); - - Vector2d segp = closestPointOnSegment(shipPos, m.s, bp2); - - double l = segp.dist(shipPos); - double limit = 100.0; - if( l < limit ) { - Vector2d d = Vector2d.subtract(shipPos, m.s); - d.normalise(); - d = getPerp(d); - double att = (1.0 - l/limit); - att*=att; - v.add( Vector2d.multiply(d, att*1000.0) ); - } - } - - return v; - } - - Vector2d tailVector( SimpleBattle gstate, Vector2d shipPos ) - { - NeuroShip enemy = getEnemyShip(gstate); - Vector2d va = Vector2d.subtract( enemy.s, Vector2d.multiply(enemy.d, 20.0) ); - Vector2d vb = Vector2d.subtract(va, Vector2d.multiply(enemy.d, 200.0) ); - Vector2d tailPos = closestPointOnSegment(shipPos, va, vb); - enemyTailPt = tailPos; - enemyLineA = va; - enemyLineB = vb; - return Vector2d.multiply( Vector2d.subtract(tailPos, shipPos), 1.0 ); - } - Vector2d avoidBulletsVectorBad( SimpleBattle gstate, Vector2d shipPos ) - { - ArrayList<Missile> M = getMissiles(gstate); - meanMissilePos = new Vector2d(0,0, true); - meanMissileDir = new Vector2d(0,0, true); - - int c = 0; - for(Missile m : M) - { - meanMissilePos.add(m.s); - meanMissileDir.add(m.v); - c++; - } - - // no missiles bail out - if(c==0) - { - anyMissiles = false; - System.out.println("No missiles"); - return new Vector2d(0,0,true); - } - - meanMissilePos.divide(c); - meanMissileDir.normalise(); - // project onto main missile line - double min = 1000000; - double max = -1000000; - - for(Missile m : M) - { - Vector2d p = new Vector2d(m.s,true); - p.subtract(meanMissilePos); - double d = dot(p, meanMissileDir); - if( d < min ) - min = d; - if( d > max ) - max = d; - } - - missileLineA = Vector2d.add( meanMissilePos, Vector2d.multiply(meanMissileDir, min) ); - missileLineB = Vector2d.add( meanMissilePos, Vector2d.multiply(meanMissileDir, max) ); - - anyMissiles = false; - - segp = closestPointOnSegment( shipPos, missileLineA, missileLineB ); - double dist = segp.dist(shipPos); - if( dist < 500 ) - { - Vector2d vavoid = Vector2d.subtract( shipPos, segp ); - vavoid.normalise(); - - return Vector2d.multiply(vavoid, (1.0/(dist+1.0))*10000) ; - } - - return new Vector2d(0,0,true); - } - - double heading( Vector2d v ) - { - double theta = Math.atan2(v.y, v.x); - if (theta < 0) - theta += Math.PI * 2; - return theta; - } - - public Vector2d rotThrustAt( SimpleBattle gstate, Vector2d shipPos, Vector2d enemyPos ) - { - Vector2d rt = new Vector2d(0,0); - - Vector2d v = new Vector2d(0,0,true); - - Vector2d vFollow = new Vector2d( enemyPos.x - shipPos.x, enemyPos.y - shipPos.y, true ); - Vector2d vAvoid = avoidBulletsVector(gstate, shipPos ); - Vector2d vDist = keepDistanceVector(gstate, shipPos, enemyPos); - Vector2d vTail = tailVector(gstate, shipPos); - - // - v.add(vAvoid); - v.add(vTail); - v.add(vFollow); - v.add(vDist); - - double mag = v.mag(); - - if( mag > 0.0 ) - v = Vector2d.divide(v, mag); - - return new Vector2d(heading(v),mag*0.1); - } - - public NeuroShip getEnemyShip( SimpleBattle gstate ) - { - return gstate.getShip((myPlayerId == 1)?0:1); - } - - @Override - public Action getAction(SimpleBattle gstate, int playerId) - { - myPlayerId = playerId; - - Action res = new Action(0,0,false); - NeuroShip ship = gstate.getShip(playerId); - NeuroShip enemy = gstate.getShip((playerId == 1)?0:1); - - Vector2d enemyPos = enemy.s; - Vector2d shipPos = ship.s; - - Vector2d rt = rotThrustAt( gstate, shipPos, enemyPos ); - Vector2d d = new Vector2d( Math.cos(rt.x)*rt.y, Math.sin(rt.x)*rt.y ); - res.thrust = rt.y; - - grid = new ArrayList<Vector2d>(); - rtGrid = new ArrayList<Vector2d>(); - - for( int y = 0; y < size.height; y+=30 ) - for( int x = 0; x < size.width; x+=30 ) - { - Vector2d p = new Vector2d(x,y); - - Vector2d rotThrust = rotThrustAt(gstate, new Vector2d(x,y), enemyPos ); - grid.add(p); - rtGrid.add(rotThrust); - } - - // Direction towards enemy - /* - Vector2d d = new Vector2d( enemyPos.x - thisPos.x, enemyPos.y - thisPos.y, true ); - Vector2d vavoid = avoidBulletsVector( gstate, thisPos ); - d.add(vavoid); - d.add( keepDistanceVector(gstate, thisPos, enemyPos) ); - */ - - double rot = angleBetween(ship.d, d)*rotAmt; - //double rot = rt.x - heading(ship.d); - - if(inView(ship, enemy) && shotWait <= 0) - { - res.shoot = true; - shotWait = shotDelay; - } - else { - res.shoot = false; - } - - //res.thrust = thrustAmt; - res.turn = rot; - - shotWait--; - return res; - } - - public void drawCircle( Graphics2D g, Vector2d center, double r ) - { - g.drawOval((int)(center.x - r), (int)(center.y - r), (int)(r*2), (int)(r*2)); - } - - public void drawLine( Graphics2D g, Vector2d a, Vector2d b ) - { - g.drawLine((int)a.x, (int)a.y, (int)b.x, (int)b.y); - } - - void drawArrow( Graphics2D g, Vector2d a, Vector2d b, double size ) - { - - drawLine(g, a,b); - Vector2d d = Vector2d.subtract(b, a); - d.normalise(); - Vector2d perp = new Vector2d(-d.y*size,d.x*size); - d.multiply(size); - d = Vector2d.subtract(b, d); - //d.subtract(perp); - - drawLine( g, Vector2d.subtract(d,perp), b); - drawLine(g, Vector2d.add(d, perp), b); - } - - @Override - public void render( Graphics2D g, NeuroShip s ) { - AffineTransform at = g.getTransform(); - - drawCircle(g, this.targetPos, this.viewRadius); - g.setTransform(at); - - if (anyMissiles) { - drawCircle(g, meanMissilePos, 4.0); -// int dx = (int)(meanMissileDir.x * 100); -// int dy = (int)(meanMissileDir.y * 100); - drawLine(g, Vector2d.subtract(meanMissilePos, Vector2d.multiply(meanMissileDir, 100)), - Vector2d.add(meanMissilePos, Vector2d.multiply(meanMissileDir, 100))); -// g.drawLine((int)meanMissilePos.x - dx, (int)meanMissilePos.y - dy, (int)meanMissilePos.x + dx, (int)meanMissilePos.y + dy); - drawCircle(g, missileLineA, 7.0); - drawCircle(g, missileLineB, 7.0); - } - - g.setColor(Color.gray); - - for (int i = 0; i < grid.size(); i++) - { - Vector2d p = grid.get(i); - Vector2d rt = rtGrid.get(i); - Vector2d d = new Vector2d(Math.cos(rt.x) * rt.y, Math.sin(rt.x) * rt.y); - drawArrow(g, p, Vector2d.add(p, d), 3); - } - - g.setColor(Color.blue); - for (int i = 0; i < bulSegs.size(); i+=2) - { - drawLine(g, bulSegs.get(i), bulSegs.get(i + 1)); - } - - drawLine(g, enemyLineA, enemyLineB ); - drawCircle(g, enemyTailPt, 5.0); - } -} diff --git a/src/battle/controllers/Dani/DaniControllerEvo.java b/src/battle/controllers/Dani/DaniControllerEvo.java deleted file mode 100644 index 1c30cb0246d61895fc68ec4e347abe945aa28382..0000000000000000000000000000000000000000 --- a/src/battle/controllers/Dani/DaniControllerEvo.java +++ /dev/null @@ -1,361 +0,0 @@ -package battle.controllers.Dani; - -import asteroids.Action; -import static asteroids.Constants.*; -import asteroids.Controller; -import asteroids.GameState; -import asteroids.GameObject; -import asteroids.Ship; -import battle.RenderableBattleController; -import battle.BattleMissile; -import battle.NeuroShip; -import battle.SimpleBattle; -import asteroids.Missile; - -import java.awt.*; -import java.util.ArrayList; -import math.Vector2d; -import java.awt.geom.AffineTransform; - -/** - * Created by simonlucas on 30/05/15. - */ -public class DaniControllerEvo implements RenderableBattleController -{ - int myPlayerId = 0; - - public static final int THRUST_AMT = 0; - public static final int ROT_AMT = 1; - public static final int AVOID = 2; - public static final int TAIL = 3; - public static final int FOLLOW = 4; - public static final int DIST = 5; - - public static final int N_FEATURES = 6; - - - double [] features = new double[N_FEATURES]; - - Action action; - Vector2d targetPos; - double viewRadius = 20.0; - double thrustAmt = 1.5; - double rotAmt = 2.5; - int shotWait = 0; - int shotDelay = 1; - - Vector2d meanMissilePos; - Vector2d meanMissileDir; - Vector2d missileLineA; - Vector2d missileLineB; - Vector2d segp; - Vector2d enemyLineA; - Vector2d enemyLineB; - Vector2d enemyTailPt; - - boolean anyMissiles = false; - - Vector2d targetPosition; - Vector2d targetDirection; - - ArrayList<Vector2d> grid; - ArrayList<Vector2d> rtGrid; - ArrayList<Vector2d> bulSegs; - - public DaniControllerEvo() - - { - features[THRUST_AMT] = 1.5; - features[ROT_AMT] = 1.5; - features[AVOID] = 1.5; - features[TAIL] = 1.0; - features[FOLLOW] = 0.6; - features[DIST] = 0.4; - - - action = new Action(); - targetPos = new Vector2d(0,0); - thrustAmt = 0.5 + Math.random(); - } - - public Action action(GameState game) { - // action.thrust = 2.0; - action.shoot = true; - action.turn = 1; - - return action; - } - - public double angleBetween( Vector2d a, Vector2d b ) - { - return Math.atan2(a.x * b.y - a.y * b.x, a.x * b.x + a.y * b.y); - } - - public boolean inView( NeuroShip ship, NeuroShip enemy ) - { - Vector2d enemyPos = new Vector2d(enemy.s); - Vector2d thisPos = new Vector2d(ship.s); - double l = enemyPos.dist(thisPos); - Vector2d tp = new Vector2d(); - // Now tell me how to write this in one line in Java with vectors xcxicwerwx - // Porco dio porca madonna tutti gli angeli in colonna - Vector2d d = new Vector2d(ship.d, true); - d.normalise();; - tp.x = thisPos.x + d.x * l; - tp.y = thisPos.y + d.y * l; - targetPos = tp; - - if( tp.dist(enemyPos) <= viewRadius) - return true; - return false; - } - - ArrayList<Missile> getMissiles(SimpleBattle gstate) - { - ArrayList<GameObject> O = gstate.getObjects(); - ArrayList<Missile> M = new ArrayList<Missile>(); - - for( GameObject go : O ) - { - if( go instanceof Missile ) - { - M.add((Missile)go); - } - } - - return M; - } - - double dot( Vector2d a, Vector2d b ) - { - return a.x*b.x + a.y*b.y; - } - - Vector2d subtract( Vector2d a, Vector2d b ) - { - return new Vector2d(a.x-b.x, a.y-b.y); - } - - Vector2d closestPointOnSegment( Vector2d p, Vector2d a, Vector2d b ) - { - Vector2d v = Vector2d.subtract(b, a); - Vector2d w = Vector2d.subtract(p, a); - - double d1 = dot(w,v); - if( d1 <= 0.0 ) - return a; - double d2 = dot(v,v); - if( d2 <= d1 ) - return b; - - double t = d1/d2; - return Vector2d.add(a, Vector2d.multiply(v, t)); - } - - double distanceToSegment( Vector2d p, Vector2d a, Vector2d b ) - { - return p.dist( closestPointOnSegment(p,a,b) ); - } - - Vector2d getPerp( Vector2d v ) - { - return new Vector2d(-v.y, v.x); - } - - Vector2d keepDistanceVector( SimpleBattle gstate, Vector2d shipPos, Vector2d enemyPos ) - { - if( shipPos.dist(enemyPos) < 50 ) - return Vector2d.multiply( Vector2d.subtract(shipPos, enemyPos), 1.0 ); - - return new Vector2d(0,0); - } - - Vector2d avoidBulletsVector( SimpleBattle gstate, Vector2d shipPos ) - { - Vector2d v = new Vector2d(0,0,true); - bulSegs = new ArrayList<Vector2d>(); - ArrayList<Missile> M = getMissiles(gstate); - for(Missile m : M) - { - Vector2d bp2 = Vector2d.add(m.s, Vector2d.multiply(m.v, 10.0)); - bulSegs.add(m.s); - bulSegs.add(bp2); - - Vector2d segp = closestPointOnSegment(shipPos, m.s, bp2); - - double l = segp.dist(shipPos); - double limit = 100.0; - if( l < limit ) { - Vector2d d = Vector2d.subtract(shipPos, m.s); - d.normalise(); - d = getPerp(d); - double att = (1.0 - l/limit); - att*=att; - v.add( Vector2d.multiply(d, att*1000.0) ); - } - } - - return v; - } - - Vector2d tailVector( SimpleBattle gstate, Vector2d shipPos ) - { - NeuroShip enemy = getEnemyShip(gstate); - Vector2d va = Vector2d.subtract( enemy.s, Vector2d.multiply(enemy.d, 20.0) ); - Vector2d vb = Vector2d.subtract(va, Vector2d.multiply(enemy.d, 200.0) ); - Vector2d tailPos = closestPointOnSegment(shipPos, va, vb); - enemyTailPt = tailPos; - enemyLineA = va; - enemyLineB = vb; - return Vector2d.multiply( Vector2d.subtract(tailPos, shipPos), 1.0 ); - } - - double heading( Vector2d v ) - { - double theta = Math.atan2(v.y, v.x); - if (theta < 0) - theta += Math.PI * 2; - return theta; - } - - public Vector2d rotThrustAt( SimpleBattle gstate, Vector2d shipPos, Vector2d enemyPos ) - { - Vector2d rt = new Vector2d(0,0); - - Vector2d v = new Vector2d(0,0,true); - - Vector2d vFollow = new Vector2d( enemyPos.x - shipPos.x, enemyPos.y - shipPos.y, true ); - Vector2d vAvoid = avoidBulletsVector(gstate, shipPos ); - Vector2d vDist = keepDistanceVector(gstate, shipPos, enemyPos); - Vector2d vTail = tailVector(gstate, shipPos); - - // - v.add( Vector2d.multiply(vAvoid, features[AVOID]) ); - v.add( Vector2d.multiply(vTail, features[TAIL]) ); - v.add( Vector2d.multiply(vFollow, features[FOLLOW]) ) ; - v.add( Vector2d.multiply(vDist, features[DIST]) ); - - double mag = v.mag(); - - if( mag > 0.0 ) - v = Vector2d.divide(v, mag); - - return new Vector2d(heading(v),mag*0.1); - } - - public NeuroShip getEnemyShip( SimpleBattle gstate ) - { - return gstate.getShip((myPlayerId == 1)?0:1); - } - - @Override - public Action getAction(SimpleBattle gstate, int playerId) - { - myPlayerId = playerId; - - Action res = new Action(0,0,false); - NeuroShip ship = gstate.getShip(playerId); - NeuroShip enemy = gstate.getShip((playerId == 1)?0:1); - - Vector2d enemyPos = enemy.s; - Vector2d shipPos = ship.s; - - Vector2d rt = rotThrustAt( gstate, shipPos, enemyPos ); - Vector2d d = new Vector2d( Math.cos(rt.x)*rt.y, Math.sin(rt.x)*rt.y ); - res.thrust = rt.y * features[THRUST_AMT]; - - grid = new ArrayList<Vector2d>(); - rtGrid = new ArrayList<Vector2d>(); - - for( int y = 0; y < size.height; y+=30 ) - for( int x = 0; x < size.width; x+=30 ) - { - Vector2d p = new Vector2d(x,y); - - Vector2d rotThrust = rotThrustAt(gstate, new Vector2d(x,y), enemyPos ); - grid.add(p); - rtGrid.add(rotThrust); - } - - double rot = angleBetween(ship.d, d)*features[ROT_AMT]; - //double rot = rt.x - heading(ship.d); - - if(inView(ship, enemy) && shotWait <= 0) - { - res.shoot = true; - shotWait = shotDelay; - } - else { - res.shoot = false; - } - - //res.thrust = thrustAmt; - res.turn = rot; - - shotWait--; - return res; - } - - public void drawCircle( Graphics2D g, Vector2d center, double r ) - { - g.drawOval((int)(center.x - r), (int)(center.y - r), (int)(r*2), (int)(r*2)); - } - - public void drawLine( Graphics2D g, Vector2d a, Vector2d b ) - { - g.drawLine((int)a.x, (int)a.y, (int)b.x, (int)b.y); - } - - void drawArrow( Graphics2D g, Vector2d a, Vector2d b, double size ) - { - - drawLine(g, a,b); - Vector2d d = Vector2d.subtract(b, a); - d.normalise(); - Vector2d perp = new Vector2d(-d.y*size,d.x*size); - d.multiply(size); - d = Vector2d.subtract(b, d); - //d.subtract(perp); - - drawLine( g, Vector2d.subtract(d,perp), b); - drawLine(g, Vector2d.add(d, perp), b); - } - - @Override - public void render( Graphics2D g, NeuroShip s ) { - AffineTransform at = g.getTransform(); - - drawCircle(g, this.targetPos, this.viewRadius); - g.setTransform(at); - - if (anyMissiles) { - drawCircle(g, meanMissilePos, 4.0); -// int dx = (int)(meanMissileDir.x * 100); -// int dy = (int)(meanMissileDir.y * 100); - drawLine(g, Vector2d.subtract(meanMissilePos, Vector2d.multiply(meanMissileDir, 100)), - Vector2d.add(meanMissilePos, Vector2d.multiply(meanMissileDir, 100))); -// g.drawLine((int)meanMissilePos.x - dx, (int)meanMissilePos.y - dy, (int)meanMissilePos.x + dx, (int)meanMissilePos.y + dy); - drawCircle(g, missileLineA, 7.0); - drawCircle(g, missileLineB, 7.0); - } - - g.setColor(Color.gray); - - for (int i = 0; i < grid.size(); i++) - { - Vector2d p = grid.get(i); - Vector2d rt = rtGrid.get(i); - Vector2d d = new Vector2d(Math.cos(rt.x) * rt.y, Math.sin(rt.x) * rt.y); - drawArrow(g, p, Vector2d.add(p, d), 3); - } - - g.setColor(Color.blue); - for (int i = 0; i < bulSegs.size(); i+=2) - { - drawLine(g, bulSegs.get(i), bulSegs.get(i + 1)); - } - - drawLine(g, enemyLineA, enemyLineB ); - drawCircle(g, enemyTailPt, 5.0); - } -} diff --git a/src/battle/controllers/EmptyController.java b/src/battle/controllers/EmptyController.java index 6ef873abb3442b7b0c40c9184b1f4823964820f6..10e76fb7798d2b7a4afb0b945b0f2878fc58656b 100644 --- a/src/battle/controllers/EmptyController.java +++ b/src/battle/controllers/EmptyController.java @@ -9,7 +9,7 @@ import battle.SimpleBattle; */ public class EmptyController implements BattleController { @Override - public Action getAction(SimpleBattle gameStateCopy, int playerId) { + public Action getAction(SimpleBattle gameStateCopy) { return new Action(0,0,false); } } diff --git a/src/battle/controllers/FireController.java b/src/battle/controllers/FireController.java index 84522534358c959b48fc82663b7472bec9a6fd4e..2d5f05aceb621fb63f1dfc56c1dd02f450364d9d 100644 --- a/src/battle/controllers/FireController.java +++ b/src/battle/controllers/FireController.java @@ -9,7 +9,7 @@ import battle.SimpleBattle; */ public class FireController implements BattleController { @Override - public Action getAction(SimpleBattle gameStateCopy, int playerId) { + public Action getAction(SimpleBattle gameStateCopy) { return new Action(0,0,true); } } diff --git a/src/battle/controllers/FireForwardController.java b/src/battle/controllers/FireForwardController.java index 1022235690be337d6cd7dd8d1ee341e322c45add..8c7232d777db41f4463ddc0092f086cc46733172 100644 --- a/src/battle/controllers/FireForwardController.java +++ b/src/battle/controllers/FireForwardController.java @@ -11,7 +11,7 @@ import java.awt.geom.AffineTransform; */ public class FireForwardController extends DebugController { @Override - public Action getAction(SimpleBattle gameStateCopy, int playerId) { + public Action getAction(SimpleBattle gameStateCopy) { return new Action(1,0,true); } diff --git a/src/battle/controllers/Human/WASDController.java b/src/battle/controllers/Human/WASDController.java index 07b0b9c8155223d150bf558cf824ef4430b97688..ed180183c57ad7523480530e4490c5a4825492df 100644 --- a/src/battle/controllers/Human/WASDController.java +++ b/src/battle/controllers/Human/WASDController.java @@ -20,7 +20,7 @@ public class WASDController implements BattleController, KeyListener { Action currentAction = NOOP; @Override - public Action getAction(SimpleBattle gameStateCopy, int playerId) { + public Action getAction(SimpleBattle gameStateCopy) { if (currentAction == null) { return NOOP; } diff --git a/src/battle/controllers/Memo/MemoController1.java b/src/battle/controllers/Memo/MemoController1.java deleted file mode 100644 index 34a8aaf57345004fa88a9d99fe2c1f795abf46a0..0000000000000000000000000000000000000000 --- a/src/battle/controllers/Memo/MemoController1.java +++ /dev/null @@ -1,257 +0,0 @@ -package battle.controllers.Memo; - -import asteroids.*; -import battle.BattleController; -import battle.NeuroShip; -import battle.RenderableBattleController; -import battle.SimpleBattle; -import math.Vector2d; -import battle.controllers.Memo.MemoControllerUtils; - -import java.awt.*; -import java.awt.geom.AffineTransform; -import java.util.ArrayList; - -/** - * Created by Memo Akten on 11/06/15. - */ - - -/* -Evolved: -[0.2778726792239472, 0.5444174871655298, -0.18302984419042218, 4.9674545803614985, 0.774151581822357, -0.06817898591746861, 0.4337294770803466, 0.053651332141001, 0.6368934200933084, 0.2436632757426203, 0.4366302426536873, 0.8966473590665536, 0.15787122214317573, 0.23265484452056812, 1.789757691310432, 0.03479481858967811 - */ -public class MemoController1 implements RenderableBattleController { - static final public double DIST_RANGE = 500; // used for normalizing distances - static final public double TICK_RANGE = 10; // used for normalizing tick - - static public double DESIRED_DIST_TO_ENEMY_MIN = 100; - static public double DESIRED_DIST_TO_ENEMY_MAX = 300; - static public double DESIRED_ROT_OFF_ENEMY = 00 * Math.PI / 180.0; // how many radians variance (+-) in axis off enemies back - static public double DESIRED_POS_CHANGE_PROB = 0.005; //probability of picking new position to goto - static public double DESIRED_POS_ROT_THRESH = 45 * Math.PI / 180.0; // angle threshold for when we're aiming at desired pos - - static public double ATTACK_PROB = 0.1; - static public double ATTACK_SHOOT_PROB = 0.3; - static public double ATTACK_THRUST_PROB = 0.00; - static public double ATTACK_ROT_THRESH = 45 * Math.PI / 180.0; - - static public double CHASE_SHOOT_PROB = 0.1; - static public double CHASE_THRUST_PROB = 0.5; - static public double CHASE_DOT_THRESH = 0.7; - - static public double MISSILE_AVOID_DIST = 80; - static public double MISSILE_AVOID_PROB = 0.2; - - static public double SHOOT_DIST_THRESH = 1000; - static public int TICK_STEP = 1; - - Action action; - double desired_dist_to_enemy = 0; - double desired_rot_off_enemy = 0; - double desired_pos_radius = 0; - Vector2d desired_pos = new Vector2d(true); - Vector2d vec_to_desired_pos = new Vector2d(true); - Vector2d target_pos = new Vector2d(true); - - boolean do_attack = false; // turn and attack - boolean do_chase = false; // go behind - boolean do_avoid = false; // avoid missiles - boolean do_chicken = false; // go to edge and hide - - public MemoController1() { - action = new Action(); - } - - static public double[] getFeatures() { - double []v = new double[16]; - v[0] = DESIRED_DIST_TO_ENEMY_MIN / DIST_RANGE; - v[1] = DESIRED_DIST_TO_ENEMY_MAX / DIST_RANGE; - v[2] = DESIRED_ROT_OFF_ENEMY; - v[3] = DESIRED_POS_CHANGE_PROB * 1000; - v[4] = DESIRED_POS_ROT_THRESH; - - v[5] = ATTACK_PROB; - v[6] = ATTACK_SHOOT_PROB; - v[7] = ATTACK_THRUST_PROB; - v[8] = ATTACK_ROT_THRESH; - - v[9] = CHASE_SHOOT_PROB; - v[10] = CHASE_THRUST_PROB; - v[11] = CHASE_DOT_THRESH; - - v[12] = MISSILE_AVOID_DIST / DIST_RANGE; - v[13] = MISSILE_AVOID_PROB; - v[14] = SHOOT_DIST_THRESH / DIST_RANGE; - //v[15] = TICK_STEP / TICK_RANGE; - return v; - } - - static public void setFeatures(double [] v) { - DESIRED_DIST_TO_ENEMY_MIN = v[0] * DIST_RANGE; - DESIRED_DIST_TO_ENEMY_MAX = v[1] * DIST_RANGE; - DESIRED_ROT_OFF_ENEMY = v[2]; - DESIRED_POS_CHANGE_PROB = v[3] / 1000; - DESIRED_POS_ROT_THRESH = v[4]; - - ATTACK_PROB = v[5]; - ATTACK_SHOOT_PROB = v[6]; - ATTACK_THRUST_PROB = v[7]; - ATTACK_ROT_THRESH = v[8]; - - CHASE_SHOOT_PROB = v[9]; - CHASE_THRUST_PROB = v[10]; - CHASE_DOT_THRESH = v[11]; - - MISSILE_AVOID_DIST = v[12] * DIST_RANGE; - MISSILE_AVOID_PROB = v[13]; - SHOOT_DIST_THRESH = v[14] * DIST_RANGE; - //TICK_STEP = (int)(v[15] * TICK_RANGE); - } - - @Override - public Action getAction(SimpleBattle gs, int playerId) { - if(TICK_STEP < 1) TICK_STEP = 1; - if(TICK_STEP > 1) { - if(gs.getTicks() % TICK_STEP != 0) return action; - } - - NeuroShip thisShip = gs.getShip(playerId); - NeuroShip otherShip = gs.getShip(1 - playerId); - - do_attack = false; - do_chase = false; - do_avoid = false; - do_chicken = false; - - // random probability of attacking - if(Math.random() < ATTACK_PROB) { - do_attack = true; - - } else { - do_chase = true; - // pick desired distance to ship - if(desired_dist_to_enemy == 0 || Math.random() < DESIRED_POS_CHANGE_PROB) { - desired_dist_to_enemy = Math.random() * (DESIRED_DIST_TO_ENEMY_MAX - DESIRED_DIST_TO_ENEMY_MIN) + DESIRED_DIST_TO_ENEMY_MIN; - desired_rot_off_enemy = (Math.random() - 0.5) * DESIRED_ROT_OFF_ENEMY * 2; - } - - // set desired position behind enemy ship - Vector2d desired_pos_offset = Vector2d.multiply(otherShip.d, desired_dist_to_enemy); - desired_pos_offset.rotate(desired_rot_off_enemy); - - desired_pos = Vector2d.subtract(otherShip.s, desired_pos_offset); - vec_to_desired_pos = Vector2d.subtract(desired_pos, thisShip.s); - - // goto desired pos - boolean reached_desired_pos = MemoControllerUtils.thrustTo(thisShip.s, thisShip.d, desired_pos, desired_dist_to_enemy, DESIRED_POS_ROT_THRESH, action); - - // attack if we're there - if(reached_desired_pos) { - do_attack = true; - } else { - // otherwise thrust (random) - if(Vector2d.dot(thisShip.d, Vector2d.normalise(vec_to_desired_pos)) > CHASE_DOT_THRESH) { - action.thrust = Math.random() < CHASE_THRUST_PROB ? 1 : 0; - } - } - } - - if(do_attack) { - action.thrust = Math.random() < ATTACK_THRUST_PROB ? 1 : 0; - - // TODO, include velocity vector in target pos - target_pos = new Vector2d(otherShip.s, true); - action.shoot = MemoControllerUtils.lookAt(thisShip.s, thisShip.d, otherShip.s, ATTACK_ROT_THRESH, action) && (Math.random() < ATTACK_SHOOT_PROB); - } - - if(thisShip.s.dist(otherShip.s) > SHOOT_DIST_THRESH) { - action.shoot = false; - } - - do_chicken = gs.getMissilesLeft(playerId) == 0; - if(do_chicken) { - MemoControllerUtils.thrustTo(thisShip.s, thisShip.d, new Vector2d(0, 0), desired_dist_to_enemy, DESIRED_POS_ROT_THRESH, action); - action.thrust = 1; - } - -// action.thrust = 0; - - if(Math.random() < MISSILE_AVOID_PROB) { - // ArrayList<Missile> missiles = new ArrayList<Missile>(); - Vector2d avg_missile_pos = new Vector2d(true); - int num_missiles = 0; - - // look for missiles nearby - for (GameObject go : gs.getObjects()) { - if (go instanceof Missile) { - if (go.s.dist(thisShip.s) < MISSILE_AVOID_DIST) { - //missiles.add((Missile) go); - num_missiles++; - avg_missile_pos.add(go.s); - } - } - } - - - if(num_missiles > 0) { - avg_missile_pos.multiply(1.0/num_missiles); - do_avoid = true; - Vector2d vec_to_avg_missile_pos = Vector2d.subtract(avg_missile_pos, thisShip.s); - action.turn = Vector2d.crossMag(vec_to_avg_missile_pos, thisShip.d) < 0 ? - 1 : 1; - action.thrust = 1; - } - //for(Missile m : missiles) { - - //} - } - - - - return action; - } - - @Override - public void render(Graphics2D g, NeuroShip s) { - if(do_chase) { - g.setColor(Color.yellow); - g.drawOval((int) (desired_pos.x - desired_dist_to_enemy), (int) (desired_pos.y - desired_dist_to_enemy), (int) desired_dist_to_enemy * 2, (int) desired_dist_to_enemy * 2); - } - // System.out.println(desired_pos); - - if(do_attack) { - g.setColor(Color.red); - int r = 20; - g.drawOval((int) (target_pos.x) - r, (int) (target_pos.y) - r, r * 2, r * 2); - } - - if(do_avoid) { - g.setColor(Color.green); - int r = (int)MISSILE_AVOID_DIST; - g.drawOval((int) (s.s.x) - r, (int) (s.s.y) - r, r * 2, r * 2); - } - - if(do_chicken) { - g.setColor(Color.pink); - int r = 50; - g.drawOval((int) (s.s.x) - r, (int) (s.s.y) - r, r * 2, r * 2); - } - - /* - g.drawO - color = playerID == 0 ? Color.green : Color.blue; - AffineTransform at = g.getTransform(); - g.translate(s.x, s.y); - double rot = Math.atan2(d.y, d.x) + Math.PI / 2; - g.rotate(rot); - g.scale(scale, scale); - g.setColor(color); - g.fillPolygon(xp, yp, xp.length); - if (thrusting) { - g.setColor(Color.red); - g.fillPolygon(xpThrust, ypThrust, xpThrust.length); - } - g.setTransform(at); - */ - } -} diff --git a/src/battle/controllers/Memo/MemoControllerRandom.java b/src/battle/controllers/Memo/MemoControllerRandom.java deleted file mode 100644 index 29febdfa4ccd6cb86f4ce25f26f2321fabd948d4..0000000000000000000000000000000000000000 --- a/src/battle/controllers/Memo/MemoControllerRandom.java +++ /dev/null @@ -1,99 +0,0 @@ -package battle.controllers.Memo; - -import asteroids.Action; -import asteroids.Controller; -import asteroids.GameState; -import asteroids.Ship; -import battle.BattleController; -import battle.NeuroShip; -import battle.SimpleBattle; -import math.Vector2d; -import battle.controllers.Memo.MemoControllerUtils; - -/** - * Created by Memo Akten on 11/06/15. - */ -public class MemoControllerRandom implements BattleController { - public double MULT = 1; - //public double MULT = 0.001; // to be super dumb and easy - - public double ATTACK_PROB = 0.2 * MULT; - public double ATTACK_SHOOT_PROB = 0.5 * MULT; - public double ATTACK_THRUST_PROB = 0.01 * MULT; - public double ATTACK_ROT_THRESH = 5 * Math.PI / 180.0; - final public double ATTACK_ROT_THRESH_RANGE = Math.PI/2; - - public double FLEE_ROT_CHANGE_PROB = 0.3; - public double FLEE_SHOOT_PROB = 0.02 * MULT; - public double FLEE_THRUST_PROB = 0.8 * MULT; - public double FLEE_TURN_PROB = 0.3 * MULT; - public double FLEE_TURN_LEFT_PROB = 0.3333 * MULT; - public double FLEE_TURN_RIGHT_PROB = 0.3333 * MULT; - - public double SHOOT_DIST_THRESH = 300; - Action action; - - public MemoControllerRandom() { - action = new Action(); - } - - public double[] getFeatures() { - double []v = new double[10]; - v[0] = ATTACK_PROB; - v[1] = ATTACK_SHOOT_PROB; - v[2] = ATTACK_THRUST_PROB; - v[3] = ATTACK_ROT_THRESH / ATTACK_ROT_THRESH_RANGE; - v[4] = FLEE_ROT_CHANGE_PROB; - v[5] = FLEE_SHOOT_PROB; - v[6] = FLEE_THRUST_PROB; - v[7] = FLEE_TURN_PROB; - v[8] = FLEE_TURN_LEFT_PROB; - v[9] = FLEE_TURN_RIGHT_PROB; - v[10] = SHOOT_DIST_THRESH; - return v; - } - - public void setFeatures(double []v) { - ATTACK_PROB = v[0]; - ATTACK_SHOOT_PROB = v[1]; - ATTACK_THRUST_PROB = v[2]; - ATTACK_ROT_THRESH = v[3] * ATTACK_ROT_THRESH_RANGE; - FLEE_ROT_CHANGE_PROB = v[4]; - FLEE_SHOOT_PROB = v[5]; - FLEE_THRUST_PROB = v[6]; - FLEE_TURN_PROB = v[7]; - FLEE_TURN_LEFT_PROB = v[8]; - FLEE_TURN_RIGHT_PROB = v[9]; - SHOOT_DIST_THRESH = v[10]; - } - - @Override - public Action getAction(SimpleBattle gs, int playerId) { - NeuroShip thisShip = gs.getShip(playerId); - NeuroShip otherShip = gs.getShip(1 - playerId); - - if(Math.random() < ATTACK_PROB) { - action.thrust = Math.random() < ATTACK_THRUST_PROB ? 1 : 0; - action.shoot = Math.random() < ATTACK_SHOOT_PROB; - - // TODO, include velocity vector in target pos - MemoControllerUtils.lookAt(thisShip.s, thisShip.d, otherShip.s, ATTACK_ROT_THRESH, action); - } else{ - action.thrust = Math.random() < FLEE_THRUST_PROB ? 1 : 0; - action.shoot = Math.random() < FLEE_SHOOT_PROB; - - if (Math.random() < FLEE_TURN_PROB) { - double v = Math.random(); - if (v < FLEE_TURN_LEFT_PROB) action.turn = -1; - else if (v > 1 - FLEE_TURN_RIGHT_PROB) action.turn = 1; - else action.turn = 0; - } - } - - if(thisShip.s.dist(otherShip.s) > SHOOT_DIST_THRESH) { - action.shoot = false; - } - - return action; - } -} diff --git a/src/battle/controllers/Memo/MemoControllerUtils.java b/src/battle/controllers/Memo/MemoControllerUtils.java deleted file mode 100644 index 201d553606f7bada1692b5a4aad1ce672c34c6e9..0000000000000000000000000000000000000000 --- a/src/battle/controllers/Memo/MemoControllerUtils.java +++ /dev/null @@ -1,42 +0,0 @@ -package battle.controllers.Memo; - -import math.Vector2d; -import asteroids.Action; -import battle.BattleMissile; -import battle.NeuroShip; -import battle.SimpleBattle; -import asteroids.Missile; -import java.util.ArrayList; -import asteroids.GameObject; - -/** - * Created by Memo Akten on 11/06/2015. - */ -public class MemoControllerUtils { - - // fills in Action with turn, returns whether we or not we've reached target - static boolean lookAt(Vector2d s, Vector2d d, Vector2d lookat, double rot_threshold, Action action) { - Vector2d desired_rot_vec = new Vector2d(lookat, true); - - desired_rot_vec.add(s, -1); - - double current_rot = Math.atan2(d.y, d.x); - double target_rot = Math.atan2(desired_rot_vec.y, desired_rot_vec.x); - - if(current_rot > target_rot) action.turn = -1; - else action.turn = 1; - - return Math.abs(current_rot - target_rot) < rot_threshold; - } - - // fills in Action with turn, returns whether we or not we've reached target - static boolean thrustTo(Vector2d s, Vector2d d, Vector2d desired_pos, double dist_threshold, double rot_threshold, Action action) { - double dist_to_desired_pos = s.dist(desired_pos); - if(dist_to_desired_pos < dist_threshold) { - return true; - } else { - lookAt(s, d, desired_pos, rot_threshold, action); - return false; - } - } -} diff --git a/src/battle/controllers/Naz/Naz_AI.java b/src/battle/controllers/Naz/Naz_AI.java index 6d0cd6f796bdc81301b98c0b223c6150507ee77a..8bae75f5fd09a64f2208c5f3fe7f1c988c54146d 100644 --- a/src/battle/controllers/Naz/Naz_AI.java +++ b/src/battle/controllers/Naz/Naz_AI.java @@ -19,7 +19,7 @@ public class Naz_AI implements BattleController { - public Action getAction(SimpleBattle game, int playerId ) { + public Action getAction(SimpleBattle game ) { Action action = new Action(); // Work out what we want to do action.shoot =true; //don't forget to set to true ///The ship will always shoot because it's free and it's simple enough diff --git a/src/battle/controllers/Piers/BetterMCTSNode.java b/src/battle/controllers/Piers/BetterMCTSNode.java index d50424cf3dc9f939cd625bd1c15c513524aa7eb8..255d13b9c164b3a5ea92415c732cf09290fc2400 100644 --- a/src/battle/controllers/Piers/BetterMCTSNode.java +++ b/src/battle/controllers/Piers/BetterMCTSNode.java @@ -20,7 +20,6 @@ public class BetterMCTSNode { private boolean ourNode; private int currentDepth; - private int playerID; private double totalValue = 0; private int numberOfVisits = 1; @@ -28,10 +27,9 @@ public class BetterMCTSNode { private double explorationConstant; private PiersMCTS mcts; - public BetterMCTSNode(double explorationConstant, int playerID, PiersMCTS mcts) { + public BetterMCTSNode(double explorationConstant, PiersMCTS mcts) { this.explorationConstant = explorationConstant; currentDepth = 0; - this.playerID = playerID; ourNode = true; children = new BetterMCTSNode[allActions.length]; this.mcts = mcts; @@ -43,7 +41,6 @@ public class BetterMCTSNode { this.parent = parent; this.children = new BetterMCTSNode[allActions.length]; this.currentDepth = parent.currentDepth + 1; - this.playerID = parent.playerID; this.ourNode = parent.ourNode; this.mcts = parent.mcts; } @@ -67,7 +64,7 @@ public class BetterMCTSNode { if (current.fullyExpanded()) { current = current.selectBestChild(); for (int i = 0; i < mcts.ACTIONS_PER_MACRO; i++) { - state.update(current.ourMoveToThisState, allActions[random.nextInt(allActions.length)]); + state.update(current.ourMoveToThisState); } } else { return current.expand(state); @@ -89,7 +86,7 @@ public class BetterMCTSNode { } children[childToExpand] = new BetterMCTSNode(this, allActions[childToExpand]); for (int i = 0; i < mcts.ACTIONS_PER_MACRO; i++) { - state.update(allActions[childToExpand], allActions[random.nextInt(allActions.length)]); + state.update(allActions[childToExpand]); } numberOfChildrenExpanded++; return children[childToExpand]; @@ -135,14 +132,13 @@ public class BetterMCTSNode { Action first = allActions[random.nextInt(allActions.length)]; Action second = allActions[random.nextInt(allActions.length)]; for (int i = 0; i < mcts.ACTIONS_PER_MACRO; i++) { - state.update(first, second); + state.update(first); } currentRolloutDepth++; } - int missilesUsed = 100 - state.getMissilesLeft(playerID); - int ourPoints = state.getPoints(playerID); - int enemyPoints = state.getPoints(playerID == 0 ? 1 : 0); - return (ourPoints - (missilesUsed * 5) - (enemyPoints * 1.5)); + int missilesUsed = 100 - state.getMissilesLeft(); + int ourPoints = state.getPoints(); + return (ourPoints - (missilesUsed * 5)); } public Action getBestAction() { diff --git a/src/battle/controllers/Piers/MCTSNode.java b/src/battle/controllers/Piers/MCTSNode.java deleted file mode 100644 index 6237a679937d4893ad082526e9c9c8887dbde608..0000000000000000000000000000000000000000 --- a/src/battle/controllers/Piers/MCTSNode.java +++ /dev/null @@ -1,258 +0,0 @@ -package battle.controllers.Piers; - -import asteroids.Action; -import battle.NeuroShip; -import battle.SimpleBattle; - -import java.util.Random; - -/** - * Created by pwillic on 11/06/2015. - */ -public class MCTSNode { - - private static final double EPSILON = 1e-6; - private static Action[] allActions; - private static Action[] notShootActions; - private static Action[][] allActionPairs; - private static Action[][] p1Notp2Not; - private static Action[][] p1Notp2Yes; - private static Action[][] p1Yesp2Not; - private static Random random = new Random(); - private static int numberOfActionsPerState = 15; - private Action ourMoveToThisState; - private Action enemyMoveToThisState; - - private Action[][] possibleActions; - - private MCTSNode parent; - private MCTSNode[] children; - private int numberOfChildrenExpanded; - private boolean ourNode; - - private int currentDepth; - private int playerID; - - private double totalValue = 0; - private double enemyTotalValue = 0; - private int numberOfVisits = 1; - - private double explorationConstant; - - public MCTSNode(double explorationConstant, int playerID) { - this.explorationConstant = explorationConstant; - currentDepth = 0; - this.playerID = playerID; - ourNode = true; - children = new MCTSNode[allActionPairs.length]; - possibleActions = p1Yesp2Not; - } - - private MCTSNode(MCTSNode parent, Action ourMoveToThisState, Action enemyMoveToThisState, Action[][] possibleActions) { - this.explorationConstant = parent.explorationConstant; - this.ourMoveToThisState = ourMoveToThisState; - this.enemyMoveToThisState = enemyMoveToThisState; - this.parent = parent; - this.children = new MCTSNode[allActionPairs.length]; - this.currentDepth = parent.currentDepth + 1; - this.playerID = parent.playerID; - this.ourNode = parent.ourNode; - this.possibleActions = possibleActions; - } - - public static void setAllActions() { - allActions = new Action[12]; - notShootActions = new Action[6]; - int i = 0; - int j = 0; - for (double thrust = 0; thrust <= 1; thrust += 1) { - for (double turn = -1; turn <= 1; turn += 1) { - allActions[i] = new Action(thrust, turn, true); - i++; - allActions[i] = new Action(thrust, turn, false); - notShootActions[j] = allActions[i]; - i++; - j++; - } - } - i = 0; - allActionPairs = new Action[144][2]; - p1Yesp2Not = new Action[72][2]; - p1Notp2Yes = new Action[72][2]; - p1Notp2Not = new Action[36][2]; - for (Action action : allActions) { - for (Action otherAction : allActions) { - allActionPairs[i++] = new Action[]{ - action, otherAction - }; - } - } - i = 0; - for (Action action : notShootActions) { - for (Action otherAction : notShootActions) { - p1Notp2Not[i++] = new Action[]{action, otherAction}; - } - } - i = 0; - for (Action action : notShootActions) { - for (Action otherAction : allActions) { - p1Notp2Yes[i] = new Action[]{action, otherAction}; - p1Yesp2Not[i] = new Action[]{otherAction, action}; - i++; - } - } - } - - public MCTSNode select(SimpleBattle state, int maxDepth) { - MCTSNode current = this; - while (current.currentDepth <= maxDepth) { - if (current.fullyExpanded()) { - current = current.selectBestChild(); - state.update(current.ourMoveToThisState, current.enemyMoveToThisState); - } else { - return current.expand(state); - } - } - return current; - } - - public MCTSNode expand(SimpleBattle state) { - - // Calculate the possible action spaces - // can we shoot - NeuroShip p1 = state.getShip(playerID); - NeuroShip p2 = state.getShip(playerID == 0 ? 1 : 0); - double p1Seesp2 = p1.s.dist(p2.s); - - double p2Seesp1 = p2.s.dist(p1.s); - - boolean canP1SeeP2 = (p1Seesp2 < 100); - boolean canP2SeeP1 = (p2Seesp1 < 100); - Action[][] childPossibleActions = allActionPairs; - - if (canP1SeeP2 && !canP2SeeP1) { - childPossibleActions = p1Yesp2Not; - } - if (!canP1SeeP2 && canP2SeeP1) { - childPossibleActions = p1Notp2Yes; - } - if (!canP1SeeP2 && !canP2SeeP1) { - childPossibleActions = p1Notp2Not; - } - children = new MCTSNode[childPossibleActions.length]; - - int childToExpand = random.nextInt(childPossibleActions.length); - while (children[childToExpand] != null) { - childToExpand = random.nextInt(childPossibleActions.length); - } - children[childToExpand] = new MCTSNode(this, childPossibleActions[childToExpand][0], childPossibleActions[childToExpand][1], childPossibleActions); - numberOfChildrenExpanded++; - return children[childToExpand]; - } - - public MCTSNode selectBestChild() { - return selectBestChildFeaturingEnemyMove(selectBestOpposingAction()); - } - - public Action selectBestOpposingAction() { - if (children == null) return notShootActions[0]; - double bestScore = -Double.MAX_VALUE; - int bestIndex = -1; - for (int i = 0; i < children.length; i++) { - if (children[i] != null) { - double score = children[i].enemyTotalValue; - if (score > bestScore) { - bestScore = score; - bestIndex = i; - } - } - } - if (bestIndex == -1) return notShootActions[0]; - return children[bestIndex].enemyMoveToThisState; - } - - public MCTSNode selectBestChildFeaturingEnemyMove(Action enemyMove) { - double bestScore = -Double.MAX_VALUE; - int bestIndex = -1; - for (int i = 0; i < children.length; i++) { - if (children[i] != null) { - if (children[i].enemyMoveToThisState == enemyMove) { - double score = children[i].calculateChild(); - if (score > bestScore) { - bestScore = score; - bestIndex = i; - } - } - } - } - return children[bestIndex]; - } - - public double calculateChild() { - return (totalValue / numberOfVisits) + - (explorationConstant * (Math.sqrt(Math.log(parent.numberOfVisits) / numberOfVisits))); - } - - public void updateValues(double value, double enemyScore) { - MCTSNode current = this; - double alteredValue = value / 1000; - double alteredEnemyValue = enemyScore / 1000; - while (current.parent != null) { - current.numberOfVisits++; - current.totalValue += alteredValue; - current.enemyTotalValue += alteredEnemyValue; - current = current.parent; - } - current.totalValue += alteredValue; - current.enemyTotalValue += alteredEnemyValue; - current.numberOfVisits++; - } - - public double[] rollout(SimpleBattle state, int maxDepth) { - int currentRolloutDepth = this.currentDepth; - while (maxDepth > currentRolloutDepth && !state.isGameOver()) { - Action first = allActions[random.nextInt(allActions.length)]; - Action second = allActions[random.nextInt(allActions.length)]; - state.update(first, second); - } - return new double[]{state.getPoints(playerID), state.getPoints((playerID == 1) ? 0 : 1)}; - } - - public Action getBestAction() { - double bestScore = -Double.MAX_VALUE; - int bestIndex = -1; - if (children == null) return allActions[0]; - - for (int i = 0; i < children.length; i++) { - if (children[i] != null) { - double childScore = children[i].totalValue + (random.nextFloat() * EPSILON); - if (childScore > bestScore) { - bestScore = childScore; - bestIndex = i; - } - } - } - if (bestIndex == -1) return allActions[0]; - return children[bestIndex].ourMoveToThisState; - } - - private boolean fullyExpanded() { - return numberOfChildrenExpanded == possibleActions.length; - } - - public void printAllChildren() { - StringBuilder builder = new StringBuilder(); - for (int i = 0; i < children.length; i++) { - builder.append("Value: "); - builder.append(children[i].totalValue / children[i].numberOfVisits); - builder.append(" Action: "); - builder.append(children[i].ourMoveToThisState); - builder.append("UCB: "); - builder.append(children[i].calculateChild()); - builder.append("\n"); - } - - System.out.println(builder.toString()); - } - -} diff --git a/src/battle/controllers/Piers/PiersBattleTest.java b/src/battle/controllers/Piers/PiersBattleTest.java index 7d171095d7f7e881a0df77b754b92da12a33adc7..92a47afb046d3780e15eed96048e7f7e0fca88cc 100644 --- a/src/battle/controllers/Piers/PiersBattleTest.java +++ b/src/battle/controllers/Piers/PiersBattleTest.java @@ -2,8 +2,6 @@ package battle.controllers.Piers; import battle.BattleController; import battle.SimpleBattle; -import battle.controllers.EmptyController; -import battle.controllers.Memo.MemoControllerRandom; import battle.controllers.mmmcts.MMMCTS; /** @@ -13,8 +11,7 @@ public class PiersBattleTest { public static void main(String[] args) { SimpleBattle battle = new SimpleBattle(); - BattleController player1 = new MMMCTS(); - BattleController player2 = new PiersMCTS(); - battle.playGame(player1, player2); + BattleController player1 = new PiersMCTS(); + battle.playGame(player1); } } diff --git a/src/battle/controllers/Piers/PiersController.java b/src/battle/controllers/Piers/PiersController.java index bedecf3053a7474bd09012bb54af03aeb430e02b..b6df29ae0fc8c4c10b436b22f437fb538782bc2d 100644 --- a/src/battle/controllers/Piers/PiersController.java +++ b/src/battle/controllers/Piers/PiersController.java @@ -56,7 +56,7 @@ public class PiersController implements BattleController { } @Override - public Action getAction(SimpleBattle gameStateCopy, int playerId) { + public Action getAction(SimpleBattle gameStateCopy) { double[] avoidanceTable = new double[5]; double[] shootingTable = new double[3]; diff --git a/src/battle/controllers/Piers/PiersMCTS.java b/src/battle/controllers/Piers/PiersMCTS.java index aa4e071849e7cf55f4cc7131c471a015eb86462b..d93bcde2b1cb7c84569d9cec6ea2020598e0fcc2 100644 --- a/src/battle/controllers/Piers/PiersMCTS.java +++ b/src/battle/controllers/Piers/PiersMCTS.java @@ -10,29 +10,23 @@ import battle.SimpleBattle; public class PiersMCTS implements BattleController { protected static int ACTIONS_PER_MACRO = 15; - protected static final int ACTIONS_PER_MACRO_ENEMY_CLOSE = 3; - protected static final int ACTIONS_PER_MACRO_ENEMY_FAR = 15; - protected static final double DISTANCE_THRESHOLD = 100; private MacroAction currentBestAction = new MacroAction(new Action(1, 0, false)); private BetterMCTSNode root; public PiersMCTS() { - MCTSNode.setAllActions(); BetterMCTSNode.setAllActions(); } @Override - public Action getAction(SimpleBattle gameStateCopy, int playerId) { + public Action getAction(SimpleBattle gameStateCopy) { GameTimer timer = new GameTimer(); timer.setTimeBudgetMilliseconds(25); Action action = currentBestAction.getAction(); - double distance = gameStateCopy.getShip(0).s.dist(gameStateCopy.getShip(1).s); - ACTIONS_PER_MACRO = (distance > DISTANCE_THRESHOLD) ? ACTIONS_PER_MACRO_ENEMY_FAR : ACTIONS_PER_MACRO_ENEMY_CLOSE; - if (root == null) root = new BetterMCTSNode(2.0, playerId, this); - if (currentBestAction.getTimesUsed() >= ACTIONS_PER_MACRO) root = new BetterMCTSNode(2.0, playerId, this); + if (root == null) root = new BetterMCTSNode(2.0, this); + if (currentBestAction.getTimesUsed() >= ACTIONS_PER_MACRO) root = new BetterMCTSNode(2.0, this); int i = 0; while (timer.remainingTimePercent() > 10) { diff --git a/src/battle/controllers/RotateAndShoot.java b/src/battle/controllers/RotateAndShoot.java index 693e4b1f30ce34feef35e1b758b0b9c74d351eb2..635d20521f7368792a3c1d95e483f6d0144c8ff3 100644 --- a/src/battle/controllers/RotateAndShoot.java +++ b/src/battle/controllers/RotateAndShoot.java @@ -35,7 +35,7 @@ public class RotateAndShoot implements BattleController { } @Override - public Action getAction(SimpleBattle gameStateCopy, int playerId) { + public Action getAction(SimpleBattle gameStateCopy) { return new Action(0, 1, true); } } diff --git a/src/battle/controllers/mmmcts/MMMCTS.java b/src/battle/controllers/mmmcts/MMMCTS.java index 7b918f76ec256b0a8605c3ad201afbfb45f11b1b..f22ce67cdcb4782958aead57f30bb56221d04d17 100644 --- a/src/battle/controllers/mmmcts/MMMCTS.java +++ b/src/battle/controllers/mmmcts/MMMCTS.java @@ -50,12 +50,12 @@ public class MMMCTS implements BattleController { mctsPlayer = new SingleMCTSPlayer(new Random()); } - public Action getAction(SimpleBattle gameStateCopy, int playerId) { + public Action getAction(SimpleBattle gameStateCopy) { //ArrayList<Observation> obs[] = stateObs.getFromAvatarSpritesPositions(); //ArrayList<Observation> grid[][] = stateObs.getObservationGrid(); //Set the state observation object as the new root of the tree. - mctsPlayer.init(gameStateCopy, playerId); + mctsPlayer.init(gameStateCopy); ElapsedCpuTimer timer = new ElapsedCpuTimer(); timer.setMaxTimeMillis(TIMETOTHINK); diff --git a/src/battle/controllers/mmmcts/SingleMCTSPlayer.java b/src/battle/controllers/mmmcts/SingleMCTSPlayer.java index 14166102db1c346dfca5a138d0da595903c07cc4..8128726d179f224c8ef48059d0b88e4c0c7b3a53 100644 --- a/src/battle/controllers/mmmcts/SingleMCTSPlayer.java +++ b/src/battle/controllers/mmmcts/SingleMCTSPlayer.java @@ -23,7 +23,6 @@ public class SingleMCTSPlayer */ public Random m_rnd; - public int playerID; /** * Creates the MCTS player with a sampleRandom generator object. @@ -39,19 +38,17 @@ public class SingleMCTSPlayer * Inits the tree with the new observation state in the root. * @param a_gameState current state of the game. */ - public void init(SimpleBattle a_gameState, int playerId) + public void init(SimpleBattle a_gameState) { //Set the game observation to a newly root node. m_root = new SingleTreeNode(m_rnd); m_root.state = a_gameState; - - playerID = playerId; } public int run(ElapsedCpuTimer elapsedTimer) { //Do the search within the available time. - m_root.mctsSearch(elapsedTimer, playerID); + m_root.mctsSearch(elapsedTimer); //Determine the best action to take and return it. int action = m_root.mostVisitedAction(); diff --git a/src/battle/controllers/mmmcts/SingleTreeNode.java b/src/battle/controllers/mmmcts/SingleTreeNode.java index a326007de7e6000fe1ab359f3abbd2ad984f705d..0b090af62cddd7da788ccc5b1e9bd3f26feb5857 100644 --- a/src/battle/controllers/mmmcts/SingleTreeNode.java +++ b/src/battle/controllers/mmmcts/SingleTreeNode.java @@ -46,7 +46,7 @@ public class SingleTreeNode } - public void mctsSearch(ElapsedCpuTimer elapsedTimer, int playerID) { + public void mctsSearch(ElapsedCpuTimer elapsedTimer) { //playerId = playerID; double avgTimeTaken = 0; @@ -58,8 +58,8 @@ public class SingleTreeNode int remainingLimit = 5; while(remaining > 2*avgTimeTaken && remaining > remainingLimit){ ElapsedCpuTimer elapsedTimerIteration = new ElapsedCpuTimer(); - SingleTreeNode selected = treePolicy(playerID); - double delta = selected.rollOut(playerID); + SingleTreeNode selected = treePolicy(); + double delta = selected.rollOut(); backUp(selected, delta); numIters++; @@ -72,14 +72,14 @@ public class SingleTreeNode //System.out.println("-- " + numIters + " -- ( " + avgTimeTaken + ")"); } - public SingleTreeNode treePolicy(int playerId) { + public SingleTreeNode treePolicy() { SingleTreeNode cur = this; while (!cur.state.isGameOver() && cur.m_depth < MMMCTS.ROLLOUT_DEPTH) { if (cur.notFullyExpanded()) { - return cur.expand(playerId); + return cur.expand(); } else { SingleTreeNode next = cur.uct(); @@ -92,7 +92,7 @@ public class SingleTreeNode } - public SingleTreeNode expand(int playerId) { + public SingleTreeNode expand() { int bestAction = 0; double bestValue = -1; @@ -106,11 +106,8 @@ public class SingleTreeNode } SimpleBattle nextState = state.clone(); - if(playerId == 0) { - nextState.update(MMMCTS.actions.get(bestAction).buildAction(), DEFAULTACTION); - } else { - nextState.update(DEFAULTACTION, MMMCTS.actions.get(bestAction).buildAction()); - } + nextState.update(MMMCTS.actions.get(bestAction).buildAction()); + SingleTreeNode tn = new SingleTreeNode(nextState, this, this.m_rnd); children[bestAction] = tn; @@ -188,7 +185,7 @@ public class SingleTreeNode } - public double rollOut(int playerId) + public double rollOut() { SimpleBattle rollerState = state.clone(); int thisDepth = this.m_depth; @@ -196,15 +193,13 @@ public class SingleTreeNode while (!finishRollout(rollerState,thisDepth)) { int action = m_rnd.nextInt(MMMCTS.NUM_ACTIONS); - if(playerId == 0) { - rollerState.update(MMMCTS.actions.get(action).buildAction(), DEFAULTACTION); - } else { - rollerState.update(DEFAULTACTION, MMMCTS.actions.get(action).buildAction()); - } + + rollerState.update(MMMCTS.actions.get(action).buildAction()); + thisDepth++; } - double delta = value(rollerState, playerId); + double delta = value(rollerState); if(delta < bounds[0]) bounds[0] = delta; @@ -221,40 +216,26 @@ public class SingleTreeNode public static int GRAVITATE_DISTANCE = 40; public static boolean GRAVITATE = false; - public double value(SimpleBattle a_gameState, int playerId) { + public double value(SimpleBattle a_gameState) { //double score = OGState.getPoints(playerId); double score = 5000; - NeuroShip s1,s2; - s1 = a_gameState.getShip(playerId); - s2 = a_gameState.getShip(1-playerId); - - if(OGState.getPoints(1-playerId) < a_gameState.getPoints(1-playerId)) + if(OGState.getPoints() < a_gameState.getPoints()) { score += HUGE_NEGATIVE; } - if(a_gameState.getPoints(playerId) > OGState.getPoints(playerId)) { + if(a_gameState.getPoints() > OGState.getPoints()) { //score += HUGE_POSITIVE; score += SCORE_BONUS; } - int mleft = Math.abs(a_gameState.getMissilesLeft(playerId)); - int mused = Math.abs(OGState.getMissilesLeft(playerId)) - (mleft); - double dist = s1.s.dist(s2.s); + int mleft = Math.abs(a_gameState.getMissilesLeft()); if(mleft > 0) { //score -= 2000 * mused; score += MISSILES_LEFT_MOD * mleft; - - //int gravitateTowards = 100; - if(GRAVITATE) - score += DISTANCE_MOD * -Math.abs(GRAVITATE_DISTANCE - dist); - else - score += -dist * DISTANCE_MOD; - } else { - score += dist * DISTANCE_MOD; } //double alpha = 180 + Math.atan2((s1.s.y - s2.s.y), (s1.s.x - s2.s.x)); diff --git a/src/battle/controllers/webpigeon/GameEvaluator.java b/src/battle/controllers/webpigeon/GameEvaluator.java index 6f34f38c3f76d24231cf5c0ad695baff3e344373..484c0a45578ea14da790f2fab6e8a3b530bdc7c4 100644 --- a/src/battle/controllers/webpigeon/GameEvaluator.java +++ b/src/battle/controllers/webpigeon/GameEvaluator.java @@ -24,17 +24,15 @@ public class GameEvaluator implements Eval2 { currBattle.reset(); StupidGAWrapper controller1 = new StupidGAWrapper(a); - StupidGAWrapper controller2 = new StupidGAWrapper(b); int tick = 0; while(!currBattle.isGameOver()) { Action action1 = controller1.getMove(); - Action action2 = controller2.getMove(); - currBattle.update(action1, action2); + currBattle.update(action1); } - return currBattle.getPoints(0) - currBattle.getPoints(1); + return currBattle.getPoints(); } } diff --git a/src/battle/controllers/webpigeon/StupidGAWrapper.java b/src/battle/controllers/webpigeon/StupidGAWrapper.java index c6d59809a49b4ee3c9618fba2228844fbef9cc71..e3661dd2840318387fe7a738d18a9c72e1059fa2 100644 --- a/src/battle/controllers/webpigeon/StupidGAWrapper.java +++ b/src/battle/controllers/webpigeon/StupidGAWrapper.java @@ -20,7 +20,7 @@ public class StupidGAWrapper implements BattleController { } @Override - public Action getAction(SimpleBattle gameStateCopy, int playerId) { + public Action getAction(SimpleBattle gameStateCopy) { return getMove(); } } diff --git a/src/ga/SimpleRandomHillClimber.java b/src/ga/SimpleRandomHillClimber.java deleted file mode 100644 index 93f1a1d7ddb8b1ec7516b60ba870b352a3606de6..0000000000000000000000000000000000000000 --- a/src/ga/SimpleRandomHillClimber.java +++ /dev/null @@ -1,148 +0,0 @@ -package ga; - -import battle.BattleController; -import battle.SimpleBattle; -import battle.controllers.Memo.MemoController1; -import battle.controllers.mmmcts.MMMCTS; - -import java.util.Arrays; -import java.util.Random; - -public class SimpleRandomHillClimber { - - // Random mutation hill climber - // using a relative (hence co-evolutionary) - // fitness function - static Random random = new Random(); - - double[] bestYet; - Eval2 eval; - - double stepFac = 0.05; - - // set stepAdjust to 1.0 to keep the stepFac fixed - - // on quadratic bowl 1.01 works much better than 1.0 - // which increases the step size every time a mutation - // is successful and decreases it every time it fails - // to improve - // but be careful: could it make things worse in some cases? - double stepAdjust = 1.01; - - // example ready for a minimal version of - // co-evolution - - public static void main(String[] args) { - int nEvals = 100; - - SimpleRandomHillClimber evo = new SimpleRandomHillClimber(MemoController1.getFeatures(), new MemoEval2()); - - evo.run(nEvals); - - System.out.println("Best Found: " + Arrays.toString(evo.bestYet)); - System.out.println("Fitness: " + mag2(evo.bestYet)); - - } - - public SimpleRandomHillClimber(double[] bestYet, Eval2 eval) { - this.bestYet = bestYet; - this.eval = eval; - } - - public void run(int nEvals) { - for (int i=0; i<nEvals; i++) { - // randomly mutate the best yet - double[] mut = randMut(bestYet, stepFac); - - // System.out.println(i + "\t " + mag2(bestYet) + "\t" + Arrays.toString(bestYet) + "\t" + Arrays.toString(mut)); - double diff = eval.pointsDiff(bestYet, mut); - - // if it's better then adopt the mutation as the new best - if (diff >= 0) { - bestYet = mut; - // try making it bigger - make even faster progress - } else { - // try making the step size smaller - stepFac /= stepAdjust; - } - System.out.println(i + "\t " + mag2(bestYet)); - } - } - - // to evolve a game playing agent inject a and b into - // game agent controllers and return the points difference - // ensure to interpret the sign correctly - // the example is set up to MINIMIZE a fitness score - - static interface Eval2 { - double pointsDiff(double[] a, double[] b); - } - - static double[] randVec(int n) { - double[] x = new double[n]; - for (int i=0; i<n; i++) { - x[i] = random.nextGaussian(); - } - return x; - } - - static double[] randMut(double[] v, double stepFac) { - int n = v.length; - double[] x = new double[n]; - for (int i=0; i<n; i++) { - x[i] = v[i] + stepFac * random.nextGaussian(); - } - return x; - } - - static class QuadraticBowl implements Eval2 { - - @Override - public double pointsDiff(double[] a, double[] b) { - // simple example that evaluates quality as being - // the minimum squared magnitude of a vector - return mag2(a) - mag2(b); - } - } - - static double mag2(double[] v) { - // square of the magnitude of the vector - double tot = 0; - for (double x : v) tot += x * x; - return tot; - } - - - /** - * Created by Memo Akten on 12/06/2015. - */ - static class MemoEval2 implements Eval2 { - - // returns whether or not I won - int playWith(double[] v) { - System.out.print("Playing with: " + Arrays.toString(v)); - SimpleBattle battle = new SimpleBattle(); - BattleController player1 = new MemoController1(); - MemoController1.setFeatures(v); - - BattleController player2 = new MMMCTS(); - battle.playGame(player1, player2); - - int score = battle.getPoints(0) - battle.getPoints(1); - System.out.println(" | Score: " + score); - return score; - } - - @Override - public double pointsDiff(double[] a, double[] b) { - int num_games = 3; - int wins_a = 0, wins_b = 0; - for(int i=0; i<num_games; i++) { - wins_a += playWith(a); - wins_b += playWith(b); - } - - return wins_a > wins_b ? -1 : 1; - } - } -}