├── CellularAutomata ├── .metadata │ ├── .lock │ ├── version.ini │ └── .plugins │ │ ├── org.eclipse.jdt.core │ │ ├── javaLikeNames.txt │ │ ├── invalidArchivesCache │ │ ├── 1259291233.index │ │ ├── 1513993030.index │ │ ├── 2259717368.index │ │ ├── 2307328643.index │ │ ├── 2422600702.index │ │ ├── 2426646370.index │ │ ├── 2598035366.index │ │ ├── 3517443967.index │ │ ├── 3542660237.index │ │ ├── 3900037835.index │ │ ├── 392775124.index │ │ ├── 3938652823.index │ │ ├── 460152253.index │ │ ├── 989528713.index │ │ ├── externalLibsTimeStamps │ │ ├── variablesAndContainers.dat │ │ ├── savedIndexNames.txt │ │ └── nonChainingJarsCache │ │ ├── org.eclipse.core.resources │ │ ├── .root │ │ │ ├── .indexes │ │ │ │ ├── history.version │ │ │ │ ├── properties.version │ │ │ │ └── properties.index │ │ │ └── 1.tree │ │ ├── .projects │ │ │ └── Omniscience │ │ │ │ └── .markers │ │ ├── .safetable │ │ │ └── org.eclipse.core.resources │ │ └── .history │ │ │ ├── 92 │ │ │ └── 401f13e55e310014185be1b410184f15 │ │ │ ├── 4c │ │ │ └── 103978aa5e310014185be1b410184f15 │ │ │ └── fe │ │ │ └── 50b715e55e310014185be1b410184f15 │ │ ├── org.eclipse.core.runtime │ │ └── .settings │ │ │ ├── org.eclipse.ui.prefs │ │ │ ├── org.eclipse.core.resources.prefs │ │ │ ├── org.eclipse.ui.editors.prefs │ │ │ ├── org.eclipse.ui.ide.prefs │ │ │ ├── org.eclipse.debug.ui.prefs │ │ │ ├── org.eclipse.jdt.launching.prefs │ │ │ ├── org.eclipse.jdt.core.prefs │ │ │ └── org.eclipse.jdt.ui.prefs │ │ ├── org.eclipse.pde.core │ │ └── .cache │ │ │ └── clean-cache.properties │ │ ├── org.eclipse.jdt.ui │ │ ├── OpenTypeHistory.xml │ │ ├── QualifiedTypeNameHistory.xml │ │ ├── jdt-images │ │ │ ├── 0.png │ │ │ ├── 1.png │ │ │ └── 2.png │ │ └── dialog_settings.xml │ │ ├── org.eclipse.jdt.launching │ │ ├── .install.xml │ │ └── libraryInfos.xml │ │ ├── org.eclipse.ui.workbench │ │ ├── workingsets.xml │ │ ├── dialog_settings.xml │ │ └── workbench.xml │ │ ├── org.eclipse.debug.ui │ │ ├── dialog_settings.xml │ │ └── launchConfigurationHistory.xml │ │ ├── org.eclipse.ui.ide │ │ └── dialog_settings.xml │ │ └── org.eclipse.debug.core │ │ └── .launches │ │ └── Main.launch └── Omniscience │ ├── bin │ ├── ml.class │ ├── Main.class │ ├── Surf.class │ ├── mwl.class │ ├── GetVid.class │ ├── Main$1.class │ ├── slider.class │ ├── ClickPanel.class │ ├── Universe.class │ ├── getImage.class │ ├── jMenuMain.class │ ├── neighbours.class │ ├── ToggleFrame.class │ ├── automataLib.class │ ├── dataSources.class │ ├── jMenuEditor.class │ ├── MouseMotionList.class │ └── ScriptDatabase.class │ ├── .classpath │ ├── .project │ ├── src │ ├── ScriptDatabase.java │ ├── MouseMotionList.java │ ├── mwl.java │ ├── dataSources.java │ ├── ClickPanel.java │ ├── getImage.java │ ├── slider.java │ ├── GetVid.java │ ├── ToggleFrame.java │ ├── Universe.java │ ├── Main.java │ ├── Surf.java │ ├── jMenuEditor.java │ ├── jMenuMain.java │ ├── neighbours.java │ └── ml.java │ └── .settings │ └── org.eclipse.jdt.core.prefs ├── AutomataRunnable.jar └── README.md /CellularAutomata/.metadata/.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /CellularAutomata/.metadata/version.ini: -------------------------------------------------------------------------------- 1 | org.eclipse.core.runtime=1 -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/javaLikeNames.txt: -------------------------------------------------------------------------------- 1 | java -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/invalidArchivesCache: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/history.version: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /AutomataRunnable.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/AutomataRunnable.jar -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | showIntro=false 3 | -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.pde.core/.cache/clean-cache.properties: -------------------------------------------------------------------------------- 1 | #Cached timestamps 2 | #Mon Sep 01 10:09:21 NZST 2014 3 | -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | version=1 3 | -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/bin/ml.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/Omniscience/bin/ml.class -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.jdt.ui/OpenTypeHistory.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/bin/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/Omniscience/bin/Main.class -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/bin/Surf.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/Omniscience/bin/Surf.class -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/bin/mwl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/Omniscience/bin/mwl.class -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/bin/GetVid.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/Omniscience/bin/GetVid.class -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/bin/Main$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/Omniscience/bin/Main$1.class -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/bin/slider.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/Omniscience/bin/slider.class -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/bin/ClickPanel.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/Omniscience/bin/ClickPanel.class -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/bin/Universe.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/Omniscience/bin/Universe.class -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/bin/getImage.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/Omniscience/bin/getImage.class -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/bin/jMenuMain.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/Omniscience/bin/jMenuMain.class -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/bin/neighbours.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/Omniscience/bin/neighbours.class -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/bin/ToggleFrame.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/Omniscience/bin/ToggleFrame.class -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/bin/automataLib.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/Omniscience/bin/automataLib.class -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/bin/dataSources.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/Omniscience/bin/dataSources.class -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/bin/jMenuEditor.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/Omniscience/bin/jMenuEditor.class -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.editors.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | overviewRuler_migration=migrated_3.1 3 | -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.jdt.ui/QualifiedTypeNameHistory.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/bin/MouseMotionList.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/Omniscience/bin/MouseMotionList.class -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/bin/ScriptDatabase.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/Omniscience/bin/ScriptDatabase.class -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.jdt.ui/jdt-images/0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/.metadata/.plugins/org.eclipse.jdt.ui/jdt-images/0.png -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.jdt.ui/jdt-images/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/.metadata/.plugins/org.eclipse.jdt.ui/jdt-images/1.png -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.jdt.ui/jdt-images/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/.metadata/.plugins/org.eclipse.jdt.ui/jdt-images/2.png -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/1259291233.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/1259291233.index -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/1513993030.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/1513993030.index -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/2259717368.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/2259717368.index -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/2307328643.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/2307328643.index -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/2422600702.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/2422600702.index -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/2426646370.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/2426646370.index -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/2598035366.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/2598035366.index -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/3517443967.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/3517443967.index -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/3542660237.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/3542660237.index -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/3900037835.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/3900037835.index -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/392775124.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/392775124.index -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/3938652823.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/3938652823.index -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/460152253.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/460152253.index -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/989528713.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/989528713.index -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.core.resources/.root/1.tree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/.metadata/.plugins/org.eclipse.core.resources/.root/1.tree -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/externalLibsTimeStamps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/externalLibsTimeStamps -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.jdt.launching/.install.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/variablesAndContainers.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/variablesAndContainers.dat -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index: -------------------------------------------------------------------------------- 1 | /org.eclipse.core.resourcescontentCacheState2contentCacheTimestamp 1404809305169org.eclipse.jdt.corestateVersionNumber27 -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.core.resources/.projects/Omniscience/.markers: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/.metadata/.plugins/org.eclipse.core.resources/.projects/Omniscience/.markers -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteSearchSpace/Automata-Gen-3/HEAD/CellularAutomata/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs: -------------------------------------------------------------------------------- 1 | PROBLEMS_FILTERS_MIGRATE=true 2 | TASKS_FILTERS_MIGRATE=true 3 | eclipse.preferences.version=1 4 | platformState=1404809305169 5 | quickStart=false 6 | tipsAndTricks=true 7 | -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.debug.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.debug.ui.PREF_LAUNCH_PERSPECTIVES=\n\n 3 | preferredTargets=default\:default| 4 | -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.debug.ui/dialog_settings.xml: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 6 | 7 |
8 |
9 | -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.ui.ide/dialog_settings.xml: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 6 | 7 |
8 |
9 | -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Omniscience 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/savedIndexNames.txt: -------------------------------------------------------------------------------- 1 | INDEX VERSION 1.126+/media/pseudo/Media and Storage/Automata-Gen-3-master/CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core 2 | 2307328643.index 3 | 2426646370.index 4 | 3900037835.index 5 | 3542660237.index 6 | 1513993030.index 7 | 1259291233.index 8 | 2598035366.index 9 | 989528713.index 10 | 460152253.index 11 | 2259717368.index 12 | 2422600702.index 13 | 392775124.index 14 | 3938652823.index 15 | -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 6 | 7 | 8 |
9 |
10 | -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.launching.PREF_VM_XML=\n\n\n\n\n\n 3 | -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.builder.resourceCopyExclusionFilter= 3 | org.eclipse.jdt.core.codeComplete.visibilityCheck=enabled 4 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 5 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 6 | org.eclipse.jdt.core.compiler.compliance=1.7 7 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 8 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 9 | org.eclipse.jdt.core.compiler.source=1.7 10 | -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.debug.core/.launches/Main.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/src/ScriptDatabase.java: -------------------------------------------------------------------------------- 1 | 2 | public class ScriptDatabase { 3 | public ScriptDatabase() { 4 | //load existing dattabases of functions / parameters 5 | 6 | } 7 | 8 | public void capture_current_script(){ 9 | //grab base functions 10 | //grab neighbourhoods 11 | //grab other configs 12 | config_rule(); 13 | //write to existing datbase 14 | 15 | 16 | } 17 | 18 | public void load_database() { 19 | //add all scripts in database file to possible selected rules, and combinations 20 | } 21 | 22 | private void config_rule() { 23 | //get name and general descreiption of rule from input boxes 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.6 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.6 12 | -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs: -------------------------------------------------------------------------------- 1 | content_assist_number_of_computers=13 2 | content_assist_proposals_background=252,252,252 3 | content_assist_proposals_foreground=33,33,33 4 | eclipse.preferences.version=1 5 | fontPropagated=true 6 | org.eclipse.jdt.internal.ui.navigator.layout=2 7 | org.eclipse.jdt.ui.editor.tab.width= 8 | org.eclipse.jdt.ui.formatterprofiles.version=12 9 | org.eclipse.jdt.ui.javadoclocations.migrated=true 10 | org.eclipse.jface.textfont=1|Monospace|10.0|0|GTK|1|; 11 | proposalOrderMigrated=true 12 | spelling_locale_initialized=true 13 | tabWidthPropagated=true 14 | useAnnotationsPrefPage=true 15 | useQuickDiffPrefPage=true 16 | -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/src/MouseMotionList.java: -------------------------------------------------------------------------------- 1 | import java.awt.event.MouseEvent; 2 | import java.awt.event.MouseMotionListener; 3 | 4 | 5 | public class MouseMotionList implements MouseMotionListener{ 6 | 7 | ml MML; 8 | Main mm; 9 | 10 | public MouseMotionList(Main m, ml mml){ 11 | mm = m; 12 | MML = mml; 13 | m.addMouseMotionListener(this); 14 | } 15 | 16 | @Override 17 | public void mouseDragged(MouseEvent arg0) { 18 | // TODO Auto-generated method stub 19 | if(arg0.getModifiers() == 16){ 20 | MML.mousePressed(null); 21 | } 22 | } 23 | 24 | @Override 25 | public void mouseMoved(MouseEvent arg0) { 26 | // TODO Auto-generated method stub 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/src/mwl.java: -------------------------------------------------------------------------------- 1 | import java.awt.event.MouseWheelListener; 2 | import java.awt.event.MouseWheelEvent; 3 | 4 | 5 | public class mwl implements MouseWheelListener{ 6 | 7 | //create containers for reference objects 8 | Main m; 9 | ml hisMouseListener; 10 | 11 | //constructor 12 | public mwl(Main mm, ml hisML) { 13 | //System.out.println("mwl"); 14 | m=mm; 15 | hisMouseListener=hisML; 16 | 17 | m.addMouseWheelListener(this); 18 | } 19 | 20 | //call function from ml class that changes the subfunction 21 | @Override 22 | public void mouseWheelMoved(MouseWheelEvent e) { 23 | hisMouseListener.mouseWheelScrolled(e.getWheelRotation()); 24 | } 25 | 26 | 27 | } -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache: -------------------------------------------------------------------------------- 1 | 1/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/jce.jarA/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext/sunjce_provider.jar3/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rhino.jar;/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext/sunpkcs11.jar 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/src/dataSources.java: -------------------------------------------------------------------------------- 1 | import java.util.Random; 2 | 3 | 4 | public class dataSources { 5 | 6 | public int[][][] sources; 7 | 8 | int xPos; 9 | int yPos; 10 | int zPos; 11 | Random r = new Random(); 12 | ml m; 13 | 14 | public dataSources() { 15 | //setArray(new int[][][] { {{r.nextInt(2)-1}},{{r.nextInt(2)-1}},{{r.nextInt(8)-4}},{{r.nextInt(4)-2}},{{r.nextInt(2)-1}} ,{{r.nextInt(16)-8}},{{r.nextInt(16)-8}} ,{{r.nextInt(16)-8}},{{r.nextInt(16)-8}} }); 16 | setArray(new int[][][] { {{0}},{{0}},{{0}},{{0}},{{0}} ,{{0}},{{0}} ,{{0}},{{0}} }); 17 | } 18 | 19 | public int readNext() { 20 | 21 | xPos++; 22 | if(xPos>sources.length-1) { 23 | xPos=0; 24 | yPos++; 25 | } 26 | 27 | if(yPos>sources[0].length-1) { 28 | yPos=0; 29 | zPos++; 30 | } 31 | 32 | if(zPos>sources[0][0].length-1) { 33 | zPos=0; 34 | } 35 | 36 | return sources[xPos][yPos][zPos]; 37 | 38 | } 39 | 40 | public void setArray(int[][][] ar){ 41 | sources = ar; 42 | } 43 | 44 | public int[][][] getArray(){ 45 | return sources; 46 | } 47 | 48 | public void reset(){ 49 | xPos = 0; 50 | yPos = 0; 51 | zPos = 0; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.jdt.launching/libraryInfos.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/src/ClickPanel.java: -------------------------------------------------------------------------------- 1 | import java.awt.Color; 2 | import java.awt.event.MouseEvent; 3 | import java.awt.event.MouseListener; 4 | import javax.swing.JPanel; 5 | 6 | public class ClickPanel extends JPanel implements MouseListener{ 7 | 8 | int val; 9 | int valMax; 10 | 11 | public ClickPanel(int valM, int i, int j, int panelSize) { 12 | setOpaque(true); 13 | setBackground(new Color(170,205,170)); 14 | setVisible(true); 15 | setSize(panelSize, panelSize); 16 | setLocation(3+(i*panelSize) + (i), 3+(j*panelSize) + (j)); 17 | addMouseListener(this); 18 | 19 | valMax = valM; 20 | val = 0; 21 | } 22 | 23 | @Override 24 | public void mousePressed(MouseEvent e) { 25 | //System.out.println("Click!"); 26 | /*if(val%valMax == 1){ setBackground(Color.LIGHT_GRAY); } 27 | if(val%valMax == 0){ setBackground(Color.black); }*/ 28 | 29 | if(e.getButton() == MouseEvent.BUTTON1) {val = (val+1)%valMax;} 30 | if(e.getButton() == MouseEvent.BUTTON2) {val = 0;} 31 | if(e.getButton() == MouseEvent.BUTTON3) {val = (val-1)%valMax;} 32 | 33 | setBackground(setColor()); 34 | } 35 | 36 | public void setVal(int sval) { 37 | /*if(sval%valMax == 1){ setBackground(Color.black); } 38 | if(sval%valMax == 0){ setBackground(Color.LIGHT_GRAY); }*/ 39 | val = sval; 40 | setBackground(setColor()); 41 | } 42 | 43 | private Color setColor(){ 44 | 45 | double d = ((1-Math.abs(( (double) val / (double) valMax )))*127)+127; 46 | 47 | int de = (int) d; 48 | 49 | int rr = 0; 50 | int gg = 0; 51 | int bb = 0; 52 | 53 | if(val == 0) {rr=170;gg=205; bb=170;} 54 | if(val == 1) {rr=0; gg=190; bb=255;} 55 | if(val > 1) {rr=de; gg=de; bb=de;} 56 | 57 | if(val < 0) { 58 | de =(int) (((1-Math.abs(( (double) val / (double) valMax )))*191)); 59 | rr=255;gg=255-de; bb=191-de; 60 | } 61 | 62 | if(Math.abs(val) > valMax) {rr=0;gg=0;bb=0;} 63 | 64 | Color c = new Color(rr, gg, bb); 65 | 66 | System.out.println("D:" + d + " Val:" + val + " VM:" + valMax); 67 | 68 | return c; 69 | } 70 | 71 | 72 | 73 | 74 | @Override 75 | public void mouseReleased(MouseEvent arg0) {} 76 | @Override 77 | public void mouseClicked(MouseEvent arg0) {} 78 | @Override 79 | public void mouseEntered(MouseEvent arg0) {} 80 | @Override 81 | public void mouseExited(MouseEvent arg0) {} 82 | } 83 | -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/src/getImage.java: -------------------------------------------------------------------------------- 1 | import java.awt.Color; 2 | import java.awt.image.BufferedImage; 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.util.Random; 6 | 7 | import javax.imageio.ImageIO; 8 | 9 | 10 | public class getImage { 11 | String myfolder; 12 | int imagenum; 13 | 14 | public getImage(Universe u, String folder, int imagenumber) { 15 | myfolder = folder; 16 | imagenum = imagenumber; 17 | Random r = new Random(); 18 | 19 | BufferedImage buff = new BufferedImage(u.universe.length, u.universe[0].length, BufferedImage.TYPE_INT_RGB); 20 | int cellRGB = 0; 21 | for (int i = 0; i < u.universe.length; i++) { 22 | for (int j = 0; j < u.universe[0].length; j++) { 23 | 24 | float ageLimit = 16; 25 | float univ = (float)u.universe[i][j][0]; 26 | float mxv = (float)u.maxVal; 27 | 28 | if(mxv > ageLimit){ mxv = ageLimit;} 29 | 30 | float hue = univ/mxv; 31 | float antihue = univ/(float)u.minVal; 32 | 33 | 34 | 35 | if(u.maxVal > ageLimit && univ > ageLimit) { 36 | cellRGB = Color.HSBtoRGB(1, 0, 1); 37 | } else if(u.universe[i][j][0] < 0) { 38 | cellRGB = Color.HSBtoRGB((float) antihue, (float)1, (float)1); 39 | } else if(u.universe[i][j][0]==0) { 40 | cellRGB = Color.HSBtoRGB((float) 0, (float)0, (float)0); 41 | } else if(mxv == 1 && univ > 0) { 42 | cellRGB= Color.HSBtoRGB(1, 0, 1); 43 | } else { 44 | cellRGB = Color.HSBtoRGB((float) hue, (float)1, (float)1); 45 | } 46 | 47 | 48 | 49 | buff.setRGB(i, j, cellRGB); 50 | } 51 | } 52 | 53 | 54 | try { 55 | String imageName = ""; 56 | 57 | if(imagenum != -1) { 58 | System.out.println(imagenum); 59 | String zeroes = "00000000"; 60 | int imageNumLen = String.valueOf(imagenum).length(); 61 | for (int i = 0; i < imageNumLen; i++) { 62 | zeroes = zeroes.substring(0, 8-imageNumLen); 63 | } 64 | 65 | imageName = "im" + zeroes + imagenum; 66 | 67 | if(myfolder != "") { 68 | imageName = myfolder + "/" + imageName; 69 | } 70 | 71 | } else { 72 | 73 | imageName = ""; 74 | for(int i = 0; i < 8; i++) { 75 | imageName = r.nextInt(10) + imageName; 76 | } 77 | } 78 | 79 | ImageIO.write(buff, "bmp", new File(imageName+".bmp")); 80 | 81 | } catch (IOException e) { 82 | // TODO Auto-generated catch block 83 | e.printStackTrace(); 84 | } 85 | 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/src/slider.java: -------------------------------------------------------------------------------- 1 | 2 | import java.awt.Color; 3 | 4 | import javax.swing.JLabel; 5 | import javax.swing.JSlider; 6 | import javax.swing.event.ChangeEvent; 7 | import javax.swing.event.ChangeListener; 8 | 9 | 10 | public class slider implements ChangeListener { 11 | 12 | ml myml; 13 | int slideNum; 14 | JSlider mySlide; 15 | JLabel l; 16 | Main m; 17 | int xs; 18 | int ys; 19 | int zs; 20 | 21 | int[] xx; 22 | int[] yy; 23 | 24 | public slider(Main mm, int xSize, int ySize, int zSize, ml mymml, int sslideNum, int maxVal) { 25 | m=mm;; 26 | myml = mymml; 27 | slideNum=sslideNum; 28 | xs=xSize; 29 | ys=ySize-64; 30 | zs=zSize; 31 | 32 | xx = new int[2]; 33 | yy = new int[2]; 34 | 35 | xx[0] = xs+140+((slideNum*4)+8); 36 | xx[1] = 2; 37 | 38 | yy[0] = 4; 39 | yy[1] = xs+16; 40 | 41 | init(maxVal); 42 | 43 | /* l=new JLabel(); 44 | l.setOpaque(true); 45 | l.setBackground(Color.black); 46 | l.setVisible(true); 47 | l.setBounds(xx[0], yy[0], xx[1], yy[1]); 48 | 49 | m.add(l);*/ 50 | 51 | } 52 | 53 | public void stateChanged(ChangeEvent e) { 54 | JSlider source = (JSlider)e.getSource(); 55 | 56 | int sldVal = (int)source.getValue(); 57 | myml.slideVal[slideNum] = sldVal; 58 | myml.setRuleGDThresh(slideNum); 59 | } 60 | 61 | /*public void setState(int num) { 62 | int sldVal = num; 63 | myml.slideVal[slideNum] = sldVal; 64 | myml.setRuleGDThresh(slideNum); 65 | }*/ 66 | 67 | 68 | public void setMax(int val) { 69 | m.remove(mySlide); 70 | mySlide = new JSlider(JSlider.VERTICAL, 0, val, 0); 71 | mySlide.setVisible(true); 72 | mySlide.setLayout(null); 73 | mySlide.setBounds(xs+105+(slideNum*28), 4, 14, ys); 74 | mySlide.setVisible(true); 75 | mySlide.setMinorTickSpacing(1); 76 | mySlide.setPaintTicks(true); 77 | mySlide.addChangeListener(this); 78 | m.add(mySlide); 79 | } 80 | 81 | public void init(int val) { 82 | mySlide = new JSlider(JSlider.VERTICAL, 0, val, 0); 83 | mySlide.setVisible(true); 84 | mySlide.setLayout(null); 85 | mySlide.setBounds(xs+105+(slideNum*28), 4, 14, ys); 86 | mySlide.setVisible(true); 87 | mySlide.setMinorTickSpacing(1); 88 | mySlide.setPaintTicks(true); 89 | mySlide.addChangeListener(this); 90 | m.add(mySlide); 91 | } 92 | 93 | public void existential(boolean b){ 94 | mySlide.setEnabled(b); 95 | mySlide.setVisible(b); 96 | } 97 | 98 | public void setmajortick(boolean b){ 99 | mySlide.setEnabled(b); 100 | mySlide.setVisible(b); 101 | } 102 | 103 | } 104 | -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.core.resources/.history/4c/103978aa5e310014185be1b410184f15: -------------------------------------------------------------------------------- 1 | import java.awt.Color; 2 | import java.awt.image.BufferedImage; 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.util.Random; 6 | 7 | import javax.imageio.ImageIO; 8 | 9 | 10 | public class GetVid { 11 | String myfolder; 12 | int imagenum; 13 | 14 | public GetVid(Universe u, String folder, int imagenumber) { 15 | myfolder = folder; 16 | imagenum = imagenumber; 17 | Random r = new Random(); 18 | 19 | BufferedImage buff = new BufferedImage(u.universe.length*2, u.universe[0].length*2, BufferedImage.TYPE_INT_RGB); 20 | int cellRGB = 0; 21 | for (int i = 0; i < u.universe.length; i++) { 22 | for (int j = 0; j < u.universe[0].length; j++) { 23 | 24 | float ageLimit = 16; 25 | float univ = (float)u.universe[i][j][0]; 26 | float mxv = (float)u.maxVal; 27 | 28 | if(mxv > ageLimit){ mxv = ageLimit;} 29 | 30 | float hue = univ/mxv; 31 | float antihue = univ/(float)u.minVal; 32 | 33 | 34 | 35 | if(u.maxVal > ageLimit && univ > ageLimit) { 36 | cellRGB = Color.HSBtoRGB(1, 0, 1); 37 | } else if(u.universe[i][j][0] < 0) { 38 | cellRGB = Color.HSBtoRGB((float) antihue, (float)1, (float)1); 39 | } else if(u.universe[i][j][0]==0) { 40 | cellRGB = Color.HSBtoRGB((float) 0, (float)0, (float)0); 41 | } else if(mxv == 1 && univ > 0) { 42 | cellRGB= Color.HSBtoRGB(1, 0, 1); 43 | } else { 44 | cellRGB = Color.HSBtoRGB((float) hue, (float)1, (float)1); 45 | } 46 | 47 | 48 | 49 | buff.setRGB(i*2, j*2, cellRGB); 50 | buff.setRGB(i*2+1, j*2, cellRGB); 51 | buff.setRGB(i*2, j*2+1, cellRGB); 52 | buff.setRGB(i*2+1, j*2+1, cellRGB); 53 | } 54 | } 55 | 56 | 57 | try { 58 | String imageName = ""; 59 | 60 | if(imagenum != -1) { 61 | System.out.println(imagenum); 62 | String zeroes = "00000000"; 63 | int imageNumLen = String.valueOf(imagenum).length(); 64 | for (int i = 0; i < imageNumLen; i++) { 65 | zeroes = zeroes.substring(0, 8-imageNumLen); 66 | } 67 | 68 | imageName = "im" + zeroes + imagenum; 69 | 70 | if(myfolder != "") { 71 | imageName = myfolder + "/" + imageName; 72 | } 73 | 74 | } else { 75 | 76 | imageName = ""; 77 | for(int i = 0; i < 8; i++) { 78 | imageName = r.nextInt(10) + imageName; 79 | } 80 | } 81 | 82 | ImageIO.write(buff, "bmp", new File(imageName+".bmp")); 83 | 84 | } catch (IOException e) { 85 | // TODO Auto-generated catch block 86 | e.printStackTrace(); 87 | } 88 | 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/src/GetVid.java: -------------------------------------------------------------------------------- 1 | import java.awt.Color; 2 | import java.awt.image.BufferedImage; 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.util.Random; 6 | 7 | import javax.imageio.ImageIO; 8 | 9 | 10 | public class GetVid { 11 | String myfolder; 12 | int imagenum; 13 | int pixelMultiplier; 14 | 15 | public GetVid(Universe u, String folder, int imagenumber, int pixMulti) { 16 | myfolder = folder; 17 | imagenum = imagenumber; 18 | Random r = new Random(); 19 | pixelMultiplier = pixMulti; 20 | 21 | BufferedImage buff = new BufferedImage(u.universe.length*pixelMultiplier, u.universe[0].length*pixelMultiplier, BufferedImage.TYPE_INT_RGB); 22 | int cellRGB = 0; 23 | for (int i = 0; i < u.universe.length; i++) { 24 | for (int j = 0; j < u.universe[0].length; j++) { 25 | 26 | float ageLimit = 16; 27 | float univ = (float)u.universe[i][j][0]; 28 | float mxv = (float)u.maxVal; 29 | 30 | if(mxv > ageLimit){ mxv = ageLimit;} 31 | 32 | float hue = univ/mxv; 33 | float antihue = univ/(float)u.minVal; 34 | 35 | 36 | 37 | if(u.maxVal > ageLimit && univ > ageLimit) { 38 | cellRGB = Color.HSBtoRGB(1, 0, 1); 39 | } else if(u.universe[i][j][0] < 0) { 40 | cellRGB = Color.HSBtoRGB((float) antihue, (float)1, (float)1); 41 | } else if(u.universe[i][j][0]==0) { 42 | cellRGB = Color.HSBtoRGB((float) 0, (float)0, (float)0); 43 | } else if(mxv == 1 && univ > 0) { 44 | cellRGB= Color.HSBtoRGB(1, 0, 1); 45 | } else { 46 | cellRGB = Color.HSBtoRGB((float) hue, (float)1, (float)1); 47 | } 48 | 49 | 50 | for(int k = 0; k < pixelMultiplier; k++) { 51 | for(int l = 0; l < pixelMultiplier; l++) { 52 | buff.setRGB(i*pixelMultiplier+k, j*pixelMultiplier+l, cellRGB); 53 | } 54 | } 55 | 56 | } 57 | } 58 | 59 | 60 | try { 61 | String imageName = ""; 62 | 63 | if(imagenum != -1) { 64 | System.out.println(imagenum); 65 | String zeroes = "00000000"; 66 | int imageNumLen = String.valueOf(imagenum).length(); 67 | for (int i = 0; i < imageNumLen; i++) { 68 | zeroes = zeroes.substring(0, 8-imageNumLen); 69 | } 70 | 71 | imageName = "im" + zeroes + imagenum; 72 | 73 | if(myfolder != "") { 74 | imageName = myfolder + "/" + imageName; 75 | } 76 | 77 | } else { 78 | 79 | imageName = ""; 80 | for(int i = 0; i < 8; i++) { 81 | imageName = r.nextInt(10) + imageName; 82 | } 83 | } 84 | 85 | ImageIO.write(buff, "bmp", new File(imageName+".bmp")); 86 | 87 | } catch (IOException e) { 88 | // TODO Auto-generated catch block 89 | e.printStackTrace(); 90 | } 91 | 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/src/ToggleFrame.java: -------------------------------------------------------------------------------- 1 | 2 | import javax.swing.JFrame; 3 | 4 | 5 | public class ToggleFrame extends JFrame { 6 | 7 | ClickPanel[][] pp; 8 | 9 | int pXCount = 0; 10 | int pYCount = 0; 11 | int lastsize = 12; 12 | 13 | public ToggleFrame(ml ML) { 14 | initTF(); 15 | jMenuEditor jmen = new jMenuEditor(this, ML); 16 | } 17 | 18 | public void initTF(){ 19 | int panelSize = 10; 20 | int panels = lastsize; 21 | int frameSize = (panelSize+1)*panels; 22 | 23 | setLayout(null); 24 | 25 | int frx = frameSize+8+8; 26 | int fry = frameSize+30+22+8; 27 | 28 | if(frx < 96) { frx = 96; } 29 | if(fry < 96) { fry = 96; } 30 | 31 | setSize(frx, fry); 32 | 33 | setVisible(false); 34 | setResizable(false); 35 | setLocation(96, 32); 36 | 37 | int panelsX = (frameSize/(panelSize+1)); 38 | int panelsY = (frameSize/(panelSize+1)); 39 | pXCount = panelsX; 40 | pYCount = panelsY; 41 | 42 | pp = new ClickPanel[panelsX][panelsY]; 43 | 44 | for(int i = 0; i < panelsX; i++) { 45 | for(int j = 0; j < panelsY; j++) { 46 | pp[i][j] = new ClickPanel(2, i, j, panelSize); 47 | add(pp[i][j]); 48 | } 49 | } 50 | } 51 | 52 | public void reinitTF(int blockSize){ 53 | int panelSize = 10; 54 | int panels = blockSize; 55 | if(panels == -1) {panels = lastsize;} else {lastsize = panels;} 56 | int frameSize = (panelSize+1)*panels; 57 | 58 | int frx = frameSize+8+8; 59 | int fry = frameSize+30+22+8; 60 | 61 | if(frx < 96) { frx = 96; } 62 | if(fry < 96) { fry = 96; } 63 | 64 | setSize(frx, fry); 65 | 66 | setLocation(96, 32); 67 | 68 | for(int i = 0; i < pYCount; i++) { 69 | for(int j = 0; j < pXCount; j++) { 70 | remove(pp[i][j]); 71 | } 72 | } 73 | 74 | pp = null; 75 | 76 | int panelsX = (frameSize/(panelSize+1)); 77 | int panelsY = (frameSize/(panelSize+1)); 78 | pXCount = panelsX; 79 | pYCount = panelsY; 80 | pp = new ClickPanel[panelsX][panelsY]; 81 | 82 | for(int i = 0; i < panelsX; i++) { 83 | for(int j = 0; j < panelsY; j++) { 84 | pp[i][j] = new ClickPanel(16, i, j, panelSize); 85 | add(pp[i][j]); 86 | } 87 | } 88 | } 89 | 90 | public void togShowTF() { 91 | if(this.isVisible()) { 92 | this.dispose(); 93 | } else { 94 | setVisible(true); 95 | } 96 | } 97 | 98 | public void showTF() { 99 | setVisible(true); 100 | } 101 | 102 | public int [][] getPanelStates() { 103 | int[][] output = new int[pp.length][pp[0].length]; 104 | String ss = ""; 105 | 106 | for(int j = 0; j < pp.length; j++) { 107 | for(int i = 0; i < pp[j].length; i++) { 108 | 109 | output[i][j] = pp[i][j].val; 110 | ss+=output[i][j] + ","; 111 | 112 | } 113 | ss+="\n"; 114 | } 115 | System.out.println(ss); 116 | return output; 117 | } 118 | 119 | 120 | } 121 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Automata-Gen-3/Omniscience 2 | ============== 3 | This is my full Eclipse workspace folder, plus runnable jar. 4 | 5 | YouTube videos of this program can be found at https://www.youtube.com/channel/UCZD4RoffXIDoEARW5aGkEbg/videos 6 | 7 | Setup: 8 | 9 | - Run program from included jar, or through Eclipse by selecting the "Automata-Gen-3-master/workspace" folder on program start. You could also import the included source to another IDE. 10 | 11 | ============== 12 | 13 | Basic Use: 14 | 15 | - Right click to toggle Play/Pause. 16 | 17 | - Left click on the grid use the selected Tool. 18 | 19 | - Scroll Wheel will cycle through the selected MouseWheel menu item. 20 | 21 | ============== 22 | 23 | Colour Scheme & Graphics: 24 | 25 | - Cells are one pixel each. I recommend using 'magnifier' on windows or 'KMag' on Linux when viewing. 26 | 27 | - Colour Scheme can be changed from the MouseWheel menu. 28 | 29 | - Positive Numbers are typically black or grey-scale. 30 | 31 | - Negative numbers are typically Red or Red-to-Yellow. 32 | 33 | - When the maximum value of all cells is 1, all cells of value 1 are black. 34 | 35 | - When the maximum value is larger than one, value 1 is light blue. 36 | 37 | 38 | 39 | 40 | ============== 41 | Notable Features, Advanced Use & Techniques (wip): 42 | ============== 43 | 44 | 3D: Every rule is viewable in a single 'plane' or Z-Layer, but these layers can, and might interact 45 | 46 | - There is limited 3D support, involving what the user interface names 'layers'. Default universe settings include 16 layers. 47 | 48 | - Default settings only compute the one layer that is active. 49 | 50 | - Activating all layers for computation can be done using the value -1 under dialog option "Target Z-Layer" of menu item 'Ruleset'/'Recast Rule Parameters'. 51 | 52 | - Some preset rules are aware of neighbours present in 3D space, and will typically behave strangely or resist change when only one layer is active. 53 | 54 | - UI: Reseed All & Erase All will affect all layers. Reseed Layer & Erase Layer only affect the currently viewed layer. 55 | 56 | ============== 57 | 58 | Tool Control: Tools can be used to place blocks when the universe is both paused & running 59 | 60 | - Tools are used by left-clicking and/or dragging. 61 | 62 | - Tools can be configured to have any integer: Placement Area, Value, Distribution Strength: Random(1/x), Value Variation: Random(x). 63 | 64 | - Size and Value can be mapped to the MouseWheel, allowing quick tool adjustments. 65 | 66 | - Config Example: To set a tool's Random Value Distribution between -50 and +50, set the tool value to -50, and set the value variation to 101. 67 | 68 | Special Cases: 69 | 70 | - 'Tools'/'Place Random Blocks' with Subfunctions 2 & 3: The distribution is set to spaceing 3 and spacing 2 horizontal lines instead of solid blocks. 71 | 72 | - 'Tools'/'Place Random Blocks' with Subfunctions 1: Random values between -16 and 16 will be placed, in random positions. 73 | 74 | - 'Tools'/'Apply Custom Tool': The last user-set tool will be restored and activated. 75 | 76 | - 'Editor'/'Tool: Copy': Captures data from the grid to the clipboard 77 | 78 | - 'Editor'/'Tool: Paste': Pastes data from the clipboard 79 | 80 | ============== 81 | 82 | Seeding: Placing initial values or value-overrides into the grid 83 | 84 | - You can reseed both the current active layer, and all 3D layers through the 'Universe'/'Reseed' options 85 | 86 | - Seeding can be configured under 'Universe'/'Set Seed' 87 | 88 | - 'Constant Seeding' is a special Rule that applies a seed from RNG each turn. It is considered as 'Rule -1', and can be added through the menu 'Ruleset'/'Add Constant Seeding' 89 | 90 | - 'Constant Seeding' is configurable like all rules that have additional parameters. It can be modified through the 'Ruleset'/'Recast Rule Parameters' menu item. 91 | 92 | ============== 93 | 94 | Full Menu Option Guide (wip) 95 | 96 | ============== -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 6 | 7 | 8 | 9 |
10 |
11 |
12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 |
26 |
27 |
28 | -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/src/Universe.java: -------------------------------------------------------------------------------- 1 | import java.io.File; 2 | import java.util.Random; 3 | 4 | 5 | public class Universe { 6 | 7 | //define the container of the universe array 8 | public int[][][] universe; //Dimensions considered x, y, z 9 | public int[][][] snapshotUniverse; //Stores a unchanged copy of the whole exact universal state 10 | 11 | public int[][] instructions; //Contains the data for this universe's actions 12 | 13 | public int maxVal; //for strictly display purposes according to philosophy. Knowing or referencing this value would cause universal nonlocality. 14 | public int minVal; 15 | 16 | int xlen; 17 | int ylen; 18 | int zlen; 19 | int record = -1; 20 | int recordCounter=1; 21 | int recordZoom = 1; 22 | Random r = new Random(); 23 | 24 | public boolean paused = false; 25 | 26 | automataLib a; 27 | dataSources d; 28 | 29 | String folder; 30 | 31 | //set the universal array 32 | public Universe(int x, int y, int z, automataLib aa) { 33 | System.out.println("Universe" + this); 34 | xlen = x; 35 | ylen = y; 36 | zlen = z; 37 | 38 | a=aa; 39 | 40 | universe = new int[x][y][z]; 41 | snapshotUniverse = new int[x][y][z]; 42 | 43 | resetAr(0); //sets each x,y,z to 0; instanciating the array. 44 | 45 | } 46 | 47 | 48 | public void name() { 49 | folder = String.valueOf(r.nextInt(10)); 50 | 51 | for(int i = 0; i < 5; i++){ 52 | folder = r.nextInt(10) + folder; 53 | } 54 | new File(folder).mkdirs(); 55 | } 56 | 57 | //hard resets all the xyz values to val, resets maxval = 1. 58 | public void resetAr(int val) { 59 | 60 | 61 | for(int i = 0; i < universe.length; i++) { 62 | for (int j = 0; j < universe[0].length; j++) { 63 | for (int k = 0; k < universe[0][0].length; k++) { 64 | universe[i][j][k] = val; 65 | } 66 | } 67 | } 68 | 69 | 70 | } 71 | 72 | //resets the z-layer only, to this value 73 | public void resetArZ(int val, int zz) { 74 | 75 | 76 | for(int i = 0; i < universe.length; i++) { 77 | for (int j = 0; j < universe[0].length; j++) { 78 | universe[i][j][zz] = val; 79 | } 80 | } 81 | 82 | 83 | } 84 | 85 | 86 | //Snapshots the universe in it's current state, storing all values exactly as is, in snapshotUniverse[][][] 87 | public void snap() { 88 | a.incrGen(); 89 | for(int i = 0; i < universe.length; i++) { 90 | for (int j = 0; j < universe[0].length; j++) { 91 | for (int k = 0; k < universe[0][0].length; k++) { 92 | snapshotUniverse[i][j][k] = universe[i][j][k]; //copy the array 93 | } 94 | } 95 | } 96 | } 97 | 98 | //Takes the Z frame and resets it to the maxval for just that frame 99 | public /*int*/void maxValAudit(int k) { 100 | maxVal = 1; 101 | minVal = -1; 102 | //int total = 0; 103 | for(int i = 0; i < universe.length; i++) { 104 | for (int j = 0; j < universe[0].length; j++) { 105 | int univ = universe[i][j][k]; 106 | if(univ > maxVal) { maxVal = univ; } 107 | if(univ < minVal) { minVal = univ; } 108 | //total+=universe[i][j][k]; 109 | } 110 | } 111 | //return total; 112 | } 113 | 114 | ///////////////////////////////////////////// 115 | // UNIVERSE CONTROL // 116 | ///////////////////////////////////////////// 117 | 118 | //Garden of Eden, absolute seed for t=0 119 | public void runOnce(int rand, int val) { 120 | a.setTargetUni(this); 121 | a.seedAll(rand,val,1); 122 | } 123 | 124 | //handles the universal calculations 125 | public void updateUniverse() { 126 | if (!paused) { 127 | 128 | snap(); //snapshots the board to u.snapshotUniverse to ensure all functions have equal execution options 129 | a.setTargetUni(this); //Ensures that the logic controller acts apon THIS universe 130 | 131 | for(int i = 0; i < xlen; i++) { 132 | for (int j = 0; j < ylen; j++) { 133 | for (int k = 0; k < zlen; k++) { 134 | 135 | for (int ii = 0; ii < instructions.length; ii++) { 136 | //select the instruction from the array, and execute the function 137 | a.n.instrNum = ii; 138 | a.readInstructions(instructions[ii], i, j, k); 139 | } 140 | 141 | } 142 | } 143 | } 144 | 145 | if(record != -1 && recordCounter%(record) == 0){ 146 | System.out.println("Imaged"); 147 | new GetVid(this, folder, recordCounter, recordZoom); 148 | recordCounter++; 149 | } 150 | 151 | } 152 | } 153 | 154 | 155 | } 156 | -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.core.resources/.history/92/401f13e55e310014185be1b410184f15: -------------------------------------------------------------------------------- 1 | import java.io.File; 2 | import java.util.Random; 3 | 4 | 5 | public class Universe { 6 | 7 | //define the container of the universe array 8 | public int[][][] universe; //Dimensions considered x, y, z 9 | public int[][][] snapshotUniverse; //Stores a unchanged copy of the whole exact universal state 10 | 11 | public int[][] instructions; //Contains the data for this universe's actions 12 | 13 | public int maxVal; //for strictly display purposes according to philosophy. Knowing or referencing this value would cause universal nonlocality. 14 | public int minVal; 15 | 16 | int xlen; 17 | int ylen; 18 | int zlen; 19 | int record = -1; 20 | int recordCounter=1; 21 | Random r = new Random(); 22 | 23 | public boolean paused = false; 24 | 25 | automataLib a; 26 | dataSources d; 27 | 28 | String folder; 29 | 30 | //set the universal array 31 | public Universe(int x, int y, int z, automataLib aa) { 32 | System.out.println("Universe" + this); 33 | xlen = x; 34 | ylen = y; 35 | zlen = z; 36 | 37 | a=aa; 38 | 39 | universe = new int[x][y][z]; 40 | snapshotUniverse = new int[x][y][z]; 41 | 42 | resetAr(0); //sets each x,y,z to 0; instanciating the array. 43 | 44 | } 45 | 46 | 47 | public void name() { 48 | folder = String.valueOf(r.nextInt(10)); 49 | 50 | for(int i = 0; i < 5; i++){ 51 | folder = r.nextInt(10) + folder; 52 | } 53 | new File(folder).mkdirs(); 54 | } 55 | 56 | //hard resets all the xyz values to val, resets maxval = 1. 57 | public void resetAr(int val) { 58 | 59 | 60 | for(int i = 0; i < universe.length; i++) { 61 | for (int j = 0; j < universe[0].length; j++) { 62 | for (int k = 0; k < universe[0][0].length; k++) { 63 | universe[i][j][k] = val; 64 | } 65 | } 66 | } 67 | 68 | 69 | } 70 | 71 | //resets the z-layer only, to this value 72 | public void resetArZ(int val, int zz) { 73 | 74 | 75 | for(int i = 0; i < universe.length; i++) { 76 | for (int j = 0; j < universe[0].length; j++) { 77 | universe[i][j][zz] = val; 78 | } 79 | } 80 | 81 | 82 | } 83 | 84 | 85 | //Snapshots the universe in it's current state, storing all values exactly as is, in snapshotUniverse[][][] 86 | public void snap() { 87 | a.incrGen(); 88 | for(int i = 0; i < universe.length; i++) { 89 | for (int j = 0; j < universe[0].length; j++) { 90 | for (int k = 0; k < universe[0][0].length; k++) { 91 | snapshotUniverse[i][j][k] = universe[i][j][k]; //copy the array 92 | } 93 | } 94 | } 95 | } 96 | 97 | //Takes the Z frame and resets it to the maxval for just that frame 98 | public /*int*/void maxValAudit(int k) { 99 | maxVal = 1; 100 | minVal = -1; 101 | //int total = 0; 102 | for(int i = 0; i < universe.length; i++) { 103 | for (int j = 0; j < universe[0].length; j++) { 104 | int univ = universe[i][j][k]; 105 | if(univ > maxVal) { maxVal = univ; } 106 | if(univ < minVal) { minVal = univ; } 107 | //total+=universe[i][j][k]; 108 | } 109 | } 110 | //return total; 111 | } 112 | 113 | ///////////////////////////////////////////// 114 | // UNIVERSE CONTROL // 115 | ///////////////////////////////////////////// 116 | 117 | //Garden of Eden, absolute seed for t=0 118 | public void runOnce(int rand, int val) { 119 | a.setTargetUni(this); 120 | a.seedAll(rand,val,1); 121 | } 122 | 123 | //handles the universal calculations 124 | public void updateUniverse() { 125 | if (!paused) { 126 | 127 | snap(); //snapshots the board to u.snapshotUniverse to ensure all functions have equal execution options 128 | a.setTargetUni(this); //Ensures that the logic controller acts apon THIS universe 129 | 130 | for(int i = 0; i < xlen; i++) { 131 | for (int j = 0; j < ylen; j++) { 132 | for (int k = 0; k < zlen; k++) { 133 | 134 | for (int ii = 0; ii < instructions.length; ii++) { 135 | //select the instruction from the array, and execute the function 136 | a.n.instrNum = ii; 137 | a.readInstructions(instructions[ii], i, j, k); 138 | } 139 | 140 | } 141 | } 142 | } 143 | 144 | if(record != -1 && recordCounter%(record) == 0){ 145 | System.out.println("Imaged"); 146 | new GetVid(this, folder, recordCounter); 147 | recordCounter++; 148 | } 149 | 150 | } 151 | } 152 | 153 | 154 | } 155 | -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/src/Main.java: -------------------------------------------------------------------------------- 1 | import java.awt.Color; 2 | import java.awt.Component; 3 | import java.util.Random; 4 | 5 | import javax.swing.JFrame; 6 | import javax.swing.JOptionPane; 7 | import javax.swing.SwingConstants; 8 | import javax.swing.SwingUtilities; 9 | import javax.swing.JLabel; 10 | 11 | @SuppressWarnings("serial") 12 | public class Main extends JFrame { 13 | 14 | public Main(){ 15 | 16 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 17 | 18 | int x=200, y=200, z=16; 19 | 20 | String str = JOptionPane.showInputDialog(this, "Length", x); 21 | if(str != null) { 22 | x = Integer.parseInt(str); 23 | } 24 | 25 | str = JOptionPane.showInputDialog(this, "Height", y); 26 | if(str != null) { 27 | y = Integer.parseInt(str); 28 | } 29 | 30 | str = JOptionPane.showInputDialog(this, "Depth", z); 31 | if(str != null) { 32 | z = Integer.parseInt(str); 33 | } 34 | 35 | setSizes(x, y, z); 36 | } 37 | 38 | public void setSizes(int xSize, int ySize, int zSize) { 39 | 40 | int minMenuXLen = 340; 41 | int minMenuYLen = 260; 42 | 43 | int surfaces = 1; //Total number of displays 44 | int universes = 1; //Total number of universes 45 | 46 | JLabel l = new JLabel(); //Textbox for info display 47 | Surf[] s = new Surf[surfaces]; //Array of surface displays 48 | Universe[] u = new Universe[universes]; //Array of universes/worlds 49 | automataLib[] a = new automataLib[universes]; //Performs all automata functions for the sim; 50 | slider[] sl = new slider[2]; 51 | 52 | //Instanciate automataLibs 53 | //This may be unnessessary 54 | a[0] = new automataLib(this,xSize,ySize); 55 | 56 | //Instanciate Universes 57 | //This can be used to run different simulations in different surfaces. 58 | //still only runs one once cpu core per Main instance. 59 | //number of z layers is determined here 60 | 61 | // Xsize Ysize Zsize automataLib 62 | u[0] = new Universe(xSize, ySize, zSize, a[0]); 63 | 64 | //u[1] = new Universe(xSize, ySize, 2, a[1]); 65 | 66 | 67 | /*There is a list of functions in automatalib. 68 | * If you need to know the function's parameter types and appropriate values, 69 | * look inside automatalib. 70 | */ 71 | 72 | //Set Universal initial parameters 73 | //This determines which automata functions to run in what order, and with which parameter values. 74 | 75 | u[0].instructions = new int[][] { 76 | //Fill out Integer instruction arrays here. 77 | //{InstructionNumber, Z-layer, args[2-4]...} 78 | 79 | {0,0,1,1,1} 80 | 81 | }; 82 | 83 | int xxsize = (xSize+2+2) * surfaces + 6 + 2 +120 + 56; 84 | int yysize = (ySize+2) * surfaces + 42 + 24 + 2+8; 85 | 86 | if(xSize < minMenuXLen) {if(xxsize < minMenuXLen){xxsize = minMenuXLen;}} 87 | if(ySize < minMenuYLen) {if(yysize < minMenuYLen){yysize = minMenuYLen;}} 88 | 89 | 90 | 91 | //dataSources d = new dataSources(); //used for seeding/creating predefined patterns 92 | 93 | ml myml = new ml(this,s,l,u,sl); //Mouselistener for user input; 94 | sl[0] = new slider(this,xSize,yysize,zSize, myml, 0, 5); 95 | sl[1] = new slider(this,xSize,yysize,zSize, myml, 1, 25); 96 | 97 | //slider sl3 = new slider(m,xSize,ySize,zSize, myml, 2, 0); 98 | 99 | mwl mymwl = new mwl(this,myml); //MouseWheelListener for user input; 100 | MouseMotionList mMot = new MouseMotionList(this, myml); //MouseWheelListener for user input; 101 | jMenuMain jmen = new jMenuMain(myml); //add Menu Gui 102 | 103 | //Set parameters for each surface/display panel 104 | for(int i = 0; i < surfaces; i++) { 105 | // (Width, Height, Depth, X, Y, Assigned universe) 106 | s[i] = new Surf(xSize, ySize, u[0].zlen, (xSize*i)+(2*i)+2+2, (ySize*i)+(2*i)+16+2, u[0]); 107 | } 108 | 109 | //Textbox for info display 110 | l.setLayout(null); 111 | l.setBounds(xSize+16, 2, 80+40, 14*(10+4)); 112 | l.setVisible(true); 113 | 114 | l.setText("Menu"); 115 | 116 | //Layout for Main window/frame 117 | this.setLayout(null); 118 | 119 | this.setSize(xxsize, yysize); 120 | 121 | this.setVisible(true); 122 | this.setResizable(false); 123 | this.setLocation(96, 32); 124 | 125 | //Assemble the components 126 | this.add(l); 127 | for(int i = 0; i < surfaces; i++) { this.add(s[i]); } 128 | 129 | //Configure initial state 130 | jmen.setGUI(this); 131 | 132 | 133 | myml.updateListing(); //show menu on start 134 | 135 | myml.toggleStart(); //Plays a fram so the universe is visible, unpauses 136 | myml.toggleStart(); //second toggle pauses 137 | 138 | //makes sure first surface is visible 139 | u[0].runOnce(1,0); 140 | 141 | //Kickstart u[0] with the action in class Universe. Usually a seeding. 142 | //Takes int: rand, val 143 | u[0].runOnce(myml.seedRand,myml.seedVal); 144 | 145 | myml.ruleChanged(0); 146 | 147 | myml.refresh(); 148 | 149 | 150 | } 151 | 152 | public static void main(String[] args) { 153 | 154 | SwingUtilities.invokeLater(new Runnable() { 155 | @Override 156 | public void run() { //breaks program's static dependance 157 | new Main(); //Main window/frame 158 | } 159 | }); 160 | } 161 | 162 | 163 | 164 | } 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/src/Surf.java: -------------------------------------------------------------------------------- 1 | import java.awt.Color; 2 | import java.awt.Graphics; 3 | import java.awt.Graphics2D; 4 | 5 | import javax.swing.JPanel; 6 | 7 | 8 | @SuppressWarnings("serial") 9 | public class Surf extends JPanel { 10 | 11 | 12 | //reference coordinates 13 | int xx; 14 | int yy; 15 | int zz; 16 | 17 | //Display colour contianers 18 | int col1 = 0; 19 | int col2 = 0; 20 | int col3 = 0; //RGB colour ints 21 | float[] floats = new float[3]; //holds rgb -> hsb conversion vals 22 | double pGradient; //used for calculation of the gradient 23 | double pNegGradient; //used for calculation of the gradient 24 | 25 | //config 26 | public boolean paused = true; //boolean that vetos display progression 27 | public boolean upaused = true; //boolean that vetos universe progression 28 | int zdraw = 0; //which z layer do I show, if z is a fixed reference? 29 | int colourScheme = -1; 30 | 31 | Universe u; //main logic container 32 | 33 | /***********************************************************************************************/ 34 | 35 | 36 | //constructor 37 | public Surf(int myX, int myY, int myZ, int xloc, int yloc, Universe uni) { 38 | 39 | //set display reference 40 | u = uni; 41 | 42 | //Define display size 43 | xx=myX; 44 | yy=myY; 45 | zz=myZ; 46 | 47 | //set up the display 48 | setSize(myX, myY); 49 | setLocation(xloc, yloc); 50 | } 51 | 52 | 53 | //main display output 54 | private void doDrawing(Graphics g) { 55 | //Begin Draw configuration 56 | 57 | if(!upaused) {u.updateUniverse();} //perform a full cycle of logical iteration 58 | 59 | u.maxValAudit(zdraw); //only audit maxval for this z-value 60 | Graphics2D g2d = (Graphics2D) g; //some sort of magic. 61 | /**/int k=zdraw;/**/ //for fixed z-value, processes in layers 62 | 63 | for (int i = 0; i < xx; i++) { 64 | for (int j = 0; j < yy; j++) { 65 | 66 | if(colourScheme == 0) { 67 | //calculate positive-value gradient: white < grey < black 68 | 69 | pGradient = /*255-*/ ( ((double) u.universe[i][j][k]/u.maxVal) *255); 70 | 71 | pNegGradient = 255- ( ((double) u.universe[i][j][k]/u.minVal) *255); 72 | 73 | int pp = (int) pGradient; 74 | int pn = (int) pNegGradient; 75 | 76 | //give individual colours to specific values 77 | if(u.universe[i][j][k]==0) { 78 | col3=185; col2=195; col1=215; 79 | } else if(u.universe[i][j][k]<0) { 80 | col3=0; col2=255-pn; col1=255; 81 | } else { 82 | col3=pp; col2=pp; col1 = pp; 83 | } 84 | 85 | if(u.universe[i][j][k]==1 && u.maxVal != 1) {col3=180; col2=180; col1=0;} 86 | if(u.universe[i][j][k]==1 && u.maxVal == 1) {col3=0; col2=0; col1=0;} 87 | } 88 | 89 | if(colourScheme == 1) { 90 | if(u.universe[i][j][k]==0) { 91 | col3=255; col2=255; col1=255; 92 | } else { 93 | col3=0; col2=0; col1=0; 94 | } 95 | } 96 | 97 | if(colourScheme == 2) { 98 | if(u.universe[i][j][k]==0) { 99 | col3=255; col2=255; col1=255; 100 | } else if(u.universe[i][j][k]>=1){ 101 | col3=0; col2=0; col1=0; 102 | } else { 103 | col3=0; col2=0; col1=255; 104 | } 105 | } 106 | 107 | if(colourScheme == 3) { 108 | if(u.universe[i][j][k]==0) { 109 | col3=255; col2=255; col1=255; 110 | } else if(u.universe[i][j][k]>=1){ 111 | col3=0; col2=0; col1=0; 112 | } else { 113 | col3=0; col2=0; col1=255; 114 | } 115 | if(u.universe[i][j][k]==1 && u.maxVal != 1) {col3=180; col2=180; col1=0;} 116 | } 117 | 118 | if(colourScheme == -1) { 119 | float ageLimit = 16; 120 | if(u.maxVal > ageLimit && u.universe[i][j][k] > ageLimit) { 121 | g2d.setColor(Color.getHSBColor(1, 0, 1)); 122 | } else { 123 | 124 | float univ = (float)u.universe[i][j][k]; 125 | float mxv = (float)u.maxVal; 126 | 127 | 128 | if(mxv > ageLimit){ mxv = ageLimit; /*univ = univ/ageLimit;*/} 129 | 130 | 131 | float hue = univ/mxv; 132 | float antihue = univ/(float)u.minVal; 133 | 134 | if(u.universe[i][j][k] < 0) { 135 | g2d.setColor(Color.getHSBColor((float) antihue, 1, 1)); 136 | } else if(u.universe[i][j][k]==0) { 137 | g2d.setColor(Color.getHSBColor((float) 0, 0, (float)0.25)); 138 | } else { 139 | g2d.setColor(Color.getHSBColor((float) hue, 1, 1)); 140 | } 141 | 142 | if(u.maxVal == 1 && u.universe[i][j][k] > 0) { 143 | g2d.setColor(Color.getHSBColor(1, 0, 1)); 144 | } 145 | 146 | } 147 | 148 | 149 | //System.out.println(hue); 150 | 151 | } else { 152 | //prepare to draw 153 | floats = Color.RGBtoHSB(col1, col2, col3, floats); 154 | g2d.setColor(Color.getHSBColor(floats[0],floats[1],floats[2])); 155 | 156 | //draw 157 | } 158 | 159 | g2d.drawLine(i,j,i,j); 160 | } 161 | } 162 | 163 | //draw and recurve 164 | if(!paused && upaused) { 165 | paused = true; 166 | repaint(); 167 | } else { repaint(); } 168 | //End Drawing cycle 169 | } 170 | 171 | 172 | //repaint() calls this 173 | @Override 174 | public void paintComponent(Graphics g) { 175 | //Begin paintComponent output 176 | if(!paused){ 177 | super.paintComponent(g); 178 | doDrawing(g); 179 | } 180 | } 181 | 182 | } -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/src/jMenuEditor.java: -------------------------------------------------------------------------------- 1 | 2 | import java.awt.event.ActionEvent; 3 | import java.awt.event.ActionListener; 4 | 5 | import javax.swing.JMenu; 6 | import javax.swing.JMenuItem; 7 | import javax.swing.JMenuBar; 8 | 9 | public class jMenuEditor implements ActionListener { 10 | 11 | ToggleFrame TF; 12 | ml ML; 13 | int[][] nbrhood; 14 | //constructor, captures UI controller: ml 15 | public jMenuEditor(ToggleFrame TFrame, ml mML) { 16 | ML = mML; 17 | TF = TFrame; 18 | TF.setJMenuBar(createMenuBar()); 19 | } 20 | 21 | public JMenuBar createMenuBar() { 22 | 23 | JMenuBar menuBar; 24 | JMenu menu; 25 | JMenuItem menuItem; 26 | //JMenu submenu; 27 | 28 | //menu bar 29 | menuBar = new JMenuBar(); 30 | 31 | //create new menu 32 | menu = new JMenu("Clipboard"); 33 | menuBar.add(menu); 34 | 35 | //Populate menu 36 | menuItem = new JMenuItem("-> Paste From Clip"); 37 | menuItem.addActionListener(this); 38 | menu.add(menuItem); 39 | 40 | menuItem = new JMenuItem("Copy To Clip ->"); 41 | menuItem.addActionListener(this); 42 | menu.add(menuItem); 43 | 44 | menu = new JMenu("Other"); 45 | menuBar.add(menu); 46 | 47 | //Populate menu 48 | menuItem = new JMenuItem("-> Set Neighbourhood"); 49 | menuItem.addActionListener(this); 50 | menu.add(menuItem); 51 | 52 | /* menuItem = new JMenuItem("-> Set Rule(WIP)"); 53 | menuItem.addActionListener(this); 54 | menu.add(menuItem); */ 55 | 56 | return menuBar; 57 | } 58 | 59 | public void actionPerformed(ActionEvent e) { 60 | 61 | JMenuItem source = (JMenuItem)(e.getSource()); 62 | 63 | /*if(source.getText() == "Print Data") { 64 | if(TF != null) { 65 | int[][] tmpInt = TF.getPanelStates(); 66 | } else { 67 | System.out.println("NULL POINTER EXCEPTION"); 68 | } 69 | } */ 70 | 71 | 72 | if(source.getText() == "-> Paste From Clip") { 73 | if(TF != null) { 74 | int[][][] intAr = ML.d.getArray(); 75 | for(int i = 0; i < TF.pp.length; i++){ 76 | for(int j = 0; j < TF.pp[i].length; j++){ 77 | TF.pp[j][i].setVal(intAr[j][i][0]); 78 | } 79 | } 80 | 81 | } else { 82 | System.out.println("NULL POINTER EXCEPTION"); 83 | } 84 | } 85 | 86 | 87 | if(source.getText() == "Copy To Clip ->") { 88 | if(TF != null) { 89 | int[][][] intAr = new int[TF.pp.length][TF.pp[0].length][1]; 90 | for(int i = 0; i < TF.pp.length; i++){ 91 | for(int j = 0; j < TF.pp[i].length; j++){ 92 | intAr[j][i][0] = TF.pp[j][i].val; 93 | } 94 | } 95 | 96 | ML.d.setArray(intAr); 97 | 98 | } else { 99 | System.out.println("NULL POINTER EXCEPTION"); 100 | } 101 | } 102 | 103 | if(source.getText() == "-> Set Neighbourhood") { 104 | if(TF != null) { 105 | int[][][] intAr = new int[TF.pp.length][TF.pp[0].length][1]; 106 | for(int i = 0; i < TF.pp.length; i++){ 107 | for(int j = 0; j < TF.pp[i].length; j++){ 108 | intAr[j][i][0] = TF.pp[j][i].val; 109 | } 110 | } 111 | 112 | /*String s = ""; 113 | for(int i = 0; i < TF.pp.length; i++){ 114 | for(int j = 0; j < TF.pp[i].length; j++){ 115 | s+=intAr[j][i][0]; 116 | } 117 | s+="\n"; 118 | } 119 | System.out.println(s);*/ 120 | 121 | //get the centre cell (-1) 122 | int ii=0; 123 | int jj=0; 124 | 125 | for(int i = 0; i < TF.pp.length; i++){ 126 | for(int j = 0; j < TF.pp[i].length; j++){ 127 | if(intAr[i][j][0] == -1) {ii=i;jj=j;} 128 | } 129 | } 130 | 131 | System.out.println("i:"+ii+" j:" +jj); 132 | 133 | //get number of == 1 cells 134 | int nbrCount = 0; 135 | for(int i = 0; i < TF.pp.length; i++){ 136 | for(int j = 0; j < TF.pp[i].length; j++){ 137 | if(intAr[j][i][0] == 1) { 138 | nbrCount++; 139 | } 140 | } 141 | } 142 | 143 | //get 1-cell locations 144 | nbrhood = new int[nbrCount][4]; 145 | int placedNbr = nbrCount; 146 | 147 | for(int i = 0; i < TF.pp.length; i++){ 148 | for(int j = 0; j < TF.pp[i].length; j++){ 149 | if(intAr[i][j][0] == 1) { 150 | nbrhood[nbrCount-placedNbr][0]=i; 151 | nbrhood[nbrCount-placedNbr][1]=j; 152 | nbrhood[nbrCount-placedNbr][2] = 0; 153 | nbrhood[nbrCount-placedNbr][3] = nbrCount-placedNbr; 154 | placedNbr--; 155 | } 156 | } 157 | } 158 | 159 | //transform cells by (-ii, -jj) 160 | for(int i = 0; i < nbrhood.length; i++){ 161 | nbrhood[i][0]-=ii; 162 | nbrhood[i][1]-=jj; 163 | } 164 | 165 | //set as neighbours 166 | 167 | 168 | /*String s = ""; 169 | for(int i = 0; i < nbrhood.length; i++){ 170 | for(int j = 0; j < nbrhood[i].length; j++){ 171 | s+=nbrhood[i][j]+","; 172 | } 173 | s+="\n"; 174 | } 175 | System.out.println(s);*/ 176 | 177 | ML.customTF_NHood = nbrhood; 178 | ML.u[0].a.n.TFNbH = nbrhood; 179 | 180 | } else { 181 | System.out.println("NULL POINTER EXCEPTION"); 182 | } 183 | } 184 | 185 | if(source.getText() == "-> Set Rule(WIP)") { 186 | 187 | } 188 | 189 | 190 | } 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | } -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.core.resources/.history/fe/50b715e55e310014185be1b410184f15: -------------------------------------------------------------------------------- 1 | 2 | import java.awt.Color; 3 | import java.awt.event.ActionEvent; 4 | import java.awt.event.ActionListener; 5 | import java.util.Random; 6 | 7 | import javax.swing.JFrame; 8 | import javax.swing.JMenu; 9 | import javax.swing.JMenuItem; 10 | import javax.swing.JMenuBar; 11 | import javax.swing.JOptionPane; 12 | import javax.swing.JPanel; 13 | 14 | public class jMenuMain implements ActionListener { 15 | 16 | ml mML; 17 | Main m; 18 | ToggleFrame TF; 19 | 20 | //constructor, captures UI controller: ml 21 | public jMenuMain(ml myml) { 22 | mML = myml; 23 | TF = new ToggleFrame(mML); 24 | } 25 | 26 | //instanciate & deploy menu bar 27 | public void setGUI(Main mm) { 28 | m = mm; 29 | 30 | jMenuMain menuMain = new jMenuMain(mML); 31 | m.setJMenuBar(menuMain.createMenuBar()); 32 | } 33 | 34 | public JMenuBar createMenuBar() { 35 | 36 | 37 | JMenuBar menuBar; 38 | JMenu menu; 39 | JMenuItem menuItem; 40 | //JMenu submenu; 41 | 42 | 43 | //menu bar 44 | menuBar = new JMenuBar(); 45 | 46 | //create new menu 47 | menu = new JMenu("Universe"); 48 | menuBar.add(menu); 49 | 50 | //Populate menu 51 | menuItem = new JMenuItem("Play/Pause"); 52 | menuItem.addActionListener(this); 53 | menu.add(menuItem); 54 | 55 | /*menuItem = new JMenuItem("Reset To Default"); 56 | menuItem.addActionListener(this); 57 | menu.add(menuItem); */ 58 | 59 | menuItem = new JMenuItem("Select Next Window"); 60 | menuItem.addActionListener(this); 61 | menu.add(menuItem); 62 | 63 | menu.addSeparator(); 64 | 65 | menuItem = new JMenuItem("Erase Layer"); 66 | menuItem.addActionListener(this); 67 | menu.add(menuItem); 68 | 69 | menuItem = new JMenuItem("Erase All"); 70 | menuItem.addActionListener(this); 71 | menu.add(menuItem); 72 | 73 | menu.addSeparator(); 74 | 75 | menuItem = new JMenuItem("Reseed Layer"); 76 | menuItem.addActionListener(this); 77 | menu.add(menuItem); 78 | 79 | menuItem = new JMenuItem("Reseed All"); 80 | menuItem.addActionListener(this); 81 | menu.add(menuItem); 82 | 83 | menuItem = new JMenuItem("Set Seed"); 84 | menuItem.addActionListener(this); 85 | menu.add(menuItem); 86 | 87 | menu.addSeparator(); 88 | 89 | menuItem = new JMenuItem("Capture Image"); 90 | menuItem.addActionListener(this); 91 | menu.add(menuItem); 92 | 93 | menuItem = new JMenuItem("Image Every ? Frames"); 94 | menuItem.addActionListener(this); 95 | menu.add(menuItem); 96 | 97 | 98 | //create new menu 99 | menu = new JMenu("Tools"); 100 | menuBar.add(menu); 101 | 102 | //Populate menu 103 | menuItem = new JMenuItem("Place Solid Blocks"); 104 | menuItem.addActionListener(this); 105 | menu.add(menuItem); 106 | 107 | menuItem = new JMenuItem("Place Random Blocks"); 108 | menuItem.addActionListener(this); 109 | menu.add(menuItem); 110 | 111 | menuItem = new JMenuItem("Erase Blocks"); 112 | menuItem.addActionListener(this); 113 | menu.add(menuItem); 114 | 115 | menu.addSeparator(); 116 | 117 | menuItem = new JMenuItem("Reapply Custom Tool"); 118 | menuItem.addActionListener(this); 119 | menu.add(menuItem); 120 | 121 | menu.addSeparator(); 122 | 123 | menuItem = new JMenuItem("Set Tool Size"); 124 | menuItem.addActionListener(this); 125 | menu.add(menuItem); 126 | 127 | menuItem = new JMenuItem("Set Tool Value"); 128 | menuItem.addActionListener(this); 129 | menu.add(menuItem); 130 | 131 | menuItem = new JMenuItem("Set Tool Distribution"); 132 | menuItem.addActionListener(this); 133 | menu.add(menuItem); 134 | 135 | menuItem = new JMenuItem("Set Tool Value Variation"); 136 | menuItem.addActionListener(this); 137 | menu.add(menuItem); 138 | 139 | /* menuItem = new JMenuItem("Set Slider Value"); 140 | menuItem.addActionListener(this); 141 | menu.add(menuItem);*/ 142 | 143 | 144 | 145 | menu = new JMenu("Ruleset"); 146 | menuBar.add(menu); 147 | 148 | menuItem = new JMenuItem("Remove Last Rule"); 149 | menuItem.addActionListener(this); 150 | menu.add(menuItem); 151 | 152 | menu.addSeparator(); 153 | 154 | menuItem = new JMenuItem("Add Rule To Ruleset"); 155 | menuItem.addActionListener(this); 156 | menu.add(menuItem); 157 | 158 | menuItem = new JMenuItem("Add Constant Seeding"); 159 | menuItem.addActionListener(this); 160 | menu.add(menuItem); 161 | 162 | menuItem = new JMenuItem("Add Random Rule"); 163 | menuItem.addActionListener(this); 164 | menu.add(menuItem); 165 | 166 | menuItem = new JMenuItem("Recast Rule Parameters"); 167 | menuItem.addActionListener(this); 168 | menu.add(menuItem); 169 | 170 | /*menuItem = new JMenuItem("Reassign Growth Function"); 171 | menuItem.addActionListener(this); 172 | menu.add(menuItem);*/ 173 | 174 | menu.addSeparator(); 175 | 176 | menuItem = new JMenuItem("Random Combination Ruleset"); 177 | menuItem.addActionListener(this); 178 | menu.add(menuItem); 179 | 180 | /* menu.addSeparator(); 181 | 182 | menuItem = new JMenuItem("Toggle Custom Neighbourhood"); 183 | menuItem.addActionListener(this); 184 | menu.add(menuItem); 185 | 186 | menuItem = new JMenuItem("Erase Custom Neighbourhood"); 187 | menuItem.addActionListener(this); 188 | menu.add(menuItem); */ 189 | 190 | 191 | //create new menu 192 | menu = new JMenu("MouseWheel"); 193 | menuBar.add(menu); 194 | 195 | //Populate menu 196 | menuItem = new JMenuItem("Tool Subfunctions"); 197 | menuItem.addActionListener(this); 198 | menu.add(menuItem); 199 | 200 | menuItem = new JMenuItem("Z-layers"); 201 | menuItem.addActionListener(this); 202 | menu.add(menuItem); 203 | 204 | menuItem = new JMenuItem("Automata Rulesets"); 205 | menuItem.addActionListener(this); 206 | menu.add(menuItem); 207 | 208 | menuItem = new JMenuItem("Tool Size"); 209 | menuItem.addActionListener(this); 210 | menu.add(menuItem); 211 | 212 | menuItem = new JMenuItem("Tool Value"); 213 | menuItem.addActionListener(this); 214 | menu.add(menuItem); 215 | 216 | menuItem = new JMenuItem("Neighbourhoods"); 217 | menuItem.addActionListener(this); 218 | menu.add(menuItem); 219 | 220 | menuItem = new JMenuItem("Cell Rule Override"); 221 | menuItem.addActionListener(this); 222 | menu.add(menuItem); 223 | 224 | menuItem = new JMenuItem("Colour Schemes"); 225 | menuItem.addActionListener(this); 226 | menu.add(menuItem); 227 | 228 | 229 | //create new menu 230 | menu = new JMenu("Editor"); 231 | menuBar.add(menu); 232 | 233 | menuItem = new JMenuItem("Show Editor"); 234 | menuItem.addActionListener(this); 235 | menu.add(menuItem); 236 | 237 | menu.addSeparator(); 238 | 239 | menuItem = new JMenuItem("Tool: Copy"); 240 | menuItem.addActionListener(this); 241 | menu.add(menuItem); 242 | 243 | menuItem = new JMenuItem("Tool: Paste"); 244 | menuItem.addActionListener(this); 245 | menu.add(menuItem); 246 | 247 | /*menuItem = new JMenuItem("PrintLn() Data"); 248 | menuItem.addActionListener(this); 249 | menu.add(menuItem);*/ 250 | 251 | /* menuItem = new JMenuItem("Paste To Editor"); 252 | menuItem.addActionListener(this); 253 | menu.add(menuItem); 254 | 255 | menuItem = new JMenuItem("Overwrite Clipboard"); 256 | menuItem.addActionListener(this); 257 | menu.add(menuItem);*/ 258 | 259 | /*submenu = new JMenu("GoToRule"); 260 | menuItem = new JMenuItem("Item"); 261 | menuItem.addActionListener(this); 262 | submenu.add(menuItem); 263 | menu.add(submenu);*/ 264 | 265 | return menuBar; 266 | } 267 | 268 | public void actionPerformed(ActionEvent e) { 269 | JMenuItem source = (JMenuItem)(e.getSource()); 270 | 271 | if(source.getText() == "Play/Pause") {mML.toggleStart();} 272 | 273 | if(source.getText() == "Erase Layer") {mML.eraseLayer();} 274 | if(source.getText() == "Erase All") {mML.eraseAll();} 275 | if(source.getText() == "Capture Image") {new getImage(mML.u[0],"",-1);} 276 | if(source.getText() == "Image Every ? Frames") { 277 | 278 | String str = JOptionPane.showInputDialog(m, "Take a screenshot every x frames:", "16"); 279 | if(str != null) { 280 | mML.u[0].record = Integer.parseInt(str); 281 | } 282 | 283 | 284 | 285 | mML.u[0].name(); 286 | } 287 | 288 | 289 | if(source.getText() == "Reset To Default") { 290 | mML.eraseAll(); 291 | mML.resetRuleDef(); 292 | mML.setFunctionType(0); 293 | mML.mwMax = mML.fcnt; 294 | mML.cycleNum = 0; 295 | mML.myFunction=0; 296 | mML.sfcnum=0; 297 | mML.seedRand = 4; 298 | mML.seedRndVar = 1; 299 | mML.seedVal = 1; 300 | mML.mwPos = 0; 301 | mML.params = new int[] {0,0,0,0}; 302 | 303 | mML.blockVal = 1; 304 | mML.toolRand = 0; 305 | mML.toolVar = 0; 306 | mML.blockSize = 1; 307 | 308 | mML.gui_blockVal = mML.blockVal; 309 | mML.gui_toolRand = mML.toolRand; 310 | mML.gui_toolVar = mML.toolVar; 311 | mML.gui_blockSize = mML.blockSize; 312 | 313 | mML.resetVal = true; 314 | mML.slideVal = new int[3]; 315 | mML.growDieThreshold = 0; 316 | mML.ruleChanged(0); 317 | 318 | mML.ruleLenChanged(); 319 | mML.eraseNbrAr(); 320 | 321 | mML.reseedAll(6, 1); 322 | 323 | } 324 | 325 | if(source.getText() == "Select Next Window") {mML.cycleUni();} 326 | 327 | if(source.getText() == "Reseed Layer") {mML.reseedLayer(mML.seedRand, mML.seedVal);} 328 | if(source.getText() == "Reseed All") {mML.reseedAll(mML.seedRand, mML.seedVal);} 329 | if(source.getText() == "Set Seed") {mML.dialogReseed();} 330 | 331 | if(source.getText() == "Remove Last Rule") {mML.removeRule();} 332 | 333 | if(source.getText() == "Add Rule To Ruleset") {mML.dialogAddRule();} 334 | if(source.getText() == "Add Constant Seeding") {mML.dialogAddSeed();} 335 | if(source.getText() == "Add Random Rule") {mML.addRandomRule();} 336 | if(source.getText() == "Recast Rule Parameters") {mML.recastParams();} 337 | //if(source.getText() == "Reassign Growth Function") {mML.dialogRuleBounds();} 338 | 339 | if(source.getText() == "Random Combination Ruleset") {mML.reseedAll(mML.seedRand, mML.seedVal); mML.setRandom_3_InstructionWithSeed();} 340 | 341 | if(source.getText() == "Toggle Custom Neighbourhood") {mML.toggleCustNbr();} 342 | if(source.getText() == "Erase Custom Neighbourhood") {mML.eraseNbrAr();} 343 | 344 | 345 | if(source.getText() == "Place Solid Blocks") {mML.setFunctionType(0);setBlocks();mML.blockSize = -1;mML.toolRand = -1;mML.toolVar = -1;mML.resetVal = true;} 346 | if(source.getText() == "Place Random Blocks") {mML.setFunctionType(1);setBlocks();mML.blockSize = -1;mML.toolRand = -1;mML.toolVar = -1;mML.resetVal = true;} 347 | if(source.getText() == "Erase Blocks") {mML.setFunctionType(2);setBlocks();mML.blockSize = -1;mML.toolRand = -1;mML.toolVar = -1;mML.resetVal = true;} 348 | 349 | if(source.getText() == "Reapply Custom Tool") {mML.snapToCustomTool();} 350 | 351 | 352 | if(source.getText() == "Tool: Copy") {mML.setFunctionType(3);mML.myFunction = 2;setBlocks();mML.blockSize = -1;mML.toolRand = -1;mML.toolVar = -1;mML.resetVal = true;} 353 | if(source.getText() == "Tool: Paste") {mML.setFunctionType(3);mML.myFunction = 1;setBlocks();mML.blockSize = -1;mML.toolRand = -1;mML.toolVar = -1;mML.resetVal = true;} 354 | 355 | if(source.getText() == "Set Tool Size") {mML.dialogSetBlockSize();} 356 | if(source.getText() == "Set Tool Value") {mML.dialogSetBlockVal();} 357 | if(source.getText() == "Set Tool Distribution") {mML.dialogSetBlockRand();} 358 | if(source.getText() == "Set Tool Value Variation") {mML.dialogSetBlockVar();} 359 | if(source.getText() == "Set Slider Value") {mML.dialogSetSlider();} 360 | 361 | 362 | if(source.getText() == "Tool Subfunctions") {mML.mwPos = mML.myFunction; mML.mwMax = mML.fcnt; mML.cycleNum = 0;} 363 | if(source.getText() == "Z-layers") {mML.mwPos = mML.s[mML.sfcnum].zdraw; mML.mwMax = mML.s[mML.sfcnum].zz; mML.cycleNum = 1;} 364 | if(source.getText() == "Automata Rulesets") {mML.mwPos = mML.rule; mML.mwMax = mML.totalFunctions; mML.cycleNum = 2;} 365 | if(source.getText() == "Tool Size") {mML.mwPos = mML.gui_blockSize; mML.mwMax = 100; mML.cycleNum = 3;} 366 | if(source.getText() == "Tool Value") {mML.mwPos = mML.gui_blockVal; mML.mwMax = 100; mML.cycleNum = 4;} 367 | if(source.getText() == "Neighbourhoods") {mML.mwPos = mML.gui_nHood; mML.mwMax = mML.totalHoods; mML.cycleNum = 5;} 368 | if(source.getText() == "Cell Rule Override"){mML.mwPos = mML.gui_ROver; mML.mwMax = mML.totalFunctions; mML.cycleNum = 6;} 369 | if(source.getText() == "Colour Schemes") {mML.mwPos = mML.gui_colourScheme; mML.mwMax = mML.totalColourSchemes; mML.cycleNum = 7;} 370 | 371 | 372 | 373 | if(source.getText() == "Show Editor") { 374 | TF.reinitTF(mML.blockSize); 375 | TF.togShowTF(); 376 | } 377 | 378 | 379 | 380 | /*if(source.getText() == "Print Data") { 381 | if(TF != null) { 382 | int[][] tmpInt = TF.getPanelStates(); 383 | } else { 384 | System.out.println("NULL POINTER EXCEPTION"); 385 | } 386 | } 387 | 388 | if(source.getText() == "Paste To Editor") { 389 | if(TF != null) { 390 | int[][][] intAr = mML.d.getArray(); 391 | for(int i = 0; i < TF.pp.length; i++){ 392 | for(int j = 0; j < TF.pp[i].length; j++){ 393 | TF.pp[j][i].setVal(intAr[j][i][0]); 394 | } 395 | } 396 | 397 | } else { 398 | System.out.println("NULL POINTER EXCEPTION"); 399 | } 400 | } 401 | 402 | if(source.getText() == "Overwrite Clipboard") { 403 | if(TF != null) { 404 | int[][][] intAr = new int[TF.pp.length][TF.pp[0].length][1]; 405 | for(int i = 0; i < TF.pp.length; i++){ 406 | for(int j = 0; j < TF.pp[i].length; j++){ 407 | intAr[j][i][0] = TF.pp[j][i].val; 408 | } 409 | } 410 | 411 | mML.d.setArray(intAr); 412 | 413 | } else { 414 | System.out.println("NULL POINTER EXCEPTION"); 415 | } 416 | } */ 417 | 418 | mML.refresh(); 419 | } 420 | 421 | private void setBlocks(){ 422 | mML.mwPos = mML.myFunction; 423 | mML.mwMax = mML.fcnt; 424 | mML.cycleNum = 0; 425 | } 426 | 427 | 428 | 429 | 430 | 431 | 432 | } -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/src/jMenuMain.java: -------------------------------------------------------------------------------- 1 | 2 | import java.awt.Color; 3 | import java.awt.event.ActionEvent; 4 | import java.awt.event.ActionListener; 5 | import java.util.Random; 6 | 7 | import javax.swing.JFrame; 8 | import javax.swing.JMenu; 9 | import javax.swing.JMenuItem; 10 | import javax.swing.JMenuBar; 11 | import javax.swing.JOptionPane; 12 | import javax.swing.JPanel; 13 | 14 | public class jMenuMain implements ActionListener { 15 | 16 | ml mML; 17 | Main m; 18 | ToggleFrame TF; 19 | 20 | //constructor, captures UI controller: ml 21 | public jMenuMain(ml myml) { 22 | mML = myml; 23 | TF = new ToggleFrame(mML); 24 | } 25 | 26 | //instanciate & deploy menu bar 27 | public void setGUI(Main mm) { 28 | m = mm; 29 | 30 | jMenuMain menuMain = new jMenuMain(mML); 31 | m.setJMenuBar(menuMain.createMenuBar()); 32 | } 33 | 34 | public JMenuBar createMenuBar() { 35 | 36 | 37 | JMenuBar menuBar; 38 | JMenu menu; 39 | JMenuItem menuItem; 40 | //JMenu submenu; 41 | 42 | 43 | //menu bar 44 | menuBar = new JMenuBar(); 45 | 46 | //create new menu 47 | menu = new JMenu("Universe"); 48 | menuBar.add(menu); 49 | 50 | //Populate menu 51 | menuItem = new JMenuItem("Play/Pause"); 52 | menuItem.addActionListener(this); 53 | menu.add(menuItem); 54 | 55 | /*menuItem = new JMenuItem("Reset To Default"); 56 | menuItem.addActionListener(this); 57 | menu.add(menuItem); */ 58 | 59 | menuItem = new JMenuItem("Select Next Window"); 60 | menuItem.addActionListener(this); 61 | menu.add(menuItem); 62 | 63 | menu.addSeparator(); 64 | 65 | menuItem = new JMenuItem("Erase Layer"); 66 | menuItem.addActionListener(this); 67 | menu.add(menuItem); 68 | 69 | menuItem = new JMenuItem("Erase All"); 70 | menuItem.addActionListener(this); 71 | menu.add(menuItem); 72 | 73 | menu.addSeparator(); 74 | 75 | menuItem = new JMenuItem("Reseed Layer"); 76 | menuItem.addActionListener(this); 77 | menu.add(menuItem); 78 | 79 | menuItem = new JMenuItem("Reseed All"); 80 | menuItem.addActionListener(this); 81 | menu.add(menuItem); 82 | 83 | menuItem = new JMenuItem("Set Seed"); 84 | menuItem.addActionListener(this); 85 | menu.add(menuItem); 86 | 87 | menu.addSeparator(); 88 | 89 | menuItem = new JMenuItem("Capture Image"); 90 | menuItem.addActionListener(this); 91 | menu.add(menuItem); 92 | 93 | menuItem = new JMenuItem("Image Every ? Frames"); 94 | menuItem.addActionListener(this); 95 | menu.add(menuItem); 96 | 97 | 98 | //create new menu 99 | menu = new JMenu("Tools"); 100 | menuBar.add(menu); 101 | 102 | //Populate menu 103 | menuItem = new JMenuItem("Place Solid Blocks"); 104 | menuItem.addActionListener(this); 105 | menu.add(menuItem); 106 | 107 | menuItem = new JMenuItem("Place Random Blocks"); 108 | menuItem.addActionListener(this); 109 | menu.add(menuItem); 110 | 111 | menuItem = new JMenuItem("Erase Blocks"); 112 | menuItem.addActionListener(this); 113 | menu.add(menuItem); 114 | 115 | menu.addSeparator(); 116 | 117 | menuItem = new JMenuItem("Reapply Custom Tool"); 118 | menuItem.addActionListener(this); 119 | menu.add(menuItem); 120 | 121 | menu.addSeparator(); 122 | 123 | menuItem = new JMenuItem("Set Tool Size"); 124 | menuItem.addActionListener(this); 125 | menu.add(menuItem); 126 | 127 | menuItem = new JMenuItem("Set Tool Value"); 128 | menuItem.addActionListener(this); 129 | menu.add(menuItem); 130 | 131 | menuItem = new JMenuItem("Set Tool Distribution"); 132 | menuItem.addActionListener(this); 133 | menu.add(menuItem); 134 | 135 | menuItem = new JMenuItem("Set Tool Value Variation"); 136 | menuItem.addActionListener(this); 137 | menu.add(menuItem); 138 | 139 | /* menuItem = new JMenuItem("Set Slider Value"); 140 | menuItem.addActionListener(this); 141 | menu.add(menuItem);*/ 142 | 143 | 144 | 145 | menu = new JMenu("Ruleset"); 146 | menuBar.add(menu); 147 | 148 | menuItem = new JMenuItem("Remove Last Rule"); 149 | menuItem.addActionListener(this); 150 | menu.add(menuItem); 151 | 152 | menu.addSeparator(); 153 | 154 | menuItem = new JMenuItem("Add Rule To Ruleset"); 155 | menuItem.addActionListener(this); 156 | menu.add(menuItem); 157 | 158 | menuItem = new JMenuItem("Add Constant Seeding"); 159 | menuItem.addActionListener(this); 160 | menu.add(menuItem); 161 | 162 | menuItem = new JMenuItem("Add Random Rule"); 163 | menuItem.addActionListener(this); 164 | menu.add(menuItem); 165 | 166 | menuItem = new JMenuItem("Recast Rule Parameters"); 167 | menuItem.addActionListener(this); 168 | menu.add(menuItem); 169 | 170 | /*menuItem = new JMenuItem("Reassign Growth Function"); 171 | menuItem.addActionListener(this); 172 | menu.add(menuItem);*/ 173 | 174 | menu.addSeparator(); 175 | 176 | menuItem = new JMenuItem("Random Combination Ruleset"); 177 | menuItem.addActionListener(this); 178 | menu.add(menuItem); 179 | 180 | /* menu.addSeparator(); 181 | 182 | menuItem = new JMenuItem("Toggle Custom Neighbourhood"); 183 | menuItem.addActionListener(this); 184 | menu.add(menuItem); 185 | 186 | menuItem = new JMenuItem("Erase Custom Neighbourhood"); 187 | menuItem.addActionListener(this); 188 | menu.add(menuItem); */ 189 | 190 | 191 | //create new menu 192 | menu = new JMenu("MouseWheel"); 193 | menuBar.add(menu); 194 | 195 | //Populate menu 196 | menuItem = new JMenuItem("Tool Subfunctions"); 197 | menuItem.addActionListener(this); 198 | menu.add(menuItem); 199 | 200 | menuItem = new JMenuItem("Z-layers"); 201 | menuItem.addActionListener(this); 202 | menu.add(menuItem); 203 | 204 | menuItem = new JMenuItem("Automata Rulesets"); 205 | menuItem.addActionListener(this); 206 | menu.add(menuItem); 207 | 208 | menuItem = new JMenuItem("Tool Size"); 209 | menuItem.addActionListener(this); 210 | menu.add(menuItem); 211 | 212 | menuItem = new JMenuItem("Tool Value"); 213 | menuItem.addActionListener(this); 214 | menu.add(menuItem); 215 | 216 | menuItem = new JMenuItem("Neighbourhoods"); 217 | menuItem.addActionListener(this); 218 | menu.add(menuItem); 219 | 220 | menuItem = new JMenuItem("Cell Rule Override"); 221 | menuItem.addActionListener(this); 222 | menu.add(menuItem); 223 | 224 | menuItem = new JMenuItem("Colour Schemes"); 225 | menuItem.addActionListener(this); 226 | menu.add(menuItem); 227 | 228 | 229 | //create new menu 230 | menu = new JMenu("Editor"); 231 | menuBar.add(menu); 232 | 233 | menuItem = new JMenuItem("Show Editor"); 234 | menuItem.addActionListener(this); 235 | menu.add(menuItem); 236 | 237 | menu.addSeparator(); 238 | 239 | menuItem = new JMenuItem("Tool: Copy"); 240 | menuItem.addActionListener(this); 241 | menu.add(menuItem); 242 | 243 | menuItem = new JMenuItem("Tool: Paste"); 244 | menuItem.addActionListener(this); 245 | menu.add(menuItem); 246 | 247 | /*menuItem = new JMenuItem("PrintLn() Data"); 248 | menuItem.addActionListener(this); 249 | menu.add(menuItem);*/ 250 | 251 | /* menuItem = new JMenuItem("Paste To Editor"); 252 | menuItem.addActionListener(this); 253 | menu.add(menuItem); 254 | 255 | menuItem = new JMenuItem("Overwrite Clipboard"); 256 | menuItem.addActionListener(this); 257 | menu.add(menuItem);*/ 258 | 259 | /*submenu = new JMenu("GoToRule"); 260 | menuItem = new JMenuItem("Item"); 261 | menuItem.addActionListener(this); 262 | submenu.add(menuItem); 263 | menu.add(submenu);*/ 264 | 265 | return menuBar; 266 | } 267 | 268 | public void actionPerformed(ActionEvent e) { 269 | JMenuItem source = (JMenuItem)(e.getSource()); 270 | 271 | if(source.getText() == "Play/Pause") {mML.toggleStart();} 272 | 273 | if(source.getText() == "Erase Layer") {mML.eraseLayer();} 274 | if(source.getText() == "Erase All") {mML.eraseAll();} 275 | if(source.getText() == "Capture Image") {new getImage(mML.u[0],"",-1);} 276 | 277 | if(source.getText() == "Image Every ? Frames") { 278 | 279 | String str = JOptionPane.showInputDialog(m, "Take a screenshot every x frames:", "16"); 280 | if(str != null) { 281 | mML.u[0].record = Integer.parseInt(str); 282 | } 283 | 284 | str = JOptionPane.showInputDialog(m, "Pixel Magnification", "2"); 285 | if(str != null) { 286 | mML.u[0].recordZoom = Integer.parseInt(str); 287 | } 288 | 289 | mML.u[0].name(); 290 | } 291 | 292 | 293 | if(source.getText() == "Reset To Default") { 294 | mML.eraseAll(); 295 | mML.resetRuleDef(); 296 | mML.setFunctionType(0); 297 | mML.mwMax = mML.fcnt; 298 | mML.cycleNum = 0; 299 | mML.myFunction=0; 300 | mML.sfcnum=0; 301 | mML.seedRand = 4; 302 | mML.seedRndVar = 1; 303 | mML.seedVal = 1; 304 | mML.mwPos = 0; 305 | mML.params = new int[] {0,0,0,0}; 306 | 307 | mML.blockVal = 1; 308 | mML.toolRand = 0; 309 | mML.toolVar = 0; 310 | mML.blockSize = 1; 311 | 312 | mML.gui_blockVal = mML.blockVal; 313 | mML.gui_toolRand = mML.toolRand; 314 | mML.gui_toolVar = mML.toolVar; 315 | mML.gui_blockSize = mML.blockSize; 316 | 317 | mML.resetVal = true; 318 | mML.slideVal = new int[3]; 319 | mML.growDieThreshold = 0; 320 | mML.ruleChanged(0); 321 | 322 | mML.ruleLenChanged(); 323 | mML.eraseNbrAr(); 324 | 325 | mML.reseedAll(6, 1); 326 | 327 | } 328 | 329 | if(source.getText() == "Select Next Window") {mML.cycleUni();} 330 | 331 | if(source.getText() == "Reseed Layer") {mML.reseedLayer(mML.seedRand, mML.seedVal);} 332 | if(source.getText() == "Reseed All") {mML.reseedAll(mML.seedRand, mML.seedVal);} 333 | if(source.getText() == "Set Seed") {mML.dialogReseed();} 334 | 335 | if(source.getText() == "Remove Last Rule") {mML.removeRule();} 336 | 337 | if(source.getText() == "Add Rule To Ruleset") {mML.dialogAddRule();} 338 | if(source.getText() == "Add Constant Seeding") {mML.dialogAddSeed();} 339 | if(source.getText() == "Add Random Rule") {mML.addRandomRule();} 340 | if(source.getText() == "Recast Rule Parameters") {mML.recastParams();} 341 | //if(source.getText() == "Reassign Growth Function") {mML.dialogRuleBounds();} 342 | 343 | if(source.getText() == "Random Combination Ruleset") {mML.reseedAll(mML.seedRand, mML.seedVal); mML.setRandom_3_InstructionWithSeed();} 344 | 345 | if(source.getText() == "Toggle Custom Neighbourhood") {mML.toggleCustNbr();} 346 | if(source.getText() == "Erase Custom Neighbourhood") {mML.eraseNbrAr();} 347 | 348 | 349 | if(source.getText() == "Place Solid Blocks") {mML.setFunctionType(0);setBlocks();mML.blockSize = -1;mML.toolRand = -1;mML.toolVar = -1;mML.resetVal = true;} 350 | if(source.getText() == "Place Random Blocks") {mML.setFunctionType(1);setBlocks();mML.blockSize = -1;mML.toolRand = -1;mML.toolVar = -1;mML.resetVal = true;} 351 | if(source.getText() == "Erase Blocks") {mML.setFunctionType(2);setBlocks();mML.blockSize = -1;mML.toolRand = -1;mML.toolVar = -1;mML.resetVal = true;} 352 | 353 | if(source.getText() == "Reapply Custom Tool") {mML.snapToCustomTool();} 354 | 355 | 356 | if(source.getText() == "Tool: Copy") {mML.setFunctionType(3);mML.myFunction = 2;setBlocks();mML.blockSize = -1;mML.toolRand = -1;mML.toolVar = -1;mML.resetVal = true;} 357 | if(source.getText() == "Tool: Paste") {mML.setFunctionType(3);mML.myFunction = 1;setBlocks();mML.blockSize = -1;mML.toolRand = -1;mML.toolVar = -1;mML.resetVal = true;} 358 | 359 | if(source.getText() == "Set Tool Size") {mML.dialogSetBlockSize();} 360 | if(source.getText() == "Set Tool Value") {mML.dialogSetBlockVal();} 361 | if(source.getText() == "Set Tool Distribution") {mML.dialogSetBlockRand();} 362 | if(source.getText() == "Set Tool Value Variation") {mML.dialogSetBlockVar();} 363 | if(source.getText() == "Set Slider Value") {mML.dialogSetSlider();} 364 | 365 | 366 | if(source.getText() == "Tool Subfunctions") {mML.mwPos = mML.myFunction; mML.mwMax = mML.fcnt; mML.cycleNum = 0;} 367 | if(source.getText() == "Z-layers") {mML.mwPos = mML.s[mML.sfcnum].zdraw; mML.mwMax = mML.s[mML.sfcnum].zz; mML.cycleNum = 1;} 368 | if(source.getText() == "Automata Rulesets") {mML.mwPos = mML.rule; mML.mwMax = mML.totalFunctions; mML.cycleNum = 2;} 369 | if(source.getText() == "Tool Size") {mML.mwPos = mML.gui_blockSize; mML.mwMax = 100; mML.cycleNum = 3;} 370 | if(source.getText() == "Tool Value") {mML.mwPos = mML.gui_blockVal; mML.mwMax = 100; mML.cycleNum = 4;} 371 | if(source.getText() == "Neighbourhoods") {mML.mwPos = mML.gui_nHood; mML.mwMax = mML.totalHoods; mML.cycleNum = 5;} 372 | if(source.getText() == "Cell Rule Override"){mML.mwPos = mML.gui_ROver; mML.mwMax = mML.totalFunctions; mML.cycleNum = 6;} 373 | if(source.getText() == "Colour Schemes") {mML.mwPos = mML.gui_colourScheme; mML.mwMax = mML.totalColourSchemes; mML.cycleNum = 7;} 374 | 375 | 376 | 377 | if(source.getText() == "Show Editor") { 378 | TF.reinitTF(mML.blockSize); 379 | TF.togShowTF(); 380 | } 381 | 382 | 383 | 384 | /*if(source.getText() == "Print Data") { 385 | if(TF != null) { 386 | int[][] tmpInt = TF.getPanelStates(); 387 | } else { 388 | System.out.println("NULL POINTER EXCEPTION"); 389 | } 390 | } 391 | 392 | if(source.getText() == "Paste To Editor") { 393 | if(TF != null) { 394 | int[][][] intAr = mML.d.getArray(); 395 | for(int i = 0; i < TF.pp.length; i++){ 396 | for(int j = 0; j < TF.pp[i].length; j++){ 397 | TF.pp[j][i].setVal(intAr[j][i][0]); 398 | } 399 | } 400 | 401 | } else { 402 | System.out.println("NULL POINTER EXCEPTION"); 403 | } 404 | } 405 | 406 | if(source.getText() == "Overwrite Clipboard") { 407 | if(TF != null) { 408 | int[][][] intAr = new int[TF.pp.length][TF.pp[0].length][1]; 409 | for(int i = 0; i < TF.pp.length; i++){ 410 | for(int j = 0; j < TF.pp[i].length; j++){ 411 | intAr[j][i][0] = TF.pp[j][i].val; 412 | } 413 | } 414 | 415 | mML.d.setArray(intAr); 416 | 417 | } else { 418 | System.out.println("NULL POINTER EXCEPTION"); 419 | } 420 | } */ 421 | 422 | mML.refresh(); 423 | } 424 | 425 | private void setBlocks(){ 426 | mML.mwPos = mML.myFunction; 427 | mML.mwMax = mML.fcnt; 428 | mML.cycleNum = 0; 429 | } 430 | 431 | 432 | 433 | 434 | 435 | 436 | } -------------------------------------------------------------------------------- /CellularAutomata/.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/src/neighbours.java: -------------------------------------------------------------------------------- 1 | import java.util.Random; 2 | 3 | 4 | 5 | public class neighbours { 6 | int[][] NBH; 7 | Random r = new Random(); 8 | int hoodCount = 42+3; 9 | int custHood = 0; 10 | int instrNum=0; 11 | int[] useCustNbrAr = {-1}; 12 | int useCustom = 0; 13 | int[][] TFNbH; 14 | //constructor 15 | public neighbours(int countNbr) { 16 | //System.out.println("neighbours"); 17 | NBH = new int[countNbr][3]; //initiate array with required number of neighbour slots 18 | TFNbH = new int[0][0]; 19 | } 20 | //called to define a neighbour's position (x,y,z,neighbour id) 21 | public void setNBH(int xx, int yy, int zz, int nbr) { 22 | NBH[nbr][0] = xx; 23 | NBH[nbr][1] = yy; 24 | NBH[nbr][2] = zz; 25 | } 26 | 27 | public void newCNAr(int instrCount){ 28 | int oldLen = useCustNbrAr.length; 29 | 30 | int[] newAr = new int[instrCount]; 31 | 32 | int newLen = 0; 33 | if(oldLen < instrCount) {newLen = oldLen;} 34 | else {newLen = instrCount;} 35 | 36 | System.out.println(oldLen + ", " + instrCount + " ~ " + newLen); 37 | 38 | if(newLen == oldLen && oldLen < instrCount) { 39 | for(int i = 0; i < newLen+1; i++) { 40 | newAr[i]=-1; 41 | } 42 | } 43 | 44 | for(int i = 0; i < newLen; i++) { 45 | newAr[i]=useCustNbrAr[i]; 46 | } 47 | 48 | useCustNbrAr = newAr; 49 | } 50 | 51 | public void resetNbrAr(){ 52 | for(int i = 0; i < useCustNbrAr.length; i++) { 53 | useCustNbrAr[i]=-1; 54 | } 55 | } 56 | 57 | public void setNbrhoodAr(int nbhood) { 58 | useCustNbrAr[useCustNbrAr.length-1] = nbhood; 59 | } 60 | 61 | public void setIndexNbrhoodAr(int nbhood, int ruleIndex) { 62 | useCustNbrAr[ruleIndex] = nbhood; 63 | } 64 | 65 | public void newNbrhood(int countNbr) { 66 | NBH = new int[countNbr][3]; //initiate array with required number of neighbour slots 67 | } 68 | 69 | public void setNbrhood(int hood){ 70 | 71 | 72 | if(useCustom == 1 && useCustNbrAr[instrNum] != -1) {hood = useCustNbrAr[instrNum];} 73 | 74 | if(hood == -2) { 75 | 76 | newNbrhood(TFNbH.length); 77 | 78 | for (int i = 0; i < TFNbH.length; i++){ 79 | setNBH(TFNbH[i][0], TFNbH[i][1], TFNbH[i][2], i); 80 | } 81 | 82 | } 83 | 84 | if(hood == 0) { 85 | newNbrhood(4); 86 | setNBH(0, -1, 0, 0); 87 | setNBH(1, 0, 0, 1); 88 | setNBH(0, 1, 0, 2); 89 | setNBH(-1, 0, 0, 3); 90 | 91 | } 92 | 93 | if(hood == 1) { 94 | newNbrhood(3); 95 | setNBH(-1, -1, 0, 0); 96 | setNBH(1, -1, 0, 1); 97 | setNBH(0, 1, 0, 2); 98 | } 99 | 100 | if(hood == 2) { 101 | newNbrhood(5); 102 | setNBH(-1, 1, 0, 0); 103 | setNBH(1, 1, 0, 1); 104 | setNBH(0, -1, 0, 2); 105 | setNBH(-2, -1, 0, 3); 106 | setNBH(2, -1, 0, 4); 107 | } 108 | 109 | 110 | if(hood == 3) { 111 | newNbrhood(24); 112 | setNBH( 0, -1, 0, 0); 113 | setNBH( -1, 0, 0, 1); 114 | setNBH( 1, 0, 0, 2); 115 | setNBH( 0, 1, 0, 3); 116 | setNBH( -1, -1, 0, 4); 117 | setNBH( 1, 1, 0, 5); 118 | setNBH( -1, 1, 0, 6); 119 | setNBH( 1, -1, 0, 7); 120 | 121 | setNBH( -2, 0, 0, 8); 122 | setNBH( 2, 0, 0, 9); 123 | setNBH( -2, 1, 0, 10); 124 | setNBH( 2, 1, 0, 11); 125 | setNBH( -2, -1, 0, 12); 126 | setNBH( 2, -1, 0, 13); 127 | 128 | setNBH( 0, -2, 0, 14); 129 | setNBH( 0, 2, 0, 15); 130 | setNBH( 1, -2, 0, 16); 131 | setNBH( 1, 2, 0, 17); 132 | setNBH( -1, -2, 0, 18); 133 | setNBH( -1, 2, 0, 19); 134 | 135 | setNBH( -2, -2, 0, 20); 136 | setNBH( 2, 2, 0, 21); 137 | setNBH( 2, -2, 0, 22); 138 | setNBH( -2, 2, 0, 23); 139 | } 140 | 141 | if(hood == 4) { 142 | newNbrhood(8); 143 | setNBH( 0, -1, 0, 0); 144 | setNBH( 1, -1, 0, 1); 145 | setNBH( 1, 0, 0, 2); 146 | setNBH( 1, 1, 0, 3); 147 | setNBH( 0, 1, 0, 4); 148 | setNBH( -1, 1, 0, 5); 149 | setNBH( -1, 0, 0, 6); 150 | setNBH( -1, -1, 0, 7); 151 | } 152 | 153 | 154 | if(hood == 5) { 155 | newNbrhood(4); 156 | setNBH(-1, -1, 0, 0); 157 | setNBH(1, -1, 0, 1); 158 | setNBH(-1, 1, 0, 2); 159 | setNBH(1, 1, 0, 3); 160 | } 161 | 162 | 163 | if(hood == 6) { 164 | newNbrhood(6); 165 | setNBH(-1, 0, 0, 0); 166 | setNBH(0, -1, 0, 1); 167 | setNBH(1, 0, 0, 2); 168 | setNBH(0, 1, 0, 3); 169 | setNBH(0, 0, -1, 4); 170 | setNBH(0, 0, 1, 5); 171 | } 172 | if(hood == 7) { 173 | newNbrhood(3); 174 | setNBH(-1, -1, 0, 0); 175 | setNBH(1, -1, 0, 1); 176 | setNBH(0, -1, 0, 2); 177 | } 178 | 179 | 180 | if(hood == 8) { 181 | newNbrhood(5); 182 | setNBH(-1, -1, 0, 0); 183 | setNBH(1, -1, 0, 1); 184 | setNBH(0, -1, 0, 2); 185 | setNBH(-1, 0, 0, 3); 186 | setNBH(1, 0, 0, 4); 187 | } 188 | 189 | 190 | if(hood == 9) { 191 | newNbrhood(2); 192 | setNBH(-1, -1, 0, 0); 193 | setNBH(1, -1, 0, 1); 194 | } 195 | 196 | if(hood == 10) { 197 | newNbrhood(5); 198 | setNBH(0, -1, 0, 0); 199 | setNBH( 0, 1, 0, 1); 200 | setNBH( -1, 0, 0, 2); 201 | setNBH( 1, 0, 0, 3); 202 | setNBH( 0, 0, 0, 4); 203 | } 204 | 205 | if(hood == 11) { 206 | newNbrhood(2); 207 | setNBH(0, -1, 0, 0); 208 | setNBH(-1, 0, 0, 1); 209 | } 210 | 211 | 212 | if(hood == 12) { 213 | newNbrhood(3); 214 | setNBH( -1, -1, 0, 0); 215 | setNBH( 0, -1, 0, 1); 216 | setNBH( -1, 0, 0, 2); 217 | } 218 | 219 | if(hood == 13) { 220 | newNbrhood(3); 221 | setNBH(-1, -1, 0, 0); 222 | setNBH(0, -1, 0, 1); 223 | setNBH(1, -1, 0, 2); 224 | } 225 | 226 | if(hood == 14) { 227 | newNbrhood(3); 228 | setNBH(-1, 0, 0, 0); 229 | setNBH(0, -1, 0, 1); 230 | setNBH(1, 0, 0, 2); 231 | } 232 | 233 | 234 | if(hood == 15) { 235 | newNbrhood(3); 236 | setNBH(0, -2, 0, 0); 237 | setNBH(-2, 0, 0, 1); 238 | setNBH(-1, -1, 0, 2); 239 | } 240 | 241 | 242 | if(hood == 16) { 243 | newNbrhood(4); 244 | setNBH(1, -1, 0, 0); 245 | setNBH(-1, -1, 0, 1); 246 | setNBH(0, -1, 0, 2); 247 | setNBH(0, -2, 0, 3); 248 | } 249 | 250 | if(hood == 17) { 251 | newNbrhood(4); 252 | setNBH(0, -2, 0, 0); 253 | setNBH(-2, 0, 0, 1); 254 | setNBH(-1, -1, 0, 2); 255 | setNBH(-2, -2, 0, 3); 256 | } 257 | 258 | 259 | if(hood == 18) { 260 | newNbrhood(5); 261 | setNBH(-1, -1, 0, 0); 262 | setNBH(1, -1, 0, 1); 263 | setNBH(0, -2, 0, 2); 264 | setNBH(-1, -2, 0, 3); 265 | setNBH(1, -2, 0, 4); 266 | } 267 | 268 | 269 | if(hood == 19) { 270 | newNbrhood(9); 271 | setNBH(-1, -3, 0, 0); 272 | setNBH(1, -3, 0, 1); 273 | setNBH(-2, -3, 0, 2); 274 | setNBH(2, -3, 0, 3); 275 | setNBH(0, -3, 0, 4); 276 | setNBH(-1, -2, 0, 5); 277 | setNBH(0, -2, 0, 6); 278 | setNBH(1, -2, 0, 7); 279 | setNBH(0, -1, 0, 8); 280 | } 281 | 282 | 283 | if(hood == 20) { 284 | newNbrhood(6); 285 | setNBH( -3, -1, 0, 0); 286 | setNBH( 3, -1, 0, 1); 287 | setNBH( -2, -2, 0, 2); 288 | setNBH( 2, -2, 0, 3); 289 | setNBH( -1, -1, 0, 4); 290 | setNBH( -1, -1, 0, 5); 291 | } 292 | 293 | 294 | if(hood == 21) { 295 | newNbrhood(6); 296 | setNBH(0, -1, 0, 0); 297 | setNBH(-1, 0, 0, 1); 298 | setNBH(0, 1, 0, 2); 299 | setNBH(1, 0, 0, 3); 300 | setNBH(-1, -1, 0, 4); 301 | setNBH(1, 1, 0, 5); 302 | } 303 | 304 | 305 | if(hood == 22) { 306 | newNbrhood(6); 307 | setNBH(-1, 0, 0, 0); 308 | setNBH( 1, 0, 0, 1); 309 | setNBH( 0,-1, 0, 2); 310 | setNBH( 0, 1, 0, 3); 311 | setNBH( 0, 0,-1, 4); 312 | setNBH( 0, 0, 1, 5); 313 | } 314 | 315 | 316 | if(hood == 23) { 317 | newNbrhood(1); 318 | setNBH(0, 0, -1, 0); 319 | } 320 | 321 | 322 | if(hood == 24) { 323 | newNbrhood(14); 324 | setNBH(0, 0, -1, 0); 325 | setNBH(0, -1, 0, 1); 326 | setNBH(-1, 0, 0, 2); 327 | setNBH(0, 0, 1, 3); 328 | setNBH(0, 1, 0, 4); 329 | setNBH(1, 0, 0, 5); 330 | 331 | setNBH(-1, -1, -1, 6); 332 | setNBH(-1, -1, 1, 7); 333 | setNBH(-1, 1, -1, 8); 334 | setNBH(-1, 1, 1, 9); 335 | 336 | setNBH(1, 1, 1, 10); 337 | setNBH(1, 1, -1, 11); 338 | setNBH(1, -1, 1, 12); 339 | setNBH(1, -1, -1, 13); 340 | } 341 | 342 | 343 | if(hood == 25) { 344 | newNbrhood(7); 345 | setNBH(1, -1, 0, 0); 346 | setNBH(-1, -1, 0, 1); 347 | setNBH(0, -1, 0, 2); 348 | setNBH(2, -1, 0, 5); 349 | setNBH(-2, -1, 0, 6); 350 | setNBH(1, -2, 0, 3); 351 | setNBH(-1, -2, 0, 4); 352 | } 353 | 354 | 355 | if(hood == 26) { 356 | newNbrhood(8); 357 | setNBH(1, -1, 0, 0); 358 | setNBH(-1, -1, 0, 1); 359 | setNBH(0, -1, 0, 2); 360 | setNBH(2, -1, 0, 5); 361 | setNBH(-2, -1, 0, 6); 362 | setNBH(1, -2, 0, 3); 363 | setNBH(-1, -2, 0, 4); 364 | setNBH(0, 0, 0, 7); 365 | } 366 | 367 | 368 | if(hood == 27) { 369 | newNbrhood(80); 370 | setNBH( 0, -1, 0, 0); 371 | setNBH( -1, 0, 0, 1); 372 | setNBH( 1, 0, 0, 2); 373 | setNBH( 0, 1, 0, 3); 374 | setNBH( -1, -1, 0, 4); 375 | setNBH( 1, 1, 0, 5); 376 | setNBH( -1, 1, 0, 6); 377 | setNBH( 1, -1, 0, 7); 378 | 379 | setNBH( -2, 0, 0, 8); 380 | setNBH( 2, 0, 0, 9); 381 | setNBH( -2, 1, 0, 10); 382 | setNBH( 2, 1, 0, 11); 383 | setNBH( -2, -1, 0, 12); 384 | setNBH( 2, -1, 0, 13); 385 | 386 | setNBH( 0, -2, 0, 14); 387 | setNBH( 0, 2, 0, 15); 388 | setNBH( 1, -2, 0, 16); 389 | setNBH( 1, 2, 0, 17); 390 | setNBH( -1, -2, 0, 18); 391 | setNBH( -1, 2, 0, 19); 392 | 393 | setNBH( -2, -2, 0, 20); 394 | setNBH( 2, 2, 0, 21); 395 | setNBH( 2, -2, 0, 22); 396 | setNBH( -2, 2, 0, 23); 397 | 398 | 399 | setNBH( -3, -3, 0, 24); 400 | setNBH( -2, -3, 0, 25); 401 | setNBH( -1, -3, 0, 26); 402 | setNBH( 0, -3, 0, 27); 403 | setNBH( 1, -3, 0, 28); 404 | setNBH( 2, -3, 0, 29); 405 | setNBH( 3, -3, 0, 30); 406 | 407 | setNBH( -3, 3, 0, 31); 408 | setNBH( -2, 3, 0, 32); 409 | setNBH( -1, 3, 0, 33); 410 | setNBH( 0, 3, 0, 34); 411 | setNBH( 1, 3, 0, 35); 412 | setNBH( 2, 3, 0, 36); 413 | setNBH( 3, 3, 0, 37); 414 | 415 | setNBH( -3, -2, 0, 38); 416 | setNBH( -3, -1, 0, 39); 417 | setNBH( -3, 0, 0, 40); 418 | setNBH( -3, 1, 0, 41); 419 | setNBH( -3, 2, 0, 42); 420 | 421 | setNBH( 3, -2, 0, 43); 422 | setNBH( 3, -1, 0, 44); 423 | setNBH( 3, 0, 0, 45); 424 | setNBH( 3, 1, 0, 46); 425 | setNBH( 3, 2, 0, 47); 426 | 427 | setNBH(0,-4,0,48); 428 | setNBH(1,-4,0,49); 429 | setNBH(2,-4,0,50); 430 | setNBH(3,-4,0,51); 431 | setNBH(4,-4,0,52); 432 | setNBH(4,-3,0,53); 433 | setNBH(4,-2,0,54); 434 | setNBH(4,-1,0,55); 435 | setNBH(4,0,0,56); 436 | setNBH(4,1,0,57); 437 | setNBH(4,2,0,58); 438 | setNBH(4,3,0,59); 439 | setNBH(4,4,0,60); 440 | setNBH(3,4,0,61); 441 | setNBH(2,4,0,62); 442 | setNBH(1,4,0,63); 443 | setNBH(0,4,0,64); 444 | setNBH(-1,4,0,65); 445 | setNBH(-2,4,0,66); 446 | setNBH(-3,4,0,67); 447 | setNBH(-4,4,0,68); 448 | setNBH(-4,3,0,69); 449 | setNBH(-4,2,0,70); 450 | setNBH(-4,1,0,71); 451 | setNBH(-4,0,0,72); 452 | setNBH(-4,-1,0,73); 453 | setNBH(-4,-2,0,74); 454 | setNBH(-4,-3,0,75); 455 | setNBH(-4,-4,0,76); 456 | setNBH(-3,-4,0,77); 457 | setNBH(-2,-4,0,78); 458 | setNBH(-1,-4,0,79); 459 | } 460 | 461 | 462 | if(hood == 28) { 463 | newNbrhood(9); 464 | setNBH( 0, 0, 0, 0); 465 | setNBH( 1, 0, 0, 1); 466 | setNBH( -1, 0, 0, 2); 467 | setNBH( 0, 1, 0, 3); 468 | setNBH( 0, -1, 0, 4); 469 | 470 | setNBH( 1, 0, 0, 5); 471 | setNBH( -1, 0, 0, 6); 472 | setNBH( 0, 1, 0, 7); 473 | setNBH( 0, -1, 0, 8); 474 | } 475 | 476 | 477 | if(hood == 29) { 478 | newNbrhood(48); 479 | 480 | setNBH( 0, -1, 0, 0); 481 | setNBH( -1, 0, 0, 1); 482 | setNBH( 1, 0, 0, 2); 483 | setNBH( 0, 1, 0, 3); 484 | setNBH( -1, -1, 0, 4); 485 | setNBH( 1, 1, 0, 5); 486 | setNBH( -1, 1, 0, 6); 487 | setNBH( 1, -1, 0, 7); 488 | 489 | setNBH( -2, 0, 0, 8); 490 | setNBH( 2, 0, 0, 9); 491 | setNBH( -2, 1, 0, 10); 492 | setNBH( 2, 1, 0, 11); 493 | setNBH( -2, -1, 0, 12); 494 | setNBH( 2, -1, 0, 13); 495 | 496 | setNBH( 0, -2, 0, 14); 497 | setNBH( 0, 2, 0, 15); 498 | setNBH( 1, -2, 0, 16); 499 | setNBH( 1, 2, 0, 17); 500 | setNBH( -1, -2, 0, 18); 501 | setNBH( -1, 2, 0, 19); 502 | 503 | setNBH( -2, -2, 0, 20); 504 | setNBH( 2, 2, 0, 21); 505 | setNBH( 2, -2, 0, 22); 506 | setNBH( -2, 2, 0, 23); 507 | 508 | 509 | setNBH( -3, -3, 0, 24); 510 | setNBH( -2, -3, 0, 25); 511 | setNBH( -1, -3, 0, 26); 512 | setNBH( 0, -3, 0, 27); 513 | setNBH( 1, -3, 0, 28); 514 | setNBH( 2, -3, 0, 29); 515 | setNBH( 3, -3, 0, 30); 516 | 517 | setNBH( -3, 3, 0, 31); 518 | setNBH( -2, 3, 0, 32); 519 | setNBH( -1, 3, 0, 33); 520 | setNBH( 0, 3, 0, 34); 521 | setNBH( 1, 3, 0, 35); 522 | setNBH( 2, 3, 0, 36); 523 | setNBH( 3, 3, 0, 37); 524 | 525 | setNBH( -3, -2, 0, 38); 526 | setNBH( -3, -1, 0, 39); 527 | setNBH( -3, 0, 0, 40); 528 | setNBH( -3, 1, 0, 41); 529 | setNBH( -3, 2, 0, 42); 530 | 531 | setNBH( 3, -2, 0, 43); 532 | setNBH( 3, -1, 0, 44); 533 | setNBH( 3, 0, 0, 45); 534 | setNBH( 3, 1, 0, 46); 535 | setNBH( 3, 2, 0, 47); 536 | } 537 | 538 | 539 | 540 | if(hood == 30) { 541 | newNbrhood(32); 542 | setNBH(0,-4,0,0); 543 | setNBH(1,-4,0,1); 544 | setNBH(2,-4,0,2); 545 | setNBH(3,-4,0,3); 546 | setNBH(4,-4,0,4); 547 | setNBH(4,-3,0,5); 548 | setNBH(4,-2,0,6); 549 | setNBH(4,-1,0,7); 550 | setNBH(4,0,0,8); 551 | setNBH(4,1,0,9); 552 | setNBH(4,2,0,10); 553 | setNBH(4,3,0,11); 554 | setNBH(4,4,0,12); 555 | setNBH(3,4,0,13); 556 | setNBH(2,4,0,14); 557 | setNBH(1,4,0,15); 558 | setNBH(0,4,0,16); 559 | setNBH(-1,4,0,17); 560 | setNBH(-2,4,0,18); 561 | setNBH(-3,4,0,19); 562 | setNBH(-4,4,0,20); 563 | setNBH(-4,3,0,21); 564 | setNBH(-4,2,0,22); 565 | setNBH(-4,1,0,23); 566 | setNBH(-4,0,0,24); 567 | setNBH(-4,-1,0,25); 568 | setNBH(-4,-2,0,26); 569 | setNBH(-4,-3,0,27); 570 | setNBH(-4,-4,0,28); 571 | setNBH(-3,-4,0,29); 572 | setNBH(-2,-4,0,30); 573 | setNBH(-1,-4,0,31); 574 | } 575 | 576 | 577 | 578 | if(hood == 31) { 579 | int n = r.nextInt(8)+1; 580 | newNbrhood(n); 581 | 582 | for (int ii = 0; ii < NBH.length; ii++) { 583 | setNBH(r.nextInt(3)-1, r.nextInt(3)-1, 0, ii); 584 | } 585 | } 586 | 587 | 588 | if(hood == 32) { 589 | int n = r.nextInt(64)+1; 590 | newNbrhood(n); 591 | 592 | for (int ii = 0; ii < NBH.length; ii++) { 593 | setNBH(r.nextInt(9)-4, r.nextInt(9)-4, 0, ii); 594 | } 595 | } 596 | 597 | if(hood == 33) { 598 | newNbrhood(12); 599 | setNBH( 0, -1, 0, 0); 600 | setNBH( 1, -1, 0, 1); 601 | setNBH( 1, 0, 0, 2); 602 | setNBH( 1, 1, 0, 3); 603 | setNBH( 0, 1, 0, 4); 604 | setNBH( -1, 1, 0, 5); 605 | setNBH( -1, 0, 0, 6); 606 | setNBH( -1, -1, 0, 7); 607 | setNBH( 0, 2, 0, 8); 608 | setNBH( 0, -2, 0, 9); 609 | setNBH( 2, 0, 0, 10); 610 | setNBH( -2, 0, 0, 11); 611 | } 612 | 613 | if(hood == 34) { 614 | newNbrhood(20); 615 | setNBH( 0, -1, 0, 0); 616 | setNBH( 1, -1, 0, 1); 617 | setNBH( 1, 0, 0, 2); 618 | setNBH( 1, 1, 0, 3); 619 | setNBH( 0, 1, 0, 4); 620 | setNBH( -1, 1, 0, 5); 621 | setNBH( -1, 0, 0, 6); 622 | setNBH( -1, -1, 0, 7); 623 | 624 | setNBH( 0, 2, 0, 8); 625 | setNBH( 0, -2, 0, 9); 626 | setNBH( 2, 0, 0, 10); 627 | setNBH( -2, 0, 0, 11); 628 | 629 | setNBH( 2, 1, 0, 12); 630 | setNBH( 2, -1, 0, 13); 631 | setNBH( 1, 2, 0, 14); 632 | setNBH( -1, 2, 0, 15); 633 | setNBH( -2, 1, 0, 16); 634 | setNBH( -2, -1, 0, 17); 635 | setNBH( 1, -2, 0, 18); 636 | setNBH( -1, -2, 0, 19); 637 | } 638 | 639 | 640 | if(hood == 35 ) { 641 | newNbrhood(17); 642 | setNBH( -1, -2, 0, 0); 643 | setNBH( 0, -2, 0, 1); 644 | setNBH( 0, -1, 0, 2); 645 | setNBH( 1, -2, 0, 3); 646 | setNBH( 2, -2, 0, 4); 647 | setNBH( 2, -1, 0, 5); 648 | setNBH( 2, 0, 0, 6); 649 | setNBH( 2, 1, 0, 7); 650 | setNBH( 2, 2, 0, 8); 651 | setNBH( 1, 2, 0, 9); 652 | setNBH( 0, 2, 0, 10); 653 | setNBH( -1, 2, 0, 11); 654 | setNBH( -2, 2, 0, 12); 655 | setNBH( -2, 1, 0, 13); 656 | setNBH( -1, 0, 0, 14); 657 | setNBH( -2, 0, 0, 15); 658 | setNBH( -2, -1, 0, 16); 659 | } 660 | 661 | 662 | if(hood == 36 ) { 663 | newNbrhood(8); 664 | setNBH( 1, -2, 0, 0); 665 | setNBH( 2, -1, 0, 1); 666 | setNBH( 2, 1, 0, 2); 667 | setNBH( 1, 2, 0, 3); 668 | setNBH( -1, 2, 0, 4); 669 | setNBH( -2, 1, 0, 5); 670 | setNBH( -2, -1, 0, 6); 671 | setNBH( -1, -2, 0, 7); 672 | } 673 | 674 | 675 | if(hood == 37 ) { 676 | newNbrhood(12); 677 | setNBH( 0, -2, 0, 0); 678 | setNBH( 1, -2, 0, 1); 679 | 680 | setNBH( 1, -1, 0, 2); 681 | setNBH( 2, 0, 0, 3); 682 | setNBH( 2, 1, 0, 4); 683 | setNBH( 1, 1, 0, 5); 684 | setNBH( 0, 2, 0, 6); 685 | setNBH( -1, 2, 0, 7); 686 | setNBH( -1, 1, 0, 8); 687 | setNBH( -2, 0, 0, 9); 688 | setNBH( -2, -1, 0, 10); 689 | setNBH( -1, -1, 0, 11); 690 | } 691 | 692 | 693 | if(hood == 38 ) { 694 | newNbrhood(24); 695 | setNBH( 0, -1, 0, 0); 696 | setNBH( 1, -1, 0, 1); 697 | setNBH( 1, 0, 0, 2); 698 | setNBH( 1, 1, 0, 3); 699 | setNBH( 0, 1, 0, 4); 700 | setNBH( -1, 1, 0, 5); 701 | setNBH( -1, 0, 0, 6); 702 | setNBH( -1, -1, 0, 7); 703 | 704 | setNBH( 0, -3, 0, 8); 705 | setNBH( 1, -3, 0, 9); 706 | setNBH( 2, -2, 0, 10); 707 | setNBH( 3, -1, 0, 11); 708 | setNBH( 3, 0, 0, 12); 709 | setNBH( 3, 1, 0, 13); 710 | setNBH( 2, 2, 0, 14); 711 | setNBH( 1, 3, 0, 15); 712 | setNBH( 0, 3, 0, 16); 713 | setNBH( -1, 3, 0, 17); 714 | setNBH( -2, 2, 0, 18); 715 | setNBH( -3, 1, 0, 19); 716 | setNBH( -3, 0, 0, 20); 717 | setNBH( -3, -1, 0, 21); 718 | setNBH( -2, -2, 0, 22); 719 | setNBH( -1, -3, 0, 23); 720 | } 721 | 722 | if(hood == 39) { 723 | newNbrhood(16); 724 | setNBH( 0, -1, 0, 0); 725 | setNBH( 1, -1, 0, 1); 726 | setNBH( 1, 0, 0, 2); 727 | setNBH( 1, 1, 0, 3); 728 | setNBH( 0, 1, 0, 4); 729 | setNBH( -1, 1, 0, 5); 730 | setNBH( -1, 0, 0, 6); 731 | setNBH( -1, -1, 0, 7); 732 | 733 | setNBH( 0, 2, 0, 8); 734 | setNBH( 0, -2, 0, 9); 735 | setNBH( 2, 0, 0, 10); 736 | setNBH( -2, 0, 0, 11); 737 | 738 | setNBH( 2, 1, 0, 12); 739 | //setNBH( 2, -1, 0, 13); 740 | setNBH( 1, 2, 0, 13); 741 | //setNBH( -1, 2, 0, 15); 742 | //setNBH( -2, 1, 0, 16); 743 | setNBH( -2, -1, 0, 14); 744 | //setNBH( 1, -2, 0, 18); 745 | setNBH( -1, -2, 0, 15); 746 | } 747 | 748 | /*if(hood == 40) { 749 | newNbrhood(4); 750 | setNBH( 0, 0, 0, 0); 751 | setNBH( 1, 0, 0, 1); 752 | setNBH( 0, 1, 0, 2); 753 | setNBH( 1, 1, 0, 3); 754 | } 755 | 756 | if(hood == 41) { 757 | newNbrhood(4); 758 | setNBH( 0, 0, 0, 0); 759 | setNBH( -1, 0, 0, 1); 760 | setNBH( 0, -1, 0, 2); 761 | setNBH( -1, -1, 0, 3); 762 | } 763 | 764 | if(hood == 42) { 765 | newNbrhood(4); 766 | setNBH( 0, 0, 0, 0); 767 | setNBH( -1, 0, 0, 1); 768 | setNBH( 0, 1, 0, 2); 769 | setNBH( -1, 1, 0, 3); 770 | } 771 | 772 | if(hood == 43) { 773 | newNbrhood(4); 774 | setNBH( 0, 0, 0, 0); 775 | setNBH( 1, 0, 0, 1); 776 | setNBH( 0, -1, 0, 2); 777 | setNBH( 1, -1, 0, 3); 778 | }*/ 779 | 780 | if(hood == 40) { 781 | newNbrhood(2); 782 | setNBH( 1, 0, 0, 0); 783 | setNBH( 0, 1, 0, 1); 784 | } 785 | 786 | if(hood == 42) { 787 | newNbrhood(2); 788 | setNBH( -1, 0, 0, 0); 789 | setNBH( 0, -1, 0, 1); 790 | } 791 | 792 | if(hood == 41) { 793 | newNbrhood(2); 794 | setNBH( -1, 0, 0, 0); 795 | setNBH( 0, 1, 0, 1); 796 | } 797 | 798 | if(hood == 43) { 799 | newNbrhood(2); 800 | setNBH( 1, 0, 0, 0); 801 | setNBH( 0, -1, 0, 1); 802 | } 803 | 804 | if(hood == 44) { 805 | int n = r.nextInt(88)+1; 806 | newNbrhood(n); 807 | 808 | for (int ii = 0; ii < NBH.length; ii++) { 809 | setNBH(r.nextInt(3)-1, r.nextInt(3)-1, 0, ii); 810 | } 811 | } 812 | 813 | 814 | /* 815 | if(hood == 3) { 816 | newNbrhood(xxx); 817 | 818 | } 819 | 820 | /* 821 | if(hood == 3) { 822 | newNbrhood(xxx); 823 | 824 | } 825 | 826 | /* 827 | if(hood == 3) { 828 | newNbrhood(xxx); 829 | 830 | } 831 | 832 | /* 833 | if(hood == 3) { 834 | newNbrhood(xxx); 835 | 836 | } 837 | 838 | /* 839 | if(hood == 3) { 840 | newNbrhood(xxx); 841 | 842 | } 843 | 844 | /* 845 | if(hood == 3) { 846 | newNbrhood(xxx); 847 | 848 | } 849 | 850 | /* 851 | if(hood == 3) { 852 | newNbrhood(xxx); 853 | 854 | } 855 | 856 | 857 | /**/ 858 | 859 | } 860 | 861 | }/* 862 | */ -------------------------------------------------------------------------------- /CellularAutomata/Omniscience/src/ml.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | import java.awt.MouseInfo; 4 | import java.awt.Point; 5 | import java.awt.event.MouseListener; 6 | import java.awt.event.MouseEvent; 7 | import java.util.Random; 8 | 9 | import javax.swing.JLabel; 10 | import javax.swing.JOptionPane; 11 | import javax.swing.JPanel; 12 | 13 | 14 | @SuppressWarnings("serial") 15 | public class ml extends JPanel implements MouseListener { 16 | 17 | //create containers for reference objects 18 | Main m; 19 | Surf[] s; 20 | JLabel l; 21 | Point p; 22 | Point p2; 23 | Universe u[]; 24 | Random r = new Random(); 25 | dataSources d = new dataSources(); 26 | slider[] sl; 27 | 28 | int totalFunctions = 88 +1; 29 | int totalHoods; 30 | int totalColourSchemes = 4 +1; 31 | 32 | int sfcnum = 0; //index of current active/interactable surface 33 | int sfcmax; //total number of surfaces to cycle through 34 | 35 | int myFunction = 0; //reference for current mouse function on click 36 | int functionType = 0; //Determines subclass of functions to execute, like a menu. 37 | 38 | int fcnt = 5; //total number of mouse functions to iterate through 39 | int fnctype = 4; //tot number of function catagorys 40 | 41 | int mwPos = 0; //Everyone references the MW cycle 42 | int mwMax = fcnt; //default position in the MW cycle, will change frequently 43 | int cycleNum = 0; //for Mousewheel to identify which type to cycle 44 | 45 | int blockVal = 1; 46 | int blockSize = 16; 47 | int seedVal = 1; 48 | int seedRand = 6; 49 | int rule = 0; 50 | int seedRndVar = 1; 51 | int toolRand = 1; 52 | int toolVar = 1; 53 | int custNHood=0; 54 | int ROver = -1; 55 | int colourScheme = -1; 56 | 57 | int[] slideVal; 58 | int growDieThreshold = 0; 59 | 60 | int gui_toolRand = toolRand; 61 | int gui_toolVar = toolVar; 62 | int gui_blockVal = blockVal; 63 | int gui_blockSize = blockSize; 64 | int gui_nHood = custNHood; 65 | int gui_ROver = ROver; 66 | int gui_colourScheme = colourScheme; 67 | 68 | int copyPasteBlockSize = 16; 69 | 70 | boolean resetVal = true; 71 | int[] params = {0,0,0,0}; 72 | 73 | int[][] customTF_NHood = {}; 74 | 75 | //constructor 76 | public ml(Main mm, Surf[] ss, JLabel ll, Universe uni[], slider[] ssl) { 77 | //System.out.println("ml"); 78 | m=mm; 79 | s=ss; 80 | l=ll; 81 | u=uni; 82 | sl=ssl; 83 | slideVal = new int[sl.length]; 84 | m.addMouseListener(this); 85 | 86 | sfcmax=s.length; 87 | functionType = 0; 88 | 89 | totalHoods = u[0].a.n.hoodCount; 90 | } 91 | 92 | public void setU(Universe uni[]) { 93 | u=uni; 94 | } 95 | 96 | public void mousePressed(MouseEvent e) { 97 | //refresh(); 98 | //get location information from mouse & jframes 99 | p = MouseInfo.getPointerInfo().getLocation(); 100 | p2 = m.getLocation(); 101 | int mx =(p.x - p2.x - 2 - s[sfcnum].getX()); 102 | int my =(p.y - p2.y - 24 - m.getJMenuBar().getHeight() - s[sfcnum].getY()); 103 | 104 | 105 | 106 | //Left Click 107 | if((e == null || e.getButton() == MouseEvent.BUTTON1) && (mx >= 0 && my > 0) && (mx < s[sfcnum].getWidth() && my < s[sfcnum].getHeight()+1) ) { 108 | 109 | if(functionType == 0) { 110 | 111 | if (myFunction == 0) { //Place Block Small 112 | if(blockSize < 0) {blockSize=1;} 113 | if(toolRand <= 0) {toolRand=1;} 114 | if(toolVar <= 0) {toolVar=1;} 115 | if(resetVal) {blockVal = 1;resetVal=false;} 116 | placeBlock(mx, my, 0); 117 | } 118 | 119 | if (myFunction == 1) { //Place Block Small 120 | if(blockSize < 0) {blockSize=3;} 121 | if(toolRand <= 0) {toolRand=1;} 122 | if(toolVar <= 0) {toolVar=1;} 123 | if(resetVal) {blockVal = 1;resetVal=false;} 124 | placeBlock(mx, my, 0); 125 | } 126 | 127 | if (myFunction == 2) { //Place block medium 128 | if(blockSize < 0) {blockSize=8;} 129 | if(toolRand <= 0) {toolRand=1;} 130 | if(toolVar <= 0) {toolVar=1;} 131 | if(resetVal) {blockVal = 1;resetVal=false;} 132 | placeBlock(mx, my, 0); 133 | } 134 | 135 | if (myFunction == 3) { //Place Block Big 136 | if(blockSize < 0) {blockSize=14;} 137 | if(toolRand <= 0) {toolRand=1;} 138 | if(toolVar <= 0) {toolVar=1;} 139 | if(resetVal) {blockVal = 1;resetVal=false;} 140 | placeBlock(mx, my, 0); 141 | } 142 | 143 | if (myFunction == 4) { //Place Block Bigger 144 | if(blockSize < 0) {blockSize=32;} 145 | if(toolRand <= 0) {toolRand=1;} 146 | if(toolVar <= 0) {toolVar=1;} 147 | if(resetVal) {blockVal = 1;resetVal=false;} 148 | placeBlock(mx, my, 0); 149 | } 150 | } 151 | 152 | //Function type/catagory 1's options 153 | if(functionType == 1) { 154 | if (myFunction == 0) { //chance block random Light 155 | if(blockSize < 0) {blockSize=16;} 156 | if(toolRand <= 0) {toolRand=24;} 157 | if(toolVar <= 0) {toolVar=1;} 158 | if(resetVal) {blockVal=1;resetVal=false;} 159 | placeBlock(mx, my, 0); 160 | } 161 | 162 | if (myFunction == 1) { //chance block random Heavy 163 | if(blockSize < 0) {blockSize= 16;} 164 | if(toolRand <= 0) {toolRand=12;} 165 | if(toolVar <= 0) {toolVar=32;} 166 | if(resetVal) {blockVal=-16;resetVal=false;} 167 | placeBlock(mx, my, 0); 168 | } 169 | 170 | if (myFunction == 2) { //Place Big Block Horizontal 3-step Stripes 171 | if(blockSize < 0) {blockSize= 20;} 172 | if(toolRand <= 0) {toolRand=1;} 173 | if(toolVar <= 0) {toolVar=1;} 174 | if(resetVal) {blockVal = 1;resetVal=false;} 175 | placeStripe(mx, my, 0, 3); 176 | } 177 | 178 | if (myFunction == 3) { //Place medium Block 2-step Stripes 179 | if(blockSize < 0) {blockSize= 20;} 180 | if(toolRand <= 0) {toolRand=1;} 181 | if(toolVar <= 0) {toolVar=1;} 182 | if(resetVal) {blockVal = 1;resetVal=false;} 183 | placeStripe(mx, my, 0, 2); 184 | } 185 | 186 | if (myFunction == 4) { 187 | if(blockSize < 0) {blockSize=6;} 188 | if(toolRand <= 0) {toolRand=3;} 189 | if(toolVar <= 0) {toolVar=3;} 190 | if(resetVal) {blockVal=-1;resetVal=false;} 191 | placeBlock(mx, my, 0); 192 | } 193 | 194 | } 195 | 196 | //Function type/catagory 2's options 197 | if(functionType == 2) { 198 | 199 | 200 | 201 | if (myFunction == 0) { //chance Set to 0, large 202 | if(blockSize < 0) {blockSize=1;} 203 | if(toolRand <= 0) {toolRand=1;} 204 | if(toolVar <= 0) {toolVar=1;} 205 | if(resetVal) {blockVal = 0;resetVal=false;} 206 | placeBlock(mx, my, 0); 207 | } 208 | 209 | if (myFunction == 1) { //Set to 0, medium 210 | if(blockSize < 0) {blockSize=8;} 211 | if(toolRand <= 0) {toolRand=1;} 212 | if(toolVar <= 0) {toolVar=1;} 213 | if(resetVal) {blockVal = 0;resetVal=false;} 214 | placeBlock(mx, my, 0); 215 | } 216 | 217 | if (myFunction == 2) { //Set to 0, large 218 | if(blockSize < 0) {blockSize=32;} 219 | if(toolRand <= 0) {toolRand=1;} 220 | if(toolVar <= 0) {toolVar=1;} 221 | if(resetVal) {blockVal = 0;resetVal=false;} 222 | placeBlock(mx, my, 0); 223 | } 224 | 225 | if (myFunction == 3) { //Set to 0, large 226 | if(blockSize < 0) {blockSize=24;} 227 | if(toolRand <= 0) {toolRand=12;} 228 | if(toolVar <= 0) {toolVar=1;} 229 | if(resetVal) {blockVal = 0;resetVal=false;} 230 | placeBlock(mx, my, 0); 231 | } 232 | 233 | if (myFunction == 4) { //Set to 0, large 234 | if(blockSize < 0) {blockSize=6;} 235 | if(toolRand <= 0) {toolRand=4;} 236 | if(toolVar <= 0) {toolVar=1;} 237 | if(resetVal) {blockVal = 0;resetVal=false;} 238 | placeBlock(mx, my, 0); 239 | } 240 | 241 | } 242 | 243 | if(functionType == 3) { 244 | if (myFunction == 0) { 245 | if(blockSize < 0) {blockSize= 16;} 246 | if(toolRand <= 0) {toolRand=12;} 247 | if(toolVar <= 0) {toolVar=32;} 248 | if(resetVal) {blockVal=-16;resetVal=false;} 249 | placeBlock(mx, my, 0); 250 | } 251 | 252 | if (myFunction == 1) { 253 | if(blockSize < 0) {blockSize=copyPasteBlockSize;} 254 | if(toolRand <= 0) {toolRand=1;} 255 | if(toolVar <= 0) {toolVar=1;} 256 | placeData(mx, my, 0); 257 | } 258 | 259 | if (myFunction == 2) { 260 | if(blockSize < 0) {blockSize=copyPasteBlockSize;} 261 | if(toolRand <= 0) {toolRand=1;} 262 | if(toolVar <= 0) {toolVar=1;} 263 | captureData(mx, my, 0); 264 | } 265 | 266 | } 267 | 268 | //Function type/catagory 4's options 269 | /*if(functionType == 3) { 270 | if (myFunction == 0) { //Scroll through surfaces 271 | sfcnum++; 272 | sfcnum = sfcnum % sfcmax; 273 | } 274 | 275 | if (myFunction == 1) { //Change instruction set to a random instruction 276 | setRandom_3_InstructionWithSeed(); 277 | } 278 | 279 | }*/ 280 | 281 | 282 | //Function type/catagory 5's options 283 | /*if(functionType == 5) { 284 | if (myFunction == 1) { // 285 | s[sfcnum].u.a.seedAll(4, 1); 286 | } 287 | 288 | if (myFunction == 2) { // 289 | 290 | } 291 | 292 | if (myFunction == 3) { // 293 | 294 | } 295 | 296 | if (myFunction == 4) { // 297 | 298 | } 299 | }*/ 300 | 301 | 302 | 303 | 304 | } 305 | 306 | //Middle Click - Function Type 307 | /*if(e != null && e.getButton() == MouseEvent.BUTTON2) { 308 | functionType++; 309 | functionType=functionType%fnctype; 310 | updateListing(); 311 | }*/ 312 | 313 | //Right Click - Pause controller 314 | if(e != null && e.getButton() == MouseEvent.BUTTON3) { 315 | toggleStart(); 316 | } 317 | 318 | //middle click: erase layer 319 | if(e != null && e.getButton() == MouseEvent.BUTTON2){ 320 | eraseLayer(); 321 | } 322 | 323 | refresh(); 324 | } 325 | 326 | public void ruleLenChanged(){ 327 | u[0].a.n.newCNAr(u[0].instructions.length); 328 | } 329 | 330 | public void ruleChanged(int rulenum){ 331 | if(rulenum == 87) { 332 | sl[0].existential(true); 333 | sl[1].existential(true); 334 | sl[1].setMax(5000); 335 | } else if(rulenum == 83) { 336 | sl[0].existential(true); 337 | sl[1].existential(true); 338 | sl[1].setMax(10); 339 | } else if(rulenum == 82) { 340 | sl[0].existential(true); 341 | sl[1].existential(true); 342 | sl[1].setMax(7); 343 | } else if(rulenum == 81) { 344 | sl[0].existential(true); 345 | sl[1].existential(true); 346 | sl[1].setMax(8); 347 | } else if(rulenum == 80) { 348 | sl[0].existential(true); 349 | sl[1].existential(true); 350 | sl[1].setMax(9); 351 | }else if(rulenum == 79) { 352 | sl[0].existential(true); 353 | sl[1].existential(true); 354 | sl[1].setMax(33); 355 | } else if(rulenum == 78) { 356 | sl[0].existential(true); 357 | sl[1].existential(true); 358 | sl[1].setMax(150); 359 | } else if(rulenum == 77) { 360 | sl[0].existential(true); 361 | sl[1].existential(true); 362 | sl[1].setMax(8); 363 | } else if(rulenum == 76) { 364 | sl[0].existential(true); 365 | sl[1].existential(true); 366 | sl[1].setMax(16); 367 | } else if(rulenum == 75) { 368 | sl[0].existential(true); 369 | sl[1].existential(true); 370 | sl[1].setMax(48); 371 | }else if(rulenum == 74) { 372 | sl[0].existential(true); 373 | sl[1].existential(true); 374 | sl[1].setMax(6); 375 | } else if(rulenum == 73) { 376 | sl[0].existential(true); 377 | sl[1].existential(true); 378 | sl[1].setMax(8); 379 | } else if(rulenum == 72) { 380 | sl[0].existential(true); 381 | sl[1].existential(true); 382 | sl[1].setMax(25); 383 | } else { 384 | sl[0].existential(false); 385 | sl[1].existential(false); 386 | } 387 | 388 | updateListing(); 389 | //System.out.println("RULENUM" +rulenum); 390 | } 391 | 392 | 393 | //identifies the mousefunction action that is highlighted 394 | public void updateListing(){ 395 | 396 | 397 | //convert pause state to string 398 | String tmps = ""; 399 | for(int i = 0; i < s.length; i++) { 400 | if(s[i].paused == true) {tmps+="1";} else {tmps+="0";} 401 | if(s[i].upaused == true) {tmps+="1";} else {tmps+="0";} 402 | } 403 | 404 | String tmps2 = ""; 405 | int i; 406 | for(i = 0; i < u[0].instructions.length; i++) { 407 | tmps2 += u[0].instructions[i][0]; 408 | if(i < u[0].instructions.length-1) {tmps2 += ",";} 409 | if(i%6==5) {tmps2 += "
";} 410 | } 411 | 412 | tmps2 += "}
"; 413 | tmps2 = "
{" + tmps2; 414 | 415 | 416 | 417 | String tmps3 = "
["; 418 | 419 | for(i = 0; i < slideVal.length; i++) { 420 | tmps3 += slideVal[i]; 421 | //tmps3 += slideVal[i+1]; 422 | if(i != slideVal.length-1){tmps3 += ",";} 423 | } 424 | tmps3 += "]
"; 425 | 426 | 427 | 428 | String tmps4 = "
["; 429 | 430 | for(i = 0; i < s[sfcnum].u.a.min_grow_die[0].length; i+=2) { 431 | tmps4 += s[sfcnum].u.a.min_grow_die[0][i]; 432 | tmps4 += "-"; 433 | tmps4 += s[sfcnum].u.a.min_grow_die[0][i+1]; 434 | if(i < s[sfcnum].u.a.min_grow_die[0].length-2){tmps4 += ";";} 435 | } 436 | tmps4 += "]"; 437 | 438 | 439 | 440 | String tmps5 = ""; 441 | for(i = 0; i < u[0].a.n.useCustNbrAr.length; i++) { 442 | tmps5 += u[0].a.n.useCustNbrAr[i]; 443 | if(i < u[0].a.n.useCustNbrAr.length-1) {tmps5 += ",";} 444 | if(i%6==5) {tmps5 += "
";} 445 | } 446 | tmps5 += "}
"; 447 | tmps5 = "
{" + tmps5; 448 | 449 | 450 | l.setText( 451 | 452 | "" + 453 | sfcnum +" Active Window
" + 454 | s[sfcnum].zdraw +" Z-Layer
" + 455 | tmps +" Pause Status
" + 456 | functionType +" Tool
" + 457 | myFunction +" SubTool
" + 458 | mwPos +" MsWheel Raw#
" + 459 | cycleNum +" MouseWheel
" + 460 | blockSize +" Block Size
" + 461 | blockVal +" Block Value
" + 462 | u[0].a.n.useCustom +" NbrHood Override
" + 463 | u[0].a.instrOverride+" Rule Override
" + 464 | 465 | "Ruleset:" + tmps2 + 466 | "Custom Neighbours:"+ tmps5 + 467 | "Sliders:" + tmps3 + 468 | "Slider Rule:" + tmps4 + 469 | 470 | 471 | 472 | 473 | "
" 474 | 475 | ); 476 | 477 | } 478 | 479 | //called during initial program configuration, or to pause/unpause on right click 480 | public void toggleStart() { 481 | 482 | if(s[sfcnum].upaused ) { s[sfcnum].upaused = false; } else { s[sfcnum].upaused = true; } 483 | if(s[sfcnum].paused ) { s[sfcnum].paused = false; } else { s[sfcnum].paused = true; } 484 | 485 | //refresh(); 486 | } 487 | 488 | public void autoZ() { 489 | s[sfcnum].zdraw++; 490 | s[sfcnum].zdraw = s[sfcnum].zdraw % s[sfcnum].zz; 491 | } 492 | 493 | //called from class mwl, scrolls subfunction on mousewheel event 494 | public void mouseWheelScrolled(int mw_rotation) { 495 | 496 | if(mw_rotation == -1) { 497 | mwPos++; 498 | mwPos=mwPos%mwMax; 499 | } 500 | 501 | if(mw_rotation == 1) { 502 | mwPos+=(mwMax-1); 503 | mwPos=mwPos%mwMax; 504 | } 505 | 506 | setCycle(); 507 | 508 | refresh(); 509 | } 510 | 511 | public void setCycle(){ 512 | if(cycleNum == 0) {myFunction = mwPos;blockSize = -1;toolRand = -1;toolVar = -1;resetVal = true;} 513 | if(cycleNum == 1) {s[sfcnum].zdraw = mwPos;} 514 | if(cycleNum == 2) {cycleRules(); } 515 | if(cycleNum == 3) {blockSize = mwPos;gui_blockSize = mwPos;} 516 | if(cycleNum == 4) {blockVal = ((mwPos+150)%300)-150;gui_blockVal = blockVal;} 517 | if(cycleNum == 5) {cycleNeighbours(mwPos-2); } 518 | if(cycleNum == 6) {cycleMidSpace(); } 519 | if(cycleNum == 7) {cycleColourSchemes(); } 520 | refresh(); 521 | } 522 | 523 | private void cycleColourSchemes(){ 524 | s[sfcnum].colourScheme = mwPos-1; 525 | } 526 | 527 | private void cycleMidSpace(){ 528 | u[0].a.instrOverride = mwPos-2; 529 | } 530 | 531 | private void cycleNeighbours(int toNbr){ 532 | u[0].a.n.TFNbH = customTF_NHood; 533 | u[0].a.n.useCustom = 1; 534 | u[0].a.n.setNbrhoodAr(toNbr); 535 | } 536 | 537 | public void eraseNbrAr() { 538 | u[0].a.n.resetNbrAr(); 539 | } 540 | 541 | public void toggleCustNbr() { 542 | if(u[0].a.n.useCustom == 1){u[0].a.n.useCustom = 0;} 543 | else {u[0].a.n.useCustom = 1;} 544 | 545 | } 546 | 547 | private void cycleRules(){ 548 | s[sfcnum].u.resetArZ(0, s[sfcnum].zdraw); 549 | s[sfcnum].u.a.seedZ(seedRand, s[sfcnum].zdraw, seedVal, seedRndVar); 550 | addRule(mwPos); 551 | ruleChanged(mwPos); 552 | } 553 | 554 | 555 | 556 | private void addRule(int ru) { 557 | rule=ru; 558 | int tmp[][] = new int[u[0].instructions.length+1][5]; 559 | int i; 560 | for(i = 0; i< u[0].instructions.length; i++) { 561 | tmp[i] = u[0].instructions[i]; 562 | } 563 | 564 | if(i == 0) { 565 | tmp[i] = new int[]{rule, s[sfcnum].zdraw, seedRand, 0, seedVal}; 566 | u[0].instructions = tmp; 567 | i++; 568 | } 569 | 570 | if(tmp[i-1][1] != s[sfcnum].zdraw) { 571 | tmp[i] = new int[]{rule, s[sfcnum].zdraw, seedRand, 0, seedVal}; 572 | u[0].instructions = tmp; 573 | }else { 574 | int tmp2[][] = new int[u[0].instructions.length][5]; 575 | for(int j = 0; j < u[0].instructions.length; j++) { 576 | tmp2[j] = u[0].instructions[j]; 577 | } 578 | tmp2[i-1] = new int[]{rule, s[sfcnum].zdraw, seedRand, 0, seedVal}; 579 | u[0].instructions = tmp2; 580 | } 581 | 582 | 583 | } 584 | 585 | 586 | public void setRule(int ru) { 587 | 588 | u[0].instructions = new int[][] { 589 | {ru, s[sfcnum].zdraw, r.nextInt(64)+1, r.nextInt(64)+1} 590 | }; 591 | refresh(); 592 | } 593 | 594 | 595 | public void eraseAll(){ 596 | for(int i = 0; i < s[sfcnum].zz; i++) { 597 | s[sfcnum].u.resetArZ(0,i); 598 | } 599 | refresh(); 600 | } 601 | 602 | public void eraseLayer(){ 603 | for(int i = 0; i < s[sfcnum].zz; i++) { 604 | s[sfcnum].u.resetArZ(0, s[sfcnum].zdraw); 605 | } 606 | refresh(); 607 | } 608 | 609 | public void reseedAll(int rand, int val) { 610 | eraseAll(); 611 | s[sfcnum].u.a.seedAll(seedRand, seedVal, seedRndVar); 612 | refresh(); 613 | } 614 | 615 | public void reseedLayer(int rand, int val) { 616 | eraseLayer(); 617 | s[sfcnum].u.a.seedZ(rand, s[sfcnum].zdraw, val, seedRndVar); 618 | refresh(); 619 | } 620 | 621 | public void refresh() { 622 | //updates menu listing 623 | updateListing(); 624 | 625 | //This makes blocks placed while paused visible 626 | if(s[sfcnum].upaused) { 627 | if(s[sfcnum].paused) { 628 | s[sfcnum].paused = false; 629 | } 630 | } 631 | 632 | //refreshes elements that may have been altered 633 | s[sfcnum].repaint(); 634 | } 635 | 636 | public void setFunctionType(int funct) { 637 | functionType=funct; 638 | refresh(); 639 | } 640 | 641 | public void setRandom_3_InstructionWithSeed(){ 642 | 643 | 644 | u[0].instructions = new int[][] { 645 | //Action, Z, RAND, THRESHOLD, Value 646 | {r.nextInt(totalFunctions+1)-1, s[sfcnum].zdraw, r.nextInt(64)+1, r.nextInt(64)+1, r.nextInt(64)+1}, //random function 647 | {r.nextInt(totalFunctions+1)-1, s[sfcnum].zdraw, r.nextInt(64)+1, r.nextInt(64)+1, r.nextInt(64)+1}, //random function 648 | {r.nextInt(totalFunctions+1)-1, s[sfcnum].zdraw, r.nextInt(64)+1, r.nextInt(64)+1, r.nextInt(64)+1} //random function 649 | }; 650 | 651 | 652 | ruleChanged(u[0].instructions[u[0].instructions.length-1][0]); 653 | 654 | for(int i = 0; i < u[0].instructions.length; i++) { 655 | //set last neighbour 656 | u[0].a.n.setIndexNbrhoodAr(r.nextInt(u[0].a.n.hoodCount)-2, i); 657 | //add blank neighbour mask 658 | ruleLenChanged(); 659 | } 660 | 661 | refresh(); 662 | } 663 | 664 | public void setRandomRule(){ 665 | 666 | 667 | u[0].instructions = new int[][] { 668 | //Action, Z, RAND, THRESHOLD, Value 669 | {r.nextInt(totalFunctions), s[sfcnum].zdraw, r.nextInt(64)+1, r.nextInt(64)+1} 670 | }; 671 | ruleChanged(u[0].instructions[u[0].instructions.length-1][0]); 672 | refresh(); 673 | } 674 | 675 | public void dialogReseed(){ 676 | String str = JOptionPane.showInputDialog(m, "Seed, with chance one out of:", String.valueOf(seedRand)); 677 | String str2 = JOptionPane.showInputDialog(m, "Set cell value:", String.valueOf(seedVal)); 678 | String str3 = JOptionPane.showInputDialog(m, "Set random variation in value:", seedRndVar); 679 | if(str != null && str2 != null) { 680 | seedRand = Integer.parseInt(str); 681 | seedVal = Integer.parseInt(str2); 682 | seedRndVar = Integer.parseInt(str3); 683 | //reseedAll(seedRand, seedVal); 684 | reseedLayer(seedRand,seedVal); 685 | } 686 | } 687 | 688 | public void dialogRule(){ 689 | String str = JOptionPane.showInputDialog(m, "Go to rule (0-"+(totalFunctions-1)+"):", "0"); 690 | if(str != null) { 691 | int sVal = Integer.parseInt(str); 692 | 693 | u[0].instructions = new int[][] { 694 | {sVal, s[sfcnum].zdraw, r.nextInt(64)+1, r.nextInt(64)+1} 695 | }; 696 | } 697 | } 698 | 699 | 700 | public void dialogRuleBounds(){ 701 | String str = JOptionPane.showInputDialog(m, "Target Parmeter (0-5):", "0"); 702 | //String str2 = JOptionPane.showInputDialog(m, "Value:", "0"); 703 | if(str != null /*&& str2 != null*/) { 704 | int sVal = Integer.parseInt(str); 705 | growDieThreshold = sVal; 706 | } 707 | } 708 | 709 | public void setRuleGDThresh(int slideNum){ 710 | if(slideNum == 0){ 711 | growDieThreshold = slideVal[slideNum]; 712 | } 713 | 714 | if(slideNum == 1){ 715 | if(growDieThreshold%2 == 0) { 716 | s[sfcnum].u.a.min_grow_die[0][growDieThreshold] = slideVal[slideNum]; 717 | 718 | if(s[sfcnum].u.a.min_grow_die[0][growDieThreshold+1] < slideVal[slideNum]) { 719 | s[sfcnum].u.a.min_grow_die[0][growDieThreshold+1] = slideVal[slideNum]; 720 | } 721 | 722 | } else if(growDieThreshold%2 == 1){ 723 | s[sfcnum].u.a.min_grow_die[0][growDieThreshold] = slideVal[slideNum]; 724 | if(s[sfcnum].u.a.min_grow_die[0][growDieThreshold-1] > slideVal[slideNum]) { 725 | s[sfcnum].u.a.min_grow_die[0][growDieThreshold-1] = slideVal[slideNum]; 726 | } 727 | 728 | } 729 | 730 | 731 | 732 | } 733 | updateListing(); 734 | System.out.println(growDieThreshold%2 + " GDT:"+growDieThreshold + " " + "NBRT:"+slideVal[slideNum]); 735 | } 736 | 737 | 738 | public void dialogAddSeed(){ 739 | String str = JOptionPane.showInputDialog(m, "Seed, with chance one out of:", String.valueOf(seedRand)); 740 | String str2 = JOptionPane.showInputDialog(m, "Enter value to place:", String.valueOf(seedVal)); 741 | if(str != null && str2 != null) { 742 | int mySeedRand = Integer.parseInt(str); 743 | int mySeedVal = Integer.parseInt(str2); 744 | 745 | int tmp[][] = new int[u[0].instructions.length+1][5]; 746 | int i; 747 | for(i = 0; i< u[0].instructions.length; i++) { 748 | tmp[i] = u[0].instructions[i]; 749 | } 750 | 751 | tmp[i] = new int[]{-1, s[sfcnum].zdraw, mySeedRand, 0, mySeedVal}; //seed 752 | 753 | u[0].instructions = tmp; 754 | ruleLenChanged(); 755 | ruleChanged(tmp[u[0].instructions.length-1][0]); 756 | 757 | } 758 | } 759 | 760 | public void dialogAddRule(){ 761 | String str = JOptionPane.showInputDialog(m, "Add rule (0-"+(totalFunctions-1)+"):", "0"); 762 | if(str != null) { 763 | int sVal = Integer.parseInt(str); 764 | 765 | int tmp[][] = new int[u[0].instructions.length+1][5]; 766 | int i; 767 | for(i = 0; i< u[0].instructions.length; i++) { 768 | tmp[i] = u[0].instructions[i]; 769 | } 770 | tmp[i] = new int[]{sVal, s[sfcnum].zdraw, r.nextInt(64)+1, r.nextInt(64)+1, -1}; //seed 771 | 772 | u[0].instructions = tmp; 773 | ruleLenChanged(); 774 | ruleChanged(tmp[u[0].instructions.length-1][0]); 775 | 776 | } 777 | } 778 | 779 | public void recastParams(){ 780 | 781 | int tmp[][] = new int[u[0].instructions.length-1][5]; 782 | int inst = 0; 783 | 784 | if(u[0].instructions.length-1 == 0) { 785 | System.out.println("Fail"); 786 | inst = u[0].instructions[0][0]; 787 | } 788 | 789 | for(int i = 0; i< u[0].instructions.length-1; i++) { 790 | tmp[i] = u[0].instructions[i]; 791 | inst = u[0].instructions[i+1][0]; 792 | } 793 | 794 | 795 | String str3 = "20"; 796 | String str4 = "1"; 797 | 798 | String str1 = JOptionPane.showInputDialog(m, "(-1 is All Layers) Target Z-Layer:", params[0]); 799 | String str2 = JOptionPane.showInputDialog(m, "Random Chance:", params[1]); 800 | 801 | if(inst == 18) {str3 = JOptionPane.showInputDialog(m, "(18 Only) Threshold:", params[2]);} 802 | if(inst == -1) {str4 = JOptionPane.showInputDialog(m, "(-1 Only) Value Override", params[3]);} 803 | 804 | if(str1 != null && str2 != null) { 805 | u[0].instructions = tmp; 806 | 807 | 808 | params[0] = Integer.parseInt(str1); 809 | params[1] = Integer.parseInt(str2); 810 | params[2] = Integer.parseInt(str3); 811 | params[3] = Integer.parseInt(str4); 812 | 813 | int tmp2[][] = new int[u[0].instructions.length+1][5]; 814 | 815 | int i; 816 | for(i = 0; i< u[0].instructions.length; i++) { 817 | tmp2[i] = u[0].instructions[i]; 818 | } 819 | tmp2[i] = new int[]{inst, params[0], params[1], params[2], params[3]}; 820 | 821 | u[0].instructions = tmp2; 822 | } 823 | } 824 | 825 | public void addRandomRule(){ 826 | 827 | int tmp[][] = new int[u[0].instructions.length+1][5]; 828 | int i; 829 | 830 | for(i = 0; i< u[0].instructions.length; i++) { 831 | tmp[i] = u[0].instructions[i]; 832 | } 833 | 834 | tmp[i] = new int[]{r.nextInt(totalFunctions), s[sfcnum].zdraw, r.nextInt(64)+1, r.nextInt(64)+1, r.nextInt(64)+1}; 835 | 836 | u[0].instructions = tmp; 837 | ruleLenChanged(); 838 | ruleChanged(tmp[u[0].instructions.length-1][0]); 839 | 840 | } 841 | 842 | public void removeRule(){ 843 | int tmp[][] = new int[u[0].instructions.length-1][5]; 844 | for(int i = 0; i< u[0].instructions.length-1; i++) { 845 | tmp[i] = u[0].instructions[i]; 846 | } 847 | 848 | u[0].instructions = tmp; 849 | ruleLenChanged(); 850 | ruleChanged(tmp[u[0].instructions.length-1][0]); 851 | 852 | } 853 | 854 | 855 | 856 | public void resetRule(){ 857 | int tmp[][] = new int[1][5]; 858 | tmp[0] = new int[]{0, -1, 1, 1}; 859 | u[0].instructions = tmp; 860 | } 861 | 862 | public void resetRuleDef(){ 863 | int tmp[][] = new int[1][5]; 864 | tmp[0] = new int[]{0, 0, 1, 1}; 865 | u[0].instructions = tmp; 866 | } 867 | public void snapToCustomTool() { 868 | blockVal = gui_blockVal; 869 | toolRand = gui_toolRand; 870 | toolVar = gui_toolVar; 871 | blockSize = gui_blockSize; 872 | 873 | } 874 | 875 | public void dialogSetSlider() { 876 | String str = JOptionPane.showInputDialog(m, "Slider Number (0-5:", 0); 877 | if(str != null) { 878 | 879 | } 880 | 881 | str = JOptionPane.showInputDialog(m, "Slider Value", gui_blockVal); 882 | if(str != null) { 883 | //sl[0].setState(Integer.parseInt(str)); 884 | } 885 | } 886 | 887 | public void dialogSetBlockVal() { 888 | String str = JOptionPane.showInputDialog(m, "Tool Value:", gui_blockVal); 889 | if(str != null) { 890 | blockVal = Integer.parseInt(str); 891 | gui_blockVal = blockVal; 892 | } 893 | } 894 | 895 | public void dialogSetBlockRand() { 896 | String str = JOptionPane.showInputDialog(m, "Tool Placement - Random Distribution:", gui_toolRand); 897 | if(str != null) { 898 | toolRand = Integer.parseInt(str); 899 | gui_toolRand = toolRand; 900 | } 901 | } 902 | 903 | public void dialogSetBlockVar() { 904 | String str = JOptionPane.showInputDialog(m, "Tool Value - Random Variation:", gui_toolVar); 905 | if(str != null) { 906 | toolVar = Integer.parseInt(str); 907 | gui_toolVar = toolVar; 908 | } 909 | } 910 | 911 | public void dialogSetBlockSize() { 912 | String str = JOptionPane.showInputDialog(m, "Tool Size:", gui_blockSize); 913 | if(str != null) { 914 | blockSize = Integer.parseInt(str); 915 | gui_blockSize = blockSize; 916 | } 917 | } 918 | 919 | public void placeBlock(int mx, int my, int mz){ 920 | if(mx-(blockSize/2) >= 0 && my-(blockSize/2) > 0 && mx+(blockSize/2) < s[sfcnum].getWidth() && my+(blockSize/2) < s[sfcnum].getHeight()+1) { 921 | for(int i = 0; i < blockSize; i++){ 922 | s[sfcnum].u.a.plcLn( 923 | mx-blockSize, 924 | (my+i)-blockSize, 925 | s[sfcnum].zdraw, 926 | 927 | toolRand, 0, blockVal, 1, 0, mx+blockSize, blockSize, toolVar 928 | ); 929 | } 930 | } 931 | } 932 | 933 | public void placeData(int mx, int my, int mz){ 934 | if(mx-(blockSize/2) >= 0 && my-(blockSize/2) > 0 && mx+(blockSize/2) < s[sfcnum].getWidth() && my+(blockSize/2) < s[sfcnum].getHeight()+1) { 935 | for(int i = 0; i < blockSize; i++){ 936 | s[sfcnum].u.a.plcDataLn( 937 | mx-blockSize, 938 | (my+i)-blockSize, 939 | s[sfcnum].zdraw, 940 | 941 | toolRand, 0, 0, 1, 0, mx+blockSize, blockSize, toolVar, d, 1 942 | ); 943 | } 944 | d.reset(); 945 | } 946 | } 947 | 948 | public void placeZero(int mx, int my, int mz){ 949 | if(mx-(blockSize/2) >= 0 && my-(blockSize/2) > 0 && mx+(blockSize/2) < s[sfcnum].getWidth() && my+(blockSize/2) < s[sfcnum].getHeight()+1) { 950 | for(int i = 0; i < blockSize; i++){ 951 | s[sfcnum].u.a.plcLn( 952 | mx-blockSize, 953 | (my+i)-blockSize, 954 | s[sfcnum].zdraw, 955 | 956 | toolRand, 0, 0, 1, 0, mx+blockSize, blockSize, toolVar 957 | ); 958 | } 959 | } 960 | } 961 | 962 | public void placeStripe(int mx, int my, int mz, int iMult){ 963 | if(mx-(blockSize/2) >= 0 && my-(blockSize/2) > 0 && mx+(blockSize/2) < s[sfcnum].getWidth() && my+(blockSize/2) < s[sfcnum].getHeight()+1) { 964 | for(int i = 0; i < blockSize; i+= iMult){ 965 | s[sfcnum].u.a.plcLn( 966 | mx-blockSize, 967 | (my+i)-blockSize, 968 | s[sfcnum].zdraw, 969 | 970 | toolRand, 0, blockVal+r.nextInt(toolVar), 1, 0, mx+blockSize, blockSize, toolVar 971 | ); 972 | } 973 | } 974 | } 975 | 976 | public void captureData(int mx, int my, int mz){ 977 | int[][][] resultAr; 978 | resultAr = new int[blockSize][blockSize][1]; 979 | 980 | String ss = ""; 981 | //use block placement decendent as capture device for u.universe 982 | 983 | if(mx-(blockSize/2) >= 0 && my-(blockSize/2) > 0 && mx+(blockSize/2) < s[sfcnum].getWidth() && my+(blockSize/2) < s[sfcnum].getHeight()+1) { 984 | for(int i = 0; i < blockSize; i++){ 985 | int[] intar = new int[blockSize]; 986 | intar = s[sfcnum].u.a.getDataLn( 987 | mx-blockSize, 988 | (my+i)-blockSize, 989 | s[sfcnum].zdraw, 990 | 991 | toolRand, 0, 0, 1, 0, mx+blockSize, blockSize, toolVar 992 | ); 993 | 994 | 995 | 996 | for (int j = 0; j < intar.length; j++){ 997 | resultAr[j][i][0] = intar[j]; 998 | ss+=intar[j] + ","; 999 | } 1000 | ss+="\n"; 1001 | } 1002 | System.out.println(ss); 1003 | 1004 | 1005 | } 1006 | 1007 | 1008 | 1009 | 1010 | 1011 | 1012 | ss=""; 1013 | for (int i = 0; i < resultAr.length; i++){ 1014 | for (int j = 0; j < resultAr[0].length; j++){ 1015 | ss+=resultAr[i][j][0] + ","; 1016 | } 1017 | ss+="\n"; 1018 | } 1019 | System.out.println(ss); 1020 | 1021 | 1022 | d.setArray(resultAr); 1023 | } 1024 | 1025 | 1026 | public void cycleUni(){ 1027 | sfcnum++; 1028 | sfcnum = sfcnum % sfcmax; 1029 | } 1030 | 1031 | //implicit function storage 1032 | //////////////////////////////////////////// 1033 | public void mouseReleased(MouseEvent e) { } 1034 | public void mouseEntered(MouseEvent e) { } 1035 | public void mouseExited(MouseEvent e) { } 1036 | public void mouseClicked(MouseEvent e) { } 1037 | //////////////////////////////////////////// 1038 | 1039 | 1040 | 1041 | } --------------------------------------------------------------------------------