
When we first discussed this project, we knew that it would be about choice. I immediately thought of the trolley problem, because it is one of the most classic examples of being forced to choose between two outcomes.
We wanted to make the idea feel less serious and more playful, so my teammate suggested using rabbits. That made me think about feeding rabbits with carrots. Our first idea was to create a small maze where the player controls a carrot cart and eventually has to choose between feeding one rabbit or feeding four rabbits.


We also wanted the choice to have a consequence. The rabbits that were not fed would either die or receive some kind of punishment. This kept the basic idea of the trolley problem, but turned it into a cute and slightly dark interactive game.
When we started working on the code, I had some difficulty understanding my teammate’s version at first. In particular, she created separate rabbit() and carrot() functions and then called those functions later in the sketch. I understood the shapes themselves, but I was confused about how the parameters like x, y, s, and col were being passed into the function.
function rabbit(x, y, s, col) {
push();
translate(x, y);
scale(0.4);
noStroke();
fill(col);
push();
translate(-28, -120);
rotate(-0.12);
ellipse(0, 0, 48, 150);
pop();
push();
translate(28, -120);
rotate(0.12);
ellipse(0, 0, 48, 150);
pop();
ellipse(0, 0, 175, 240);
fill(0);
ellipse(-35, -20, 16, 16);
ellipse(35, -20, 16, 16);
fill(255);
ellipse(0, 40, 115, 55);
fill(0);
ellipse(0, 22, 30, 18);
pop();
}
and
function carrot(x, y, opacity) {
noStroke();
fill(255, 165, 0, opacity);
ellipse(x, y, 28, 30);
triangle(x - 14, y, x + 14, y, x, y - 60);
}
To make the code easier for me to understand, I decided to simplify it. Instead of defining a separate function for the rabbits, I drew each rabbit directly with ellipse() and used simple coordinates. This made the code longer, but it helped me understand exactly what each number was controlling.
The main interaction is controlled by two Boolean variables:
letoneScary=false;letfourScary=false;
They tell the program whether the single rabbit or the group of four rabbits should look scary.
I created an area around the single rabbit:
if (mouseX>50 && mouseX<150 && mouseY>380 && mouseY<520) {
fourScary=true;
}
When the mouse enters this area, it means the player is feeding the single rabbit. Then fourScary becomes true, so the four rabbits on the other side change.
For the four rabbits, I used another area:
elseif (mouseX>250 && mouseX<580 && mouseY>380 && mouseY<520) {
oneScary=true;
}
If the player moves the cart to the group of four rabbits, the single rabbit becomes scary instead.