To be honest, I did not get much new information from this reading. It talks about the phenomenon of the digitalization of everything in the second Machine Age and how the large and comprehensive database and the almost free nature of reproduction of digital data have completely changed the way we do science, invest in real estates, find our way to work and so much more.
On the other hand, the availability and size of data are so powerful that, if used inappropriately, could be very damaging. For example, many personal data have been used by companies like Cambridge Analytica to swing elections and place ads.
I created the game “Snake” using three classes: the board class, the snake class, and the food class. The movement of the snake is controlled by the w, s, a, and d keys.
The win/game over functions were integrated directly into the draw function.
The following is a quick video demonstration of the game in action:
This is my code:
ArrayList<Integer> positionsX = new ArrayList<Integer>();
ArrayList<Integer> positionsY = new ArrayList<Integer>();
int dimSquare = 40;
int dim = 800;
int positionX = 5;
int positionY = 5;
int foodX = 15;
int foodY = 15;
int [] dirX = {1,-1,0,0};
int [] dirY = {0,0,1,-1};
int direction = 0;
int speedOfGame = 10;
boolean gameover = false;
For this assignment, I have worked with class and objects.
I based the idea on the work I replicated for Assignment 6 and came up with the code with the help of Getting started with Processing and online resources.
Here is the code that I used:
CrazyShape circle1, circle2, square3;
void setup() {
size(500,500);
smooth();
circle1 = new CrazyShape(20, 1.5, color(random(255), 125, 0));
circle2 = new CrazyShape(10, 3, color(255, 0, random(155)));
square3 = new CrazyShape(30, 2.5, color(0, random(125), 255));
}
class CrazyShape {
float x;
float y;
int diameter;
float speed;
color c;
CrazyShape(int id, float ispeed, color ic) {
x = random(width);
y = random(height);
speed = ispeed;
diameter = id;
c = ic;
}
void move() {
x += random(-speed, speed);
y += random(-speed, speed);
if (x < 0+diameter) {
x = random(width);
c = color(random(255), random(255), random(255));
} else if (x > width-diameter) {
x = random(width);
c = color(random(255), random(255), random(255));
}
if (y < 0+diameter) {
y = random(height);
c = color(random(255), random(255), random(255));
} else if (y > height-diameter) {
y = random(height);
c = color(random(255), random(255), random(255));
}
}
void displayCircle() {
fill(c);
ellipse(x, y, diameter, diameter);
}
void displaySquare() {
fill(c);
rect(x, y, diameter, diameter);
}
}
I struggled a lot with just trying to figure out how to work the ‘class’ thin, even though I understood the overall concept. Eventually, after watching a few videos and getting help from classmates, I worked it out.
The first thing I noticed when reading this was the author is tying together a bit too many metaphors/similes and so it makes it a bit confusing. In one page he likens books to films; movies to computer culture; the mobile camera being essential to computer culture and the “3D-ness it brings” along with a whole other plethora of comparisons and expressions. And this was all just on the first page.
He then goes on to talk about various objects such as VR, (computer) games, more on 3D space and models, and perspective. I can see his intention in this, but the jargon made it difficult to process.
HCI: Representation versus Control Section:
He then talks about remediating. I particularly liked how he brought up the example of Xerox making basic standards of interfaces, and how these were repurposed. He then talks more about these interfaces, and how they differ from books… for some reason…
Overall, some aspects he mentioned that I want to keep in mind are how culture affects design. (Such as with computer icons)
When looking at the art work displayed in the presentation, I was conflicted on whether or not I liked it. I genuinely enjoyed the idea of how he made the artworks, as I am interested in generated, repeated patterns, but I didn’t actually love the end results too much. To quote Kristopher in class, some of the pieces did look a little too “crowded” or “busy”.
I enjoyed how there is a balance of semi-abstraction vs. complete abstraction, as in the pieces (including some of the other artists he talks about such as mondrian who did the colorful squares we all have seen at least once [mondrian works] )
Overall, I agree with my peers that the video tended to be a bit on the monotonous side, but overall, some interesting concepts of chaos and abstraction were explored.
Last week, I went to an Institute talk regarding recent discoveries in the universe that has been found using a new type of telescope that is able to act like a satellite.
One of the coolest ideas that I found in that talk was the idea that there are certain “moon” like structures that have a gravitational pull that allows “planets” and asteroids to orbit it. However, because of the different mass of the asteroids/planets, there exist different orbit distances and speeds that they travel at. On top of this, sometimes, there even exists orbits around the asteroids/planets that are orbiting the bigger moon – much like Earth’s moon.
I wanted to replicate this idea and so instead of a game, I wanted to create a moving art piece that basically shows what the speaker was talking about.
//class definition of Moon
class Moon{
PVector v1, v2; //attribute of moon
int diameter; //another attribute of moon
Moon(int d){ //this is the constructor
//does nothing over here
diameter =d; //this is a parameter of the constructor
}
void draw(){
fill(0);
rect(0, 0, width, height);
noFill();
strokeWeight (0.3);
stroke (255, 12);
for (int i = 0; i < 7000; i++)
{
float angle1 = random (TWO_PI);
float angle2 = random (TWO_PI);
v1 = new PVector (width/2 + cos (angle1) * diameter, height/2 + sin (angle1) * diameter);
v2 = new PVector (width/2 + cos (angle2) * diameter, height/2 + sin (angle2) * diameter);
line (v1.x, v1.y, v2.x, v2.y);
}
//noLoop();
}
} //end of class definition
class Orbits {
float a, x, y, diax, diay;
float d = 23;
int para;
float speed;
float speed4orbit;
float b;
Orbits(int p, float s4o, float s){
para = p;
speed4orbit = s4o;
speed = s;;
}
void draw (){
// earth
pushMatrix();
translate(width/2, height/2);
fill(255);
ellipse(x, y, d, d);
// moon
pushMatrix();
translate(x, y);
rotate(radians(a));
ellipse(0, d, d/3, d/3);
popMatrix();
// orbit line
stroke(255, 100);
smooth();
noFill();
ellipse(0, 0, diax*2, diay*2);
x = sin(radians(-a)*speed)*diax;
y = cos(radians(a)*speed)*diay;
a += 4;
diax = lerp(diax, para, speed4orbit);
diay = lerp (diay, para, speed4orbit);
popMatrix();
}
}
Here is a screenshot of one of the frames.
One thing I am not happy with, and I can’t seem to figure out, is how not smooth the movements are. I tried to change the frameRate but that didn’t work out.
One new thing that learned for this project was PVectors, which I found out how to use through examples.
In describing this project, space invaders was mentioned a bunch of times, and I decided that it sounded reasonably fun to work on.
I set up my game as if there would be multiple enemies who would shoot back, though in my current implementation enemies win by reaching the end, and are all simple circles, ship the ship is a triangle.
The main code is very simple, creating a game and having the win logic.
The game is also simple, just facilitating the interaction of the enemies, ship, and projectiles, and containing each. Also tracks the larger game logic like score and lives.
Since in theory projectiles can be made by enemies (though collision detection would need a re-write, mostly an if instance of or separate detection logic for each projectile type.), there is a parent and child version