Programming using Processing

Feb 2nd, 2014
Price: $50 USD

Question description

I have assignment with three questions. Please let me know if you can help me solve them:

Question 1 - Randomness and array manipulations

You are a promising junior programmer in a video game business. You are part of a team working on an online gaming system for a first-person shooter game. In the game, players can register to an arena to play together. Sometimes, they play solo; sometimes, they play in teams.

You have been asked to implement a set of functionalities in Processing (!) to be able to shuffle and make subgroups of players to play in teams.

Each player is identified by its username (a String object).

Start from this code: The sketch declares empty methods that you need to implement (called "stubs"). It also contains a list of usernames on which it performs a series of tests. You can see the correct expected result of these tests here. If your functions are implemented correctly, you should get similar results. Note that the results of the last test may slightly vary since it involves randomness.

Question 2 - Superuniverse (or: Don't be afraid of formulas)

Your doppleganger from a parallel universe (let's call it the Superniverse) has to write their first assignment as part of their Creative Computation 2 class. In that universe, the basic laws of physics are slightly changed and your doppleganger needs to implement a working simulation (in 2D).

In the Superniverse, objects interact not based on forces, but based on superforces (don't look on Wikipedia for superforces: this is all fictional as you probably have already guessed). The basic formula for a superforce is the following:

\vec{S} = \sqrt{m} \cdot \vec{j}

where\vec{S} is the superforce, m is the mass and \vec{j} is the jerk.

The jerk is the instant variation of acceleration: in other words, the jerk is to acceleration what acceleration is to velocity (and what velocity is to position).

Objects in our universe move with forces, which are proportional to acceleration. When a force is applied, the object accelerates; acceleration changes velocity; velocity changes the object's position: so the object moves.

Objects in the Superuniverse move with superforces, which are proportional to jerk. When a superforce is applied, it affects the jerk; jerk is applied to acceleration, which in turn is applied to velocity, which changes the object's position: this is how the object moves in the Superuniverse. Notice that like forces are cumulative in our universe, so are superforces: each superforce modifies the jerk in a cumulative way.

Question 3 - Particle systems, inheritance and polymorphism

Back to our own (maybe not super but still quite amazing) universe.

Start from this code: Make sure you understand the code and add comments wherever they are missing.

3a - Different kinds of particles

Implement three different subclasses of class Particle. For each subclass, override the display() method to make the 3 kinds of particles look and behave differently. For at least one subclass, also override the update() method.

To test your subclasses, change the method createParticle() in ParticleSystem so that the system creates each time a different kind of particle from one of your 3 subclasses (could either be random or sequential).

3b - Wind particle system

Implement a subclass of ParticleSystem. Override the applyForces() method.

The applyForces() method is where you can have a particle system that applies one or many forces to its particles.

Your subclass should apply a wind force to its particles in the applyForces() method. A wind force is represented as a simple PVector that gets applied to all the particles of the system. At each call of applyForces(), the wind should also change its heading (ie. its angle) according to some random pattern. You have to change the heading using trigonometry. Make the wind as believable as possible. Use the randomGaussian() and/or the noise() (Perlin noise) function at least once in your code for controlling the wind.

Tutor Answer

(Top Tutor) Daniel C.
School: UC Berkeley

Studypool has helped 1,244,100 students

Review from our student for this Answer

Feb 7th, 2014
"Thanks for the help. "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1825 tutors are online

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors