[wdwod week 4] tsa claims, an attempt

I didn’t finish the assignment this week, sadly. I was trying to work with this TSA Claims Data, and spent awhile manipulating the data so that it would sum the total claims per airline. I got it to look like this (which involved figuring out how to change NaN to 0):

Screenshot 2016-04-21 10.07.48

But I couldn’t figure out how to then extract each element in the code. I’m sure this is a simple problem but I didn’t have time to fix it and make a visualization this week. ūüė¶

 

https://gist.github.com/nicolehe/348fba5b1230e7f875ce21397d13f369.js

[rwet week 4] Pythong Song

Screenshot 2016-02-26 13.47.21

My¬†idea for this assignment was very stupid. It came from the fact that when typing “python” in the command line, I regularly accidentally type it as “pythong” instead.

So I decided to make a mashup of Sisqo’s 1999 classic, Thong Song, and some documentation from python.org.

I knew I wanted it to maintain the structure of the Thong Song, but with the flavor of Python documentation sprinkled throughout.

What I ended up doing was making two source files, thong-song.txt (which had the lyrics) and python.txt (which included a chunk of documentation text). I then replaced one random word in each song line with a random word from the Python text.

I quickly ran into the problem of the program picking words from python.txt that were not very useful to me, like “the” or “it” or “a.” So to solve this problem, I made another file with a list of “boring words,” and I told it to only select a word from python.txt if it was not also in boring.txt:

use_these = [i for i in line.split() if not i.lower() in boring_words]
for individual_word in use_these:
good_words.append(individual_word)

And of course, I also changed every instance of the word “thong” or “Python” to the word “Pythong.”

When I run the program, it’s different each time with varying degrees of success. I think it works best when the song still generally rhymes (so in most cases, if the last word on each line is not changed).¬†I also experimented with trying to get it to only replace each word with a word that began with the same letter, but I couldn’t quite get it to work in time, and I’m not sure it would actually make much of an improvement. Anyway, a couple ideas for building this program further.

Code and text files below, including a full sample of the results:

https://gist.github.com/nicolehe/258249f20a7bef4ef08b.js

 

[arcade week 4] midterm idea: a game about petting cats

pink cat sitting

For my midterm, I want to make a game about petting cats. Specifically, I want to make a game about how hard it is to pet a cat. In real life, it’s already a bit of a game¬†– you never know exactly where the cat wants you to pet it, or for how long. One wrong move and you get scratched. Hopefully, this little game I make will capture a bit of that feeling.

pink cat tail

I’m very much not good at drawing, or visual art in general, but I had a good time using Piskel to make these sprites. (For this post I’ve exported them as gifs.)

pink cat lying down

For my controller, I’ll be making something that has a joystick¬†¬†to allow you to move the petting hand around the screen, and then a piece of furry fabric that you actually have to pet in order to trigger the action. The fur will be on top of a fabric button made with Velostat that connects to the Arduino.

hand

 

[live web week 4] face chat

Screenshot 2016-02-24 00.04.24

(The url for this project is here. If I’ve turned off the server, it won’t be currently running.)

Building off of the chatroom I made the other week, I added a feature that takes a picture from your webcam once you submit your message, and posts them together. It was tricky to get it up and running, and I had a lot of problems managing divs, but it looks like it generally works.

 

Screenshot 2016-02-24 00.46.49

Sometimes the images don’t post, and I’m not entirely sure why. Also the formatting of the whole thing leaves a lot to be desired. But I’m glad I managed to get it to generally do what I wanted it to. I’m interested in bringing this one a little further…hopefully I can continue working on this.

https://gist.github.com/nicolehe/903d1e619206ed6a9858.js

[nothing week 4] midterm ideas

Phone-Phantogram-45

We (Jamie, Paula, Adi and I) brainstormed some ideas for an illusion to make for our midterm. Hopefully we’ll narrow it down after this week:

Phone hologram: https://www.facebook.com/hefty.co/videos/1748577158703988/

Using cut-up plastic and a video we create, we can use a phone screen to make a hologram.

Hybrid Image: https://en.wikipedia.org/wiki/Hybrid_image

We can design a large poster with a hybrid image of two faces (or something else!) that looks different when you’re close to it vs. when you’re far away.

Phantogram: http://www.gravitram.com/phantograms.htm

We can use Photoshop to design a phantogram, and print it out. With red-cyan glasses on, viewers will see it as a 3d object.

Phantom Words: http://deutsch.ucsd.edu/psychology/pages.php?i=211

Not sure if this project is exclusively for visual illusions, but we could use two speakers to make a Phantom Words auditory illusion.

Infinite Space: https://www.youtube.com/watch?v=mNQiW00mxH4

