Category: Programming
Now that I've done posting about why I'm retiring we can get back to our usual blogging.
I haven't really done anything technical over the past couple of year. The most programming I did in the past 18 months was a halfhearted effort at the Advent of Code 2021 event last December. I thought I'd see about picking up a new language to change that. In doing so, I was reminded of some of my resistances to learning a new language and how I've seen similar from self taught students coming into my classes.
# COMMENTSThe semesters back up in full swing again - teaching 2 undergrad classes in person - CS0 in Python and CS1 in C++ along with my teacher certification class - Ethics via Zoom. Grand total of about 125 students. An error came up in the CS0 class the other day that reminded me how tough it is not only to prepare students to deal with all the things that can go wrong when learning to program but even for a teacher to realize what's going on.
# COMMENTSNo post so far on day 12. I finished part 1 but my code was pretty messy which turned part 2 into a mess. I still have to go back to get that second star so just like day 10, my day 12 write up is on hold.
That said, I really enjoyed [[https://adventofcode.com/2021/day/13 ][today's]] challenge. Paper foldind. You're given transparent paper with a bunch of marks on it. You have to fold the paper over horizontal or vertical lines and examine the results.
# COMMENTSI wasn't particularly motivated to start day 11 but took a look over coffee. A grid of points where on each turn or step the points are modified by some rule. Hey, this sounds familiar - cellular automata like Conway's Game of Life.
You set up your grid and then on each turn just follow the rules. In a traditional Cellular Automaton like Conway's Game of Life, on each turn each cell looks at its six neighbors and makes a decision as to its next state based on the neighbors and a rule.
# COMMENTSI know, where's day 9? Thursdays (and Mondays) are already tight for me - I teach all morning and it's been a rough week. I just had very little energy and focus all day yesterday. I snuck some time in to finish part 1 but couldn't focus on part 2.
Today, however, my body gave me an extra half hour of sleep (til 4:30am) so I had extra time and energy.
# COMMENTSDay 8 took a lot longer than the other days. Not all that much code and not too complex, at least after getting through a scary sounding lead up but going from problem statement to solution took both time and thought.
As I started to read the problem, I wasn't sure I'd finish it let alone have time to write it up.
Take a minute to read over the problem.
# COMMENTSToday's problem was similar to yesterday's in that it's ease or difficulty really depended on how you looked at the question.
For yesterday, the problem was hard if you approached it by modeling each and every lanternfish but it was much easier if you modeled the 8 days of the reproduction cycle. Sure, there was still work to be done but looking at the problem the right way made things much easier.
# COMMENTSToday we had to model the growth of the lanternfish population (problem here).
Lanternfish spawn new lanternfish every seven days. The trick is that the original starting population consists of fish at different points in the cycle. For instance, if your input data was 3,2,4 then each fish would spawn a new fish in three, two, and four days respectively. The new fish would set their timers to 8 and start counting down to their spawn date on the next day and the original fish would reset it's timer to 6.
# COMMENTSYesterday I wrote about the virtues of a simple straightforward solution as opposed to a super "clever" one. Today reminded me that what seems simple to one person might be clever to another.
Having successfully survived bingo with a giant squid, Today's challenge had us navigating our sub so as to avoid dangerous parts of the ocean. We were given a bunch of lines represented by endpoints as input. If we graphed all the lines, some of them would overlap.
# COMMENTSI always tell my students that the cleverest program is worthless if it doesn't actually work.
There are always some kids in class that all too often try to write the fanciest solutions.
They're the ones that write
int l(char *s){return !*s?0:(l(++s)+1);} instead of something like:
int string_length(char *s){ int i = 0; while (s[i] != 0){ i=i+1; } return i; } to calculate the length of a string.
# COMMENTS