Perse Studio

Independent-learning super-curriculum projects: reading, research and ideas shared by Perse students

Advent Of Code Programming Problems

Daniel C, Y9

After solving day 13 and day 17, of this year’s Advent Of Code programming problems (https://adventofcode.com/), I thought it would be nice to create a visualization of my two solutions. For Day 13 this shows minecarts moving around and crashing. I obviously had to slow the calculation thread down though (added 20ms delay per move), otherwise it would have been way too fast to see.

To achieve these visualisations, I used javax.swing.JFrame classes with Java programming. Each step of the calculation I just called Thread.sleep(20); and painted the 2D array of tracks to the screen. I downloaded a free recording software and cropped the screen to fit the JFrame, then recorded and exported as an mp4 video.

For Day 17 with the flowing water water, I used white for sand, black for clay, solid blue for settled water and dotted/flowing blue for flowing water.

>>WATCH DAY 13 VIDEO<<

>>WATCH DAY 17 VIDEO<<

 

 

 

 

 

 

 

 

 

 

 

​I hope you enjoy them both!

Comments are closed.