Using one way mirrors, lights and movement to create a structure that manipulates space.

Ideas for locations within 721 Broadway include the basement, with its long hallways and brick walls, the room we actually have our class in, or possibly a closet. What kind of illusion we end up making will determine the best location for it. More soon!

[icm week 4] Allergic to Love, v2.3

Screenshot 2015-10-01 00.33.44

[TLDR: Here’s the second iteration of my game, Allergic to Love.]

Our assignment this week was to clean up the code of a previous assignment, which was quite welcome because my code from last week was a total mess. I’m not completely sure that it’s now sparkling clean, but it’s definitely much better than it was before.

Before I made any changes to the game, I went in and reorganized the code. Having not yet learned arrays or objects in class, I was wandering about in the array wilderness a little bit last week and ended up doing something really weird with them. I think I fixed them up now after looking up how to do an array of objects. I found the jitterbug example  to be particularly helpful. Now my falling hearts are arranged like this:

function Falling() {
  this.x = random(width);
  this.y = random(-650, 0);
  this.broken = 0;
  this.hitByLaser = false;
  this.hitTheGround = false;
  this.speed = random(1, 4);
  this.clr = color(255, random(0, 255), random(0, 255));

  this.move = function() {
    this.y += this.speed;
  };

  this.display = function() {
    strokeWeight(7);
    stroke(this.clr);
    fill(this.clr);
    bezier(this.x, this.y, this.x - 12, this.y - 12, this.x - 11, this.y + 8, this.x, this.y + 14); //left 
    bezier(this.x, this.y, this.x + 12, this.y - 12, this.x + 13, this.y + 8, this.x, this.y + 14); //right 
  };

 

I went in and created a lot of my own functions as well.

Finally, I started adding on to the game itself.

Screenshot 2015-09-30 23.21.22

Adding sounds made a big difference. I found music from the Free Music Archive and sounds from Free Sound. I’m not really sure where the proper place to attribute would be…I put it in comments in my code for the time being.

Screenshot 2015-09-30 23.23.11

Besides sounds, I made a few other changes ‚ÄĒ the girl now bounces up and down, the landscape is a bit different, and she smiles if you win the game. (But it’s still pretty hard to do so!)

Play the game here.

My full code is below.

Continue reading “[icm week 4] Allergic to Love, v2.3”

[pcomp week 4] The Lonely But Tender Ghost v.2, now with sound! (analog outputs)

IMG_0272

It was fun playing¬†with speakers and servo motors this week. After doing the labs, I focused mostly on doing things with sound, but in the future I’d like to spend more time experimenting with servos…

In the tone lab, I had some fun with the pitch library, and found it pretty easy to change the song played to something else:

I wanted to continue building on my lonely ghost project from last week. When I last left it, I had hand-sewn an FSR¬†that caused an RGB LED to change colors depending on how hard you squeezed it. It was supposed to express “feeling” with the colors ‚ÄĒ green was good, red was bad. At that point, using colors were the only output.

I added a speaker to my breadboard and worked on adding sound in addition to color as feedback for the toy’s feelings.

IMG_0270

The first thing I did was add the tone() function to the code so that when the variable “force” was 3 ‚ÄĒ that is, pushed the hardest, the speaker would make a noise in addition to having the LED turn red.

I thought the ghost could be made to be a bit needier. What if it¬†got lonely if you didn’t pay attention to it for a period of time?

I used the millis() function to count the number of milliseconds that have passed whenever the ghost was squeezed. I then set a variable called lonelyTime, which was the amount of time it that could pass before the ghost got lonely. When the last time squeezed subtracted from the current millisecond count exceeded lonelyTime, I had the speakers make a tone. It would stop when you squeezed it again.

(I used the same method to make the LED blink when you weren’t squeezing the FSR, which I thought was a more natural¬†neutral state than having the light just be white.)

This was nice, but all of the tones sounded pretty boring and static. That’s when I realized I could use the pitches library, like in the tone lab, to compose custom sounds for each state. I ended up making three:

in pain
in pain
happy
happy
Screenshot 2015-09-29 13.17.28
lonely

I was a bit surprised by how much more effective the custom sounds were at expressing feeling compared to the basic speaker tones.

Now, the ghost feels much more like a pet or a needy toy. When he’s lonely, the light will turn yellow and he’ll make the lonely sound until you squeeze him. If you squeeze him gently, the light turns green and he makes the happy sound. If you squeeze him too hard, he’ll make a distressing sound and the light will turn red. The blink effect makes it feel more alive as well.

Check out the video (with sound) here:

My Arduino code is below.

Continue reading “[pcomp week 4] The Lonely But Tender Ghost v.2, now with sound! (analog outputs)”