GMU:Urban Development Kit/Urban Space for Mind: Difference between revisions

From Medien Wiki
mNo edit summary
mNo edit summary
Line 64: Line 64:
Below is a Program I have written that takes some of sciences dogmas today and by clicking your mouse you can mix up the original sentences by changing at random the Subject, descriptor and object, creating new dogmas, some that don't make compete grammatical sense. Yet.  
Below is a Program I have written that takes some of sciences dogmas today and by clicking your mouse you can mix up the original sentences by changing at random the Subject, descriptor and object, creating new dogmas, some that don't make compete grammatical sense. Yet.  


import processing.core.*;
<html><body><pre>
import processing.data.*;  
<span style="color: #666666;">//Declare</span>
import processing.event.*;
<span style="color: #E2661A;">String</span> sentence1;
import processing.opengl.*;
<span style="color: #666666;">//eleven</span>
 
<span style="color: #E2661A;">String</span>[] oBject = {
import java.util.HashMap;
&nbsp;&nbsp;<span style="color: #7D4793;">&quot; mechanical&quot;</span>, <span style="color: #7D4793;">&quot; a machine&quot;</span>,<span style="color: #7D4793;">&quot; fixed&quot;</span>, <span style="color: #7D4793;">&quot; unconscious&quot;</span>, <span style="color: #7D4793;">&quot; nature&quot;</span>, <span style="color: #7D4793;">&quot; purpose&quot;</span>, <span style="color: #7D4793;">&quot; genes&quot;</span>, <span style="color: #7D4793;">&quot; brain&quot;</span>, <span style="color: #7D4793;">&quot; mind&quot;</span>, <span style="color: #7D4793;">&quot; head&quot;</span>, <span style="color: #7D4793;">&quot; impossible&quot;</span>, <span style="color: #7D4793;">&quot; that really works&quot;</span>
import java.util.ArrayList;
import java.io.File;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
 
public class Seb_Arrays extends PApplet {
 
//Declare
String sentence1;
//eleven
String[] oBject = {
  " mechanical", " a machine"," fixed", " unconscious", " nature", " purpose", " genes", " brain", " mind", " head", " impossible", " that really works"
};
};
//twelve
<span style="color: #666666;">//twelve</span>
String[] descriptor = {
<span style="color: #E2661A;">String</span>[] descriptor = {
  "is", "is like", "is", "are ", "has no", "is in your", "are stored in your", "is in your", "is the activity of your", "are", "is the only type", "are in"
&nbsp;&nbsp;<span style="color: #7D4793;">&quot;is&quot;</span>, <span style="color: #7D4793;">&quot;is like&quot;</span>, <span style="color: #7D4793;">&quot;is&quot;</span>, <span style="color: #7D4793;">&quot;are &quot;</span>, <span style="color: #7D4793;">&quot;has no&quot;</span>, <span style="color: #7D4793;">&quot;is in your&quot;</span>, <span style="color: #7D4793;">&quot;are stored in your&quot;</span>, <span style="color: #7D4793;">&quot;is in your&quot;</span>, <span style="color: #7D4793;">&quot;is the activity of your&quot;</span>, <span style="color: #7D4793;">&quot;are&quot;</span>, <span style="color: #7D4793;">&quot;is the only type&quot;</span>, <span style="color: #7D4793;">&quot;are in&quot;</span>
};
};
//thirteen  
<span style="color: #666666;">//thirteen&nbsp;</span>
String[] subject = {
<span style="color: #E2661A;">String</span>[] subject = {
  "Nature ", "The universe ", "Matter ", "The laws of nature ", "The total amount of matter & energy ", "Evolution ", "Everything you inherit ", "Memories ", "Your brain ", "Your mind ", "Your consciousness ", "Psychic phenomena ", "Mechanistic medicine "
&nbsp;&nbsp;<span style="color: #7D4793;">&quot;Nature &quot;</span>, <span style="color: #7D4793;">&quot;The universe &quot;</span>, <span style="color: #7D4793;">&quot;Matter &quot;</span>, <span style="color: #7D4793;">&quot;The laws of nature &quot;</span>, <span style="color: #7D4793;">&quot;The total amount of matter &amp; energy &quot;</span>, <span style="color: #7D4793;">&quot;Evolution &quot;</span>, <span style="color: #7D4793;">&quot;Everything you inherit &quot;</span>, <span style="color: #7D4793;">&quot;Memories &quot;</span>, <span style="color: #7D4793;">&quot;Your brain &quot;</span>, <span style="color: #7D4793;">&quot;Your mind &quot;</span>, <span style="color: #7D4793;">&quot;Your consciousness &quot;</span>, <span style="color: #7D4793;">&quot;Psychic phenomena &quot;</span>, <span style="color: #7D4793;">&quot;Mechanistic medicine &quot;</span>
};
};


public void setup() {
<span style="color: #33997E;">void</span> <span style="color: #006699;"><b>setup</b></span>() {
  size(800, 250);
&nbsp;&nbsp;<span style="color: #006699;">size</span>(800, 250);
  background(0, 15, 108);
&nbsp;&nbsp;<span style="color: #006699;">background</span>(0, 15, 108);
  fill(0);
&nbsp;&nbsp;<span style="color: #006699;">fill</span>(0);
  smooth();
&nbsp;&nbsp;<span style="color: #006699;">smooth</span>();
}
}


public void draw() {
<span style="color: #33997E;">void</span> <span style="color: #006699;"><b>draw</b></span>() {
  frameRate(10);
&nbsp;&nbsp;<span style="color: #006699;">frameRate</span>(10);


  int i;
&nbsp;&nbsp;<span style="color: #E2661A;">int</span> i;


  if (mousePressed) {
&nbsp;&nbsp;<span style="color: #669900;">if</span> (<span style="color: #D94A7A;">mousePressed</span>) {
    background(0, 15, 108);
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #006699;">background</span>(0, 15, 108);
    for (i=0; i <= 2; i++) {
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #669900;">for</span> (i=0; i &lt;= 2; i++) {


      int random[] = {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #E2661A;">int</span> random[] = {
        PApplet.parseInt(random(subject.length)),  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #006699;">int</span>(<span style="color: #006699;">random</span>(subject.<span style="color: #33997E;">length</span>)),  
        PApplet.parseInt(random(descriptor.length)),  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #006699;">int</span>(<span style="color: #006699;">random</span>(descriptor.<span style="color: #33997E;">length</span>)),  
        PApplet.parseInt(random(oBject.length)),
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #006699;">int</span>(<span style="color: #006699;">random</span>(oBject.<span style="color: #33997E;">length</span>)),
      };
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;};
      fill(255);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #006699;">fill</span>(255);
      textAlign(CENTER);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #006699;">textAlign</span>(<span style="color: #718A62;">CENTER</span>);
      textSize(18);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #006699;">textSize</span>(18);
      int sentence1PosY = 40+80*i;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #E2661A;">int</span> sentence1PosY = 40+80*i;


      sentence1 = subject[random[0]] + descriptor[random[1]] + oBject[random[2]];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sentence1&nbsp;=&nbsp;subject[random[0]]&nbsp;+&nbsp;descriptor[random[1]]&nbsp;+&nbsp;oBject[random[2]];


      text(sentence1, width/2, sentence1PosY);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #006699;">text</span>(sentence1, <span style="color: #D94A7A;">width</span>/2, sentence1PosY);
    }
&nbsp;&nbsp;&nbsp;&nbsp;}
  }  
&nbsp;&nbsp;}&nbsp;
  else {
&nbsp;&nbsp;<span style="color: #669900;">else</span> {
    redraw();
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #006699;">redraw</span>();
  }
&nbsp;&nbsp;}
}
}


  static public void main(String[] passedArgs) {
 
    String[] appletArgs = new String[] { "Seb_Arrays" };
</pre></body></html>
    if (passedArgs != null) {
      PApplet.main(concat(appletArgs, passedArgs));
    } else {
      PApplet.main(appletArgs);
    }
  }
}


[[Category:Initial Beginnings]]
[[Category:Initial Beginnings]]