ArrayList<String> urls_one = new ArrayList<String>(); ArrayList<String> urls_two = new ArrayList<String>(); ArrayList<PImage> image_set_one = new ArrayList<PImage>(); ArrayList<PImage> image_set_two = new ArrayList<PImage>(); ArrayList<Integer> image_x = new ArrayList<Integer>(); ArrayList<Integer> image_y = new ArrayList<Integer>(); boolean[] draw_images = new boolean[]{true,true,true,true,true,true}; boolean[] config_one = new boolean[] {true,false,true,false}; boolean[] config_two = new boolean[] {true,true,false,false}; ArrayList<Integer> scores = new ArrayList<Integer>(); int state = 0; int timer = 0; int seven_seconds = 240; void setup(){ size(600,400); urls_one.add("https://i.imgur.com/xf7ypid.png"); urls_one.add("https://i.imgur.com/MCNRE2Q.png"); urls_one.add("https://i.imgur.com/Z4i2Syj.png"); urls_one.add("https://i.imgur.com/aPemay4.png"); urls_one.add("https://i.imgur.com/Uf2m10j.png"); urls_one.add("https://i.imgur.com/pB2LE6N.png"); urls_two.add("https://i.imgur.com/1TWfm2y.png"); urls_two.add("https://i.imgur.com/WyfC2Jo.png"); urls_two.add("https://i.imgur.com/C4sja4r.png"); urls_two.add("https://i.imgur.com/sSQ4Oa3.png"); urls_two.add("https://i.imgur.com/9tEtrnD.png"); urls_two.add("https://i.imgur.com/t83ty1H.png"); image_x.add(100); image_x.add(300); image_x.add(500); image_x.add(100); image_x.add(300); image_x.add(500); image_y.add(100); image_y.add(100); image_y.add(100); image_y.add(300); image_y.add(300); image_y.add(300); for(int i = 0; i < urls_one.size(); i++){ PImage tmp_1 = loadImage(urls_one.get(i)); PImage tmp_2 = loadImage(urls_two.get(i)); image_set_one.add(tmp_1); image_set_two.add(tmp_2); } } void draw_images(boolean flip, boolean first_set){ for(int i = 0; i < 6; i++){ pushMatrix(); imageMode(CENTER); translate(image_x.get(i),image_y.get(i)); if(flip){ rotate(PI); } if(draw_images[i]){ if(first_set){ image(image_set_one.get(i),0,0,200,200); }else{ image(image_set_two.get(i),0,0,200,200); } } popMatrix(); } } void handleState(){ draw_images(config_one[state-1],config_two[state-1]); timer++; if(timer > seven_seconds){ state = state+1; timer = 0; int score_t = 0; for(int i =0; i < 6; i++){ if(!draw_images[i]){ score_t++; } draw_images[i] = true; } scores.add(score_t); } } void draw(){ background(255,255,255); if(state == 0){ textAlign(CENTER); fill(0); textSize(30); text("Welcome",300,150); textSize(20); text("Instructions: Click the picture if you recognize it",300,200); textSize(20); text("Click anywhere to start",300,250); if(mousePressed){ state = 1; } }else if(state > 0 && state < 5){ handleState(); }else{ textSize(30); text("Finished",300,150); textSize(20); text("Score STAGE 1: " + scores.get(0),300,200); text("Score STAGE 2: " + scores.get(1),300,220); text("Score STAGE 3: " + scores.get(2),300,240); text("Score STAGE 4: " + scores.get(3),300,260); } } void mousePressed(){ if(state >= 1){ int index = mouseX/200; if(mouseY > 200){ index+=3; } draw_images[index] = false; } }With this code template you can now design your own experiment! You can change the image links in the code and even change affects like the duration and add color-filters on images. Some things that interest us would be looking at the inversion effect on animated faces from cartoons and movies. What about animated objects? Is it harder to recognize objects and people in black and white? Comment below and let us know your thoughts and what you would want to test!
A Simple Cognitive Study with Code
In the world of cognitive science, one thing is certain: we know very little about how our brains work. But through conducting studies and observing various phenomena, we now have a much better understanding of the intricate inner-workings of our minds.
So, today, in the spirit of cognitive exploration, we are going to try and conduct our very own study. To do this, we will use the gold-standard of scientific inquiry, the “Scientific Method.” The Scientific Method is exactly what it sounds like, a methodical and systematic approach to scientific inquiries. One must ask a question, do some background research, and then construct a hypothesis (an answer to our question). Then one must test our hypothesis and make sure our procedure (the steps we take) removes all outside variables that would affect our data. Finally, we analyze data and draw conclusions, and see how our results match-up with our predictions.
For those of you who like visuals, here is a visual representation of scientific method:
So now how are we going to apply those steps? But first, some background. Is there a relationship between how our brains work and how computers work? Some theorists argue that there is. More specifically, the computational theory of mind views our minds as an information processing system. The same way a computer uses basic logic gates to solve complex problems, our brain uses complex neural networks to solve problems.
Take the following example. Have you ever noticed how good you are at finding your parents in a crowd of people? If we were to apply our ability to recognize faces to computational theory, any face our eyes see can be understood as the ‘input’. Our brain takes this input, sorts through our database of previously memorized face templates, and processes until out input is matched to the correct template. Could this be how our brain works?
Maybe – but our ability to distinguish one face from another seems to be much more complex than this, as we not only have to remember what the face looks like from the front, but also from all different angles as well. This caused a lot of scientists to ask whether or not faces are special. Robert Yin, was one of the scientists that first explored this problem in the 60s. He noticed that we are much slower at recognizing faces once they’ve been turned upside down, but that we could recognize inverted objects such as household appliances, just as well. This effect, was coined as the face inversion effect.
Ok so back to the scientific method. We are going to recreate the face inversion effect, but this time our question is a little different: Does the face-inversion effect apply to animals? To test this we will first show users six faces face-down and see how many they recognize. Then we will show the same six-faces face-up and record how many are recognized. We will repeat this process with animal pictures. Each time, the users will have 7 seconds to recognize the pictures. We hypothesize that in both the animal and human cases it is harder to recognize upside down photos, but this effect will be more pronounced with the humans.
To run our tests we use the power of computer science! More specifically, we can code these tests and have them print the results at the end. We created versions in Scratch, JavaBlocks, and Processing. Here are some screenshots of the code, and also a Processing script. If you’d like to see the Scratch version click here!