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: A1_Q1_Source.zip. 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:
where is the superforce, is the mass and 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: A1_Q3_Source.zip. 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.