Screenshot 2026-10-07 at 9.58.25 AM.png

“Ratlantic Avenue”

A functions exercrise.

-Riya Lalchandani


Every time I take the subway, I see rats on the tracks. At some point I started thinking, what if there was a subway line specifically for them? A little transportation system that could take them home instead of having them run around on the tracks.

That became the idea behind Ratlantic Avenue.

It also ended up being a pretty good project for learning functions. I turned each subway line into its own function, so instead of redrawing every line from scratch, I could just call the function whenever I needed it. I did the same thing with the subway stations. Each station is basically just a small black ellipse, so I made that into a function too. Then, in draw(), I could call the station function at different coordinates depending on where I wanted each stop to sit.

The hardest part was probably the subway lines, especially the arcs. I am very bad at math, so figuring out the angles was mostly trial and error. I kept changing the numbers, running the sketch, seeing where the arc started and ended, and changing them again. It took me a while to understand how the angles actually worked, but once I got the arcs right, the rest of the lines became much easier to build.

For the rat, I made a separate JavaScript file in p5 and created a rat() function. I have to admit I took a little help from ChatGPT here. I am very much an Illustrator person, so I first drew the rat icon myself in Illustrator and used that as my starting point. I then asked ChatGPT to help translate the shape into code. I mostly wanted to avoid spending another several hours figuring out every vertex myself after already spending so much time on the subway arcs. Next time, I want to try building something like this completely on my own. I think doing the math repeatedly is probably the only way for it to start feeling natural.

Screenshot 2026-10-07 at 10.00.17 AM.png

// rat that i drew on illustrator:-

Screenshot 2026-10-07 at 10.00.09 AM.png

// my illustrator file:-

Screenshot 2026-10-07 at 9.59.25 AM.png

// chatgpt’s interpretation:-

I also used ChatGPT to figure out how to work with fonts in p5. That part was completely new to me. I had to upload the font file into the p5 Web Editor, load it into the sketch, and then tell p5 to use it when drawing the text. Once I understood the process, it was actually pretty straightforward. I mostly needed a quick explanation of how all the pieces connected before I could do it myself.

Screenshot 2026-10-07 at 9.58.40 AM.png

What I liked about this assignment was that the functions started to feel less like a coding rule and more like a way of organizing something I had already designed. I could think of a subway line as one thing, a station as one thing, and a rat as one thing, and then tell the code where I wanted each of those things to go. That made the whole sketch feel a little more manageable.