Categories
Current Events Programming

Global Nerdy’s mega-list of online tech events for Tampa and beyond (Tuesday, February 16, 2021)

This is an experiment!

Creative Commons image from Alpha Stock Images and taken by Nick Youngson. Tap to view the source.

Each week, I publish a listing of tech, entrepreneur, and nerd online events by and for people in Tampa Bay and surrounding areas. But what if I tried expanding the scope and listing online events beyond Tampa Bay?

That’s the subject of this week’s experiment. Each weekday this week, I’m going to provide a list of:

  • the day’s tech, entrepreneur, and nerd online events for Tampa Bay and surrounding areas, and
  • a selection of the day’s tech events for the rest of the world.

Let’s face it — with COVID-19 still raging away, new variants of the disease popping up, and vaccines being slow in coming, we need to step up our online connection game. The way to do that is to look at tech events from beyond our backyard, see what other people are talking about, learn from them, and take those lessons back here to “The Other Bay Area!”

I’ve listed the events below. Check them out, and let me know if this sort of list is interesting or useful to you.

Tuesday’s ONLINE tech, entrepreneur, and nerd events in the Tampa Bay area

Here’s the list of Tuesday’s online events for the Tampa Bay area, taken straight from my larger list of this week’s Tampa Bay tech, entrepreneur, and nerd events.

Tuesday’s ONLINE tech events worldwide

…and here’s a selection of online tech events taking place across the country and around the world. I have no idea if any are limiting attendance to locals, but I suggest you drop in and find out!

Categories
Current Events Programming Tampa Bay

“Programmers of Portables” Meetup on Monday, Feb. 22: Let’s write a game!

It’s high time for the Programmers of Portables Meetup group’s first meeting. It’s called “Let’s write a game (with Python and Pygame)!”, and it’s happening online on Monday, February 22nd at 7:00 p.m.!

In this meetup, we’ll use the Python programming language and the Pygame collection of game development libraries to write a game similar to this “Super Bowl Streaker”-themed parody of the old videogame Tecmo Bowl:

That’s right, we’re going to build a game where the player controls the guy who ran onto the field in a pink leotard during the Super Bowl, and the goal of the game is to dodge security for as long as you can.

While writing the game, you’ll learn about key game programming concepts including the main event loop and collision detection, as well as everyday programming topics including object-oriented programming and data structures.

This is going to be a “code along with the instructor” exercise. I’ll explain a key concept for the game, and then we’ll code it together. By the end of the session, you’ll have a working game that you can play but even modify and improve on!

Register here to join us on Monday, February 22nd at 7:00 p.m., and let’s write a game!

What will you need for the Programmers of Portables Meetup?

Compaq 610 laptop
Even this decade-plus-old hardware (which I own) will do.

Aside from a computer (which could run macOS, Windows, Linux, or Raspberry Pi OS) made sometime in the past ten or so years and an internet connection, you’ll need:

  • Zoom (I’ll provide a link to the Meetup as the day gets closer)
  • Python 3 (version 3.6 or later — I recommend Anaconda’s distribution, although the Python.org distribution is also good)
  • Pygame (version 2.0; once you’ve installed Python 3, go to the command line and execute the command pip install pygame==2.0.0)
  • You favorite code editor. I’ll be using Visual Studio Code.

All you need for this session is just some programming experience, and it doesn’t have to be in Python. If you can code a “Magic 8-Ball” in JavaScript, you’ll understand most of what we’ll cover when writing our game.

Categories
Programming Tampa Bay What I’m Up To

Tampa iOS Meetup is changing its name to “Programmers of Portables” (or PoP for short)!

It’s been way too long since I’ve held a Tampa iOS Meetup. Between the pandemic and all sorts of employment issues arising thanks to the pandemic, I managed to hold just one Tampa iOS Meetup in 2020. It’s a shame, especially since Tampa iOS Meetup made the list of Tampa’s top ten tech meetup groups for 2019.

At the same time, while I’ve wanted to keep covering iOS, I also wanted to expand into other portable platforms, namely programming Android, smart watches, Raspberry Pi, and Arduino devices.

I’m going to scratch these two itches by re-tooling Tampa iOS Meetup into a new meetup called Programmers of Portables, or PoP for short. If you want to know what kind of platforms and programming this meetup will cover, just read its motto: “If it fits in your hand, it’s on-brand!”

Some of the topics I’m planning for this year:

  • iOS and watchOS programming with Swift
  • Android programming with Kotlin
  • Cross-platform mobile programming with Flutter
  • Raspberry Pi programming with Python
  • Arduino programming with Arduino’s C-like programming language
  • Wearables (after all, “portable” is related to the French verb porter, which means “to wear”)

I’m going to keep the beginner-friendly focus with this revamped meetup, but don’t let “beginner-friendly” fool you into thinking that it means “simple”! In some  of my “beginner-friendly” classes, we wrote:

  • Our own version of Frogger,
  • the iPhone version of Google’s Tilt Brush, the 3-D AR “paint” application
  • our own version of the IKEA Place AR app,
  • a machine learning app that tried to identify common objects,
  • a machine learning app that tried to identify the kind of room your were in, and
  • a machine learning app that could identify various members of the Avengers.

My plan is to return to regular meetups, which will be Zoom-based until the pandemic gets under control.

I’ll announce the first meetup shortly. In the meantime, let me know what topics you’d like me to cover at PoP. You can do it in the comments for this post, or on my Twitter or LinkedIn accounts.

Categories
Podcasts Programming Tampa Bay

Lots to listen to on Tampa Bay’s tech podcasts

It’s been a while since I last published a list of podcast episodes from Tampa Bay tech podcasts. So if you’re looking for something technical to listen to that’s also from “The Other Bay Area, on The Other West Coast”, there’s a lot on this list!

In the last list, I went from newest podcast series to longest-running; this time, I’m reversing the order.

Thunder Nerds

Of the podcasts in this roundup, Thunder Nerds — “A conversation with the people behind the technology, that love what they do… and do tech good” — has been around the longest, with 274 episodes over five seasons to date. You’ve probably seen the hosts at local meetups and conferences; they’re Sarrah Vesselov, Frederick Philip Von Weiss, and Brian Hinton.

Auth0 logoThunder Nerds is sponsored by a company that’s near and dear to me, Auth0! That’s partly because they have a great authentication, authorization, and identity service, and partly because I work there in my role as a Senior R&D Content Engineer!

274 – 🧑🏽‍🍳 Learn to Cook Code at Hackathons with Vincent Tang
In this episode, we get to speak with fullstack developer, tech educator, and speaker, Vincent Tang. We discuss the value of learning from hackathons, and how to get started in the tech industry. We also discuss Vincent’s new podcast Code Chefs.

The 6 Figure Developer

At the time I’m writing this, The 6 Figure Developer — hosted by John Callaway, Clayton Hunt, and Jon Ash — has posted 178 episodes. It’s…

…a show dedicated to helping developers to grow their career. Topics include Test Driven Development, Clean Code, Professionalism, Entrepreneurship, as well as the latest and greatest programming languages and concepts.

  • 178 – Identity with Christos Matskas
    Microsoft Identity for developers and Security in the Cloud! Christos is a developer, speaker, writer, and Microsoft Program Manager for Microsoft Identity, doing advocacy at scale.
  • 177 – F# and FP with Phillip Carter
    Phillip Carter joins us on the latest episode of The 6 Figure Developer Podcast to talk F# and Functional Programming. Phillip is a software person by trade. He currently works for Microsoft, focusing on .NET languages and compilers and tooling, with a heavy emphasis on F#. He likes doing other things too, like riding snowboards and bikes.
  • 176 – REST APIs with Irina Scurtu
    Irina is a Software Architect, a Microsoft MVP, and .NET Group Community Lead at Endava. She’s also a Microsoft Certified Trainer and founder of dotnetdays Romania.
  • 175 – Dave Glick: Statiq Sites and Open Source
    Dave has been professionally developing software for almost two decades. He is passionate about open source, .NET, and the intersection of the two.
  • 174 – DevOps Engineering with Ken Mugrage
    Ken is Tech Principal for the Office of the CTO @ThoughtWorks. He’s passionate about #ContinuousDelivery and #DevOps. He’s now focused on future tech.
  • 173 – bUnit: A Blazor Testing Lib w/ Egil Hansen
    Principal Developer at Delegate. A Microsoft MVP & .NET Foundation member. Creator of the Blazor Testing Library #bUnit. Egil joins us to talk all about bUnit – a Testing Library for Blazor Components.
  • 172 – Rob Richardson: .NET 5, Pipelines, & Testing
    Rob is a software craftsman building web properties in ASP.NET and Node, React and Vue. He’s a Microsoft MVP, published author, frequent speaker at conferences, user groups, and community events, and a diligent teacher and student of high quality software development.
  • 171 – Jeremy Sinclair: Win Insider, .NET on ARM
    Jeremy is an enthusiastic developer with over 10 years of development experience. He’s also part of the #WindowsInsiders community and a Windows Insider MVP.
  • 170 – Michael Jolley on JavaScript, TS, Blazor, etc.
    From his early days with lincoln logs to building custom ERP systems, Michael has always been a builder. With nearly 20 years experience designing & developing software, he loves sharing his knowledge with others and watching them excel. While still building custom applications for clients today, Michael has been spending considerable time pouring into others via his live-coding sessions on Twitch and talks at conferences & meet-ups. When not in full-geek mode, Michael is a husband of nearly 20 years, father to three awesome kids, musician, and football fanatic.
  • 169 – Welcome Back Ash! Self Care in Covid Times
    We’re so happy to have Jon Ash back! Ash was taking some time for self care, family, and personal projects. In this episode we welcome him back and hear all about what he’s been working on.
  • 168 – Oqtane and OSS with Shaun Walker
    Shaun Walker is the original creator of Oqtane and DotNetNuke, web application frameworks which have the earned the recognition of being among the largest, most successful, pioneering Open Source projects native to the Microsoft platform. He has 25+ years professional experience in architecting and implementing enterprise software solutions for private and public organizations. Based on his significant community contributions he has been recognized as a Microsoft Most Valuable Professional (MVP) as well as an ASPInsider for over 10 consecutive years. He was recognized by Business In Vancouver in 2011 as a leading entrepreneur in their Forty Under 40 business awards, and is currently the Chair of the Project Committee for the .NET Foundation. Shaun is currently a Technical Director and Enterprise Guildmaster at Cognizant Softvision. Shaun joined us to talk about his newest project, Oqtane, a Modular Application Framework for Blazor, as well as Open Source Software, and The .NET Foundation!
  • 167 – Manage Cloud Cost with Omry Hay
    Omry is Co-Founder and CTO at env0, the first self-service cloud management platform for infrastructure as code (IaC) architecture.
  • 166 – The State of Python with Michael Kennedy
    Michael is the founder and host of Talk Python To Me, a weekly podcast about Python and related software developer topics. He is a the founder and chief author at Talk Python Training where many leading Python developer courses are available online. Michael is an entrepreneur, a father of three girls, a husband, a student, and a teacher. You can find him in his hometown of Portland, OR.
  • 165 – Kode Vicious, George Neville-Neil
    Writing as Kode Vicious, George has spent more than 15 years sharing advice and insights as a “coder with attitude” in ACM’s Queue magazine. He is a software engineer, author and security nerd with other varied interests who speaks several languages including Japanese.
  • 164 – .NET MAUI with Auri Rahimzadeh
    Auri joins us to talk about .NET Multi-platform App UI (MAUI). Auri A. Rahimzadeh is an accomplished technophile writer and author. He has written three books: Hacking the PSP, Geek My Ride, and co-authored Hacking Digital Cameras. Rahimzadeh has contributed to many digital entertainment technology standards, including HDTV and DVD, and is former west coast research director at The Envisioneering Group, a prominent consumer electronics research firm. Having taught side by side with Steve Wozniak, co-founder of Apple, Auri continues to share a passion for technology education for children and teens. Currently Mr. Rahimzadeh is owner of Auri’s Ideas in Fishers, Indiana, and an instructor at Eleven Fifty Academy, a non-for-profit technology education bootcamp.

The Mike Dominick Show

The Mike Dominick Show is the second-newest of the podcasts in this list, and it has an open source focus.

Friends That Code

Friends that Code is the newest podcast on this list, and it’s hosted by Mike Traverso, whom locals may know from the Tampa Bay Google Developers Group meetup and other Google-y events. In this podcast, he showcases…

…some amazing people I know that just happen to write code for a living. Whether they started off intending to code or just happened into it, we get to hear about the types of people you’ll meet, things you’ll get to do, jobs you’ll have along the way, and advice from some awesome coders along the way!

  • 26 – Imposter Syndrome: You Do Belong Here & other affirmations and ways to beat imposter syndrome
  • 25 – I owe a world famous video game designer 70 cents with Graeme Devine
    Video game lover, developer, designer, producer, Godfather of games on CD-Roms, and man partly responsible for a Christmas shortage of gold Zelda cartridges. Ladies and gentlemen, todays guest is Graeme Devine!

  • 24 – Preparing for better opportunities. Oh! and pinball too with Stacy Devino
    Developer, Google Developer Expert, Community Organizer, Conference Speaker, Mentor, Sneaker fan and Mistress of Android. Ladies and Gentlemen, todays guest is Stacy Devino!

  • 23 – Having every job imaginable in technology with Joey deVilla
    Developer, former Evangelist, former CTO, Author, Community Organizer, Conference Speaker, Accordion Guy and Developer again. Ladies and gentlemen, today’s guest is Joey deVilla!

  • 22 – Coding a secure, community driven, open sourced Smash Bros moves app with Kento Kawakami
    Nintendo enthusiast, Video game lover, graphic designer, photographer, App developer and spanking new software developer. Ladies and gentlemen, todays guest is Kento Kawakami!

  • 21 – Mentoring developers & fostering the community with Maggie Negm
    Software developer, volunteer, and mentor to newer software developers and all around good person. Ladies and gentlemen, todays guest is Maggie Negm!

  • 20 – Dialoging with an Android Developer with Huyen Tue Dao
    Developer, Architect, Fantastic Conference Speaker, Google Developer Expert in Android & Kotlin, YouTube Producer and On-Air Talent… Ladies and gentlemen, today’s guest is Huyen Tue Dao!

  • 19 – Stay ready so you don’t have to get ready with Jerome Hardaway
    Developer, Air Force Veteran, Tech Evangelist, Founder and Executive Director at Vets Who Code and Captain America of web development! Ladies and gentlemen, today’s guest is Jerome Hardaway!

  • 18 – Development is just another creative outlet with David Khourshid
    Developer, Conference Speaker, Author, Javascript framework creator, Twitch streamer and moonlighting piano player. Ladies and gentlemen, todays guest is David Khourshid!

  • 17 – Creating creativity, turning static into fantastic with Erica Jacobs
    Designer, Illustrator, Volunteer, Celebrator of women in the design and tech community, Creator of the Neon Swan Awards and Creative Mind extraordinaire. Ladies and gentlemen, todays guest is Erica Jacobs!

  • 16 – ABC’s of success: Authenticity, Balance and Communication with Bill Conyea
    Developer, CTO, Investor, Technology Staffer and Entrepreneur. Ladies and gentlemen, today’s guest is Bill Conyea!

Categories
Programming Video

I watched a lot of “Top Programming Languages for 2021” videos so you don’t have to

It’s that time of the year again

It’s the start of a brand new year, and in the world of developer YouTube, that means one thing: A whole lot of videos on the topic of the programming languages that you must know or learn for the upcoming year.

In a non-pandemic year, “Top programming languages for 2021” is a relatively easy topic to cover, and one that’s sure to attract some extra search-based viewership. In the year after the one we just had, a good number of people who are trying to pivot to software development, and a title like “Top programming languages for 2021” is pure YouTube audience bait.

Since I had some time to kill while reformatting one of my machines over the holiday break, I decided to enter the search term top programming languages for 2021 into YouTube’s search field and see what came up. To keep the number of videos down to something manageable, I considered only videos posted after the start of November 2020.

A lot of the same recommendations

Creative Commons photo by Doug Kline. Tap to see the source.

I ended up watching 17 videos, and there was a high degree of overlap in their recommendations:

Language Recommendations
JavaScript 17
Python 16
Go 12
Java 11
C# 10
Kotlin 10
C / C++ 9
PHP 9
Swift 6
R 3
Rust 3
Ruby 2
SQL 2
TypeScript 2
Dart 1
Shell scripting 1

Unsurprisingly, every video recommended JavaScript and all but one recommended Python. The more interesting results were further down the list including:

  • A surprisingly high number of recommendations for Go and C/C++ — lower-level systems programming languages that are a little less suited for web development than the others. Most of the people who posted “top languages for 2021” videos seemed to be targeting an audience of web developers, which makes me wonder if their recommendations are based simply on C’s, C++’s, and Go’s strong showing on the TIOBE Index.
  • I thought Kotlin and Swift would be about even, but 10 reviewers recommended Kotlin, while only 6 recommended Swift.
  • I thought TypeScript would get more recommendations.

The videos

For the benefit of the curious, I’ve listed the videos below, complete with links and each one has a list of the recommendations made in the video.

I feel obliged to remind you that these are subjective opinions that could easily be based on the presenter’s biases, some Googling, or cribbing notes from the Technology section of the 2020 Stack Overflow developer survey.

If you’re planning to learn a new programming language or sharpen your skills on a language you’re already familiar with, you should make sure that it’s in service of some kind of goal. Is knowing a language part of a larger career plan, to assist you with your current job, to make yourself more attractive to prospective employers, or for fun? All of these are valid reasons, but you should have a reason.

And now, the videos:

Top 10 Programming Languages to learn for 2021:
polyglotengineer
(December 26, 2020, <1K views)

I thought I’d start by giving my home state of Florida some love by presenting Jacksonville-based polyglotengineer’s list of languages to learn this year. Here are his picks:

10. Java
9. C#
8. PHP
7. C / C++
6. Go
5. Kotlin
4. Rust
3. Python
2. Swift
1. JavaScript

Top 10 Programming Languages In 2021:
Simplilearn

(Nov 19, 2020, 93K views)

Simplilearn is an online bootcamp that boasts of partnerships with Purdue, Caltech, UMass Amherst, AWS, IBM, Microsoft, and Accenture. Here’s their “top ten” list of programming languages to take up in 2021:

10. C#
9. Go
8. C++
7. JavaScript
6. Swift
5. Java
4. R
3. Kotlin
2. PHP
1. Python

Top 10 Programming Languages to Learn in 2021:
Chris Hawkes
(December 28, 2020, 4K views)

Here’s a short one — Chris Hawkes takes you on a literal walk through the woods as he goes over his picks for 2021.

  • JavaScript
  • Python
  • PHP
  • Java / .NET Core
  • Go
  • Ruby
  • Rust
  • C++
  • TypeScript
  • JVM languages (Kotlin, Scala…)

Top 7 Programming Languages to learn in 2021! (Pay attention to these!):
DThompsonDev
(December 14, 2020, 9K views)

Danny “DThompsonDev” Thompson wins the prize for best use of props in his round-up of the languages you should learn in the new year, with the Python fanboy baseball bat and PHP cash money.

Here’s his selection of the top seven programming languages to take in the 2G21:

7. Go
6. PHP
5. C#
4. Java
3. C++
2. JavaScript
1. Python

Top 5 programming language for 2021:
Hitesh Choudhary
(December 7, 2020 / 96K views)

Hitesh Choudhary is one of the instructors at LearnCodeOnline, an online coding school.  Here’s his list of the top five programming languages to learn this year:

  • JavaScript / ReactJS
  • Python / Django
  • C++
  • Java
  • PHP

Top 10 Best Programming Languages To Learn In 2021:
TiffinTech
(December 27, 2020, 5K views)

“Tiffin” is Tiffany Janzen, a software developer based in my old home town of Toronto who started her career in the modeling & fashion industry. You can find out more about here on this episode of the podcast You’re Too Pretty.

Here’s her list:

  • Python
  • JavaScript
  • Java
  • Kotlin
  • Swift
  • C / C++
  • Go
  • PHP
  • R
  • Ruby

Top 10 Programming Languages For 2021:
Edureka
(December 29, 2020, 28K views)

Here’s the list from Edureka, an online corporate training site:

  • PHP
  • R
  • Dart
  • Go
  • C#
  • SQL
  • C / C++
  • Java
  • JavaScript
  • Python

The Top Programming Languages to Learn in 2021!:
Bryan Cafferky
(October 3, 2020, 3K views)

Here’s Boston-area-based Bryan Cafferky’s take on what you should learn this year, broken down by category. His is the one list that has a recommendation that no one else gave: Learn shell scripting, whether for Windows or Unix-based platforms.

  • C / C++
  • Python
  • PowerShell / Bash
  • JavaScript

Top programming languages to learn in 2021:
Vicky Mei
(December 22, 2020, <1K views)

Vicky Mei has a YouTube channel with the motto “No BS, build your career in tech”, where she posts a new video every week. Here’s her list:

  • JavaScript
  • Python
  • Java
  • Kotlin
  • Swift
  • SQL

Top 5 Programming Languages For 2021 To Land A Job During COVID-19:
AppStuff
(December 15, 2020, <1K views)

This is a very new channel, whose host started posting videos about a month ago. He’s a mobile developer, and here are his recommendations:

5. C#
4. Swift
3. Kotlin
2. JavaScript
1. Python

Top 5 programming languages to learn in 2021:
codebasics

(December 27, 2020, 32K views)

codebasics is Dhaval Patel’s YouTube channel, where he covers a lot of data science and Python topics. Here are his top five languages to learn in 2021:

5. Go
4. Kotlin
3. JavaScript
2. TypeScript
1. Python

Top 5 Programming Languages For 2021:
NeuralNine
(December 28, 2020, 6K views)

Here’s another video from a channel that’s just getting started — NeuralNine, which is “an educational brand focusing on programming, machine learning and computer science in general.”

Here’s their list:

5. C# / Java
4. C / C++
3. JavaScript
2. Go
1. Python

top programming languages 2021 // best languages for beginners to learn to get hired!:
Lena Elizabeth Shapiro
(December 13, 2020, 3K views)

Lena’s channel is a mix of tech and lifestyle. Here’s her list of languages to learn in the new year:

  • Python
  • JavaScript
  • ReactJS
  • C#

Top 10 Programming Languages in 2021:
Great Learning
(December 18, 2021, 47K views)

Great Learning say they have over 200 free certificate courses and seven years’ worth of videos. Here’s their top ten list of programming languages to take up in 2021:

10. Kotlin
9. Swift
8. C#
7. R
6. PHP
5. Go
4. C++
3. Java
2. Python
1. JavaScript

Top 5 Programming Languages to Learn in 2021:
Yazeed AlKhalaf
(November 21, 2020, <1K views)

Yazeed Alkhalaf is the youngest YouTubers in this list — he’s 15, and he’s got four videos in his channel. Here are his recommendations:

  • Python
  • Kotlin
  • Java
  • JavaScript
  • Go

Top 7 Programming Languages to Learn in 2021:
GeeksForGeeks
(December 23, 2020, 57K views)

Ishan Sharma looks to be just a bit older than Yazeed (judging from his youthful appearance and bookshelf contents). In addition to making videos at GeeksForGeeks, he also has his own YouTube channel, which boasts over 32,000 subscribers.

He recommends the same languages as Yazeed, plus two more:

7. Kotlin
6. PHP
5. C++
4. Go
3. Java
2. Python
1. JavaScript

Top Programming Languages 2021:
John Codes
(December 26, 2020, <1K views)

I’ll close out this collection with a more general list from John Codes, who describes himself with the phrase “software engineer turned content creator”. Here’s a quick summary of his recommendations for 2021:

  • If you don’t know it already, pick up a little JavaScript.
  • If you’re looking for a new back-end language and stack, look at Go and Kubernetes.
  • For operating systems and embedded programmers, look at Rust.
Categories
Current Events Programming

Avocado Labs talk today at noon (EST): Meet Matthew Pegula of Deeplocal!

Avocado Labs an Auth0 project whose goal is to keep developers and techies — and people who want to become developers and techies — connected through high-quality online talks.

Today at noon Eastern (17:00 UTC), join Avocado Labs’ Twitch channel to meet Matthew Pegula, Director of Creative Technology at the technology/experience design studio Deeplocal.

He’ll be talking about some of their cool projects, including a project called “Connected Mistletoe”, which keeps distant people connected over the holidays:

Here’s the brief for the talk:

Matthew Pegula works at Deeplocal, a creative technology and experience design studio based in Pittsburgh, PA. They’re a group of engineers and creatives who use technology to tell stories and create experiences in novel ways. At first glance, their projects don’t always jump out as being overly technical or software-driven, but that’s sort of the idea: the technology enables the story, it doesn’t overshadow it. Matthew is going to show a few of their favorite projects, talk about the technology that’s driving them, and some of the challenges they ran into along the way.

Matthew Pegula is a software engineer who has been lucky enough to blend his interests in technology, design, writing, and engineering into a career that encompasses them all. He has a BS in computer science from Allegheny College and leads the Creative Technology team at Deeplocal.

If you’d like to attend this online event, please read the code of conduct, then point your browser at Avocado Labs’ Twitch channel.

Categories
Programming What I’m Up To

My solution to Advent of Code 2020’s Day 8 challenge, in Python

Welcome to another installment in my Advent of Code 2020 series, where I present my solutions to this year’s Advent of Code challenges!

In this installment, I share my Python solution to Day 8 of Advent of Code, titled Handheld Halting.

Spoiler alert!

Please be warned: If you want to try solving the challenge on your own and without any help, stop reading now! The remainder of this post will be all about my solution to both parts of the Day 8 challenge.

The Day 8 challenge, part one

The Kittenbot Meowbit handheld game console. Tap to find out more.

The challenge

Here’s the text from part one of the challenge:

Your flight to the major airline hub reaches cruising altitude without incident. While you consider checking the in-flight menu for one of those drinks that come with a little umbrella, you are interrupted by the kid sitting next to you.

Their handheld game console won’t turn on! They ask if you can take a look.

You narrow the problem down to a strange infinite loop in the boot code (your puzzle input) of the device. You should be able to fix it, but first you need to be able to run the code in isolation.

The boot code is represented as a text file with one instruction per line of text. Each instruction consists of an operation (accjmp, or nop) and an argument (a signed number like +4 or -20).

  • acc increases or decreases a single global value called the accumulator by the value given in the argument. For example, acc +7 would increase the accumulator by 7. The accumulator starts at 0. After an acc instruction, the instruction immediately below it is executed next.
  • jmp jumps to a new instruction relative to itself. The next instruction to execute is found using the argument as an offset from the jmp instruction; for example, jmp +2 would skip the next instruction, jmp +1 would continue to the instruction immediately below it, and jmp -20 would cause the instruction 20 lines above to be executed next.
  • nop stands for No OPeration – it does nothing. The instruction immediately below it is executed next.

For example, consider the following program:

nop +0
acc +1
jmp +4
acc +3
jmp -3
acc -99
acc +1
jmp -4
acc +6

These instructions are visited in this order:

nop +0  | 1
acc +1  | 2, 8(!)
jmp +4  | 3
acc +3  | 6
jmp -3  | 7
acc -99 |
acc +1  | 4
jmp -4  | 5
acc +6  |

First, the nop +0 does nothing. Then, the accumulator is increased from 0 to 1 (acc +1) and jmp +4 sets the next instruction to the other acc +1 near the bottom. After it increases the accumulator from 1 to 2, jmp -4 executes, setting the next instruction to the only acc +3. It sets the accumulator to 5, and jmp -3 causes the program to continue back at the first acc +1.

This is an infinite loop: with this sequence of jumps, the program will run forever. The moment the program tries to run any instruction a second time, you know it will never terminate.

Immediately before the program would run an instruction a second time, the value in the accumulator is 5.

Run your copy of the boot code. Immediately before any instruction is executed a second time, what value is in the accumulator?

Importing the data

Every Advent of Code participant gets their own set of data. I copied my data and went through my usual process of bringing it into a Jupyter Notebook running a Python kernel.

This involves pasting it into a triple-quoted string and then assigning its value to the variable main_raw_input:

main_raw_input = """acc +37
acc -4
nop +405
jmp +276
acc +39
acc +40
acc -3
jmp +231
acc +44
acc +12
jmp +505
acc +35
jmp +282
acc +23
jmp +598
nop +392
acc +18
acc +44
acc +18
jmp +297
nop +460
jmp +152
nop +541
acc +33
jmp -11
acc -5
acc +9
jmp +327
acc +30
acc -1
acc -3
jmp +50
acc +22
acc +18
acc +33
acc +37
jmp +57
acc -17
acc -6
acc -2
jmp +535
acc -15
jmp +279
acc +34
acc +44
acc +41
jmp +349
acc +2
acc +6
nop +351
nop +252
jmp +505
jmp +1
jmp +1
nop +61
jmp +524
nop +351
jmp +399
acc +1
nop +397
acc +39
nop +141
jmp +134
acc +46
acc +14
acc +26
jmp +236
acc +7
acc -6
acc +35
jmp +397
acc +15
jmp +140
acc +3
acc -4
acc +37
acc +12
jmp +86
jmp +416
jmp +1
jmp +55
acc -19
jmp +536
jmp +1
acc -11
acc +15
jmp -61
acc +25
jmp -25
acc +50
acc +43
jmp +1
jmp +140
acc +46
nop -53
acc +1
nop +440
jmp +488
jmp +396
nop +443
acc +41
jmp +168
acc +25
nop +383
acc +12
acc -19
jmp +21
acc +29
acc +30
jmp +497
jmp +502
jmp +417
nop +351
acc -15
jmp +243
acc +21
acc +16
jmp +332
acc +28
acc +22
acc +38
jmp +476
acc +8
acc -11
jmp +458
acc +9
jmp +246
acc +40
acc +31
acc +26
jmp +218
acc +27
acc +9
nop +347
jmp +478
nop +28
nop +106
acc +25
acc -15
jmp +397
acc +31
jmp +231
acc -4
nop +136
acc +14
jmp +181
jmp +361
acc +16
acc +11
jmp -108
nop +299
acc +21
acc -2
jmp -106
jmp +246
acc +31
jmp +407
jmp +377
acc +43
acc -12
nop +142
acc +8
jmp -91
jmp +1
acc +34
acc +5
acc +31
jmp +12
acc +34
acc +7
acc +34
acc +20
jmp -45
acc -11
acc +41
acc +10
jmp +310
nop -106
jmp -36
acc +23
acc +46
acc +46
jmp +112
acc +41
nop +179
acc +17
nop +356
jmp +147
acc +42
nop +49
jmp +119
acc +0
acc +7
acc -18
acc -8
jmp +11
acc +12
acc +38
acc +39
jmp +281
nop +186
jmp +162
acc +44
acc +20
jmp +153
jmp +395
acc +49
jmp +1
acc +2
jmp +1
jmp -31
jmp +301
nop +97
jmp -102
jmp +262
acc +28
acc -15
acc +44
acc -13
jmp +191
jmp +281
acc +36
acc +1
nop +15
jmp +211
acc +6
acc -4
jmp +42
acc +34
acc +0
jmp +104
jmp +311
jmp +84
acc +43
acc -8
acc -10
acc +38
jmp -90
acc +49
jmp +303
nop +132
jmp +301
nop +60
acc +37
nop +96
jmp +182
acc +16
acc +18
nop +152
acc +19
jmp +325
jmp -63
acc +28
jmp +56
acc +18
acc +29
acc +33
jmp -115
acc +47
acc +19
jmp +1
nop +41
jmp +1
jmp -207
nop -62
acc -9
acc +42
acc -12
jmp -56
acc +28
jmp -163
acc +25
acc +17
jmp -217
acc +7
jmp +272
acc +43
acc +22
jmp +70
acc -17
jmp -117
acc +24
acc +26
nop -275
jmp -46
nop +87
acc +19
acc +28
jmp -34
acc +4
acc +9
acc +6
jmp +1
jmp +28
acc -6
nop -67
acc -10
jmp +271
acc +40
acc +25
acc -4
jmp -63
acc +46
jmp +78
acc +41
nop -126
nop +70
jmp +1
jmp +172
nop +270
jmp +30
jmp +1
acc +38
nop +68
acc +29
jmp +253
acc -18
jmp -89
acc +18
acc +30
jmp +147
acc +24
acc +11
acc +50
jmp -225
jmp -210
acc -18
acc +1
acc +38
jmp +1
jmp -79
acc +45
acc +12
jmp +209
jmp -207
acc +32
acc +4
acc +32
acc +14
jmp +83
acc +13
acc +1
acc +46
acc +38
jmp +28
nop +153
acc -17
jmp -73
acc +11
jmp +248
acc +29
acc +45
acc +16
jmp +96
jmp -273
acc +34
jmp +87
nop +99
acc -3
jmp -74
acc +12
nop -119
jmp -141
acc -18
nop -79
acc +1
acc +6
jmp +9
acc +3
acc +44
acc +39
jmp -165
acc +6
jmp +44
acc +25
jmp -133
acc +0
jmp +14
jmp +1
acc +1
jmp -223
jmp +71
nop -1
acc +22
acc +11
jmp -274
jmp -330
acc +45
jmp +1
acc +15
jmp -158
jmp -128
acc +50
acc +26
jmp -73
nop +99
jmp +71
acc +35
acc +7
jmp +192
acc +13
jmp +190
acc +4
acc -1
acc +40
acc -15
jmp +50
acc +29
jmp -337
jmp -75
acc +41
jmp +1
jmp -387
acc +28
acc +18
acc +19
jmp -62
nop -196
jmp -410
jmp +1
acc -17
jmp -267
acc +22
jmp -301
nop -98
acc -15
jmp -124
acc +45
acc -18
acc +15
acc +42
jmp -296
nop -10
acc +29
jmp -371
acc +3
jmp +1
nop +61
acc +5
jmp -361
acc -5
nop -326
jmp -379
acc -10
jmp +1
acc +44
jmp -231
acc +3
jmp -94
acc +1
jmp +113
jmp -336
acc +4
jmp -299
acc -13
jmp +1
acc +13
jmp +143
acc -11
acc -19
acc +18
nop -390
jmp -27
acc +42
jmp -232
acc +15
jmp -228
acc +21
acc +39
acc +47
acc +6
jmp +57
acc +28
acc +27
acc +50
jmp -397
acc +12
jmp -445
acc +30
jmp -352
acc -4
acc +26
acc +48
jmp +1
jmp -205
jmp +22
nop -284
acc -1
nop -361
acc +0
jmp -368
acc -17
nop -223
jmp -41
acc +4
acc +46
jmp +79
jmp -370
jmp -260
acc +42
jmp -14
acc +30
acc +50
acc +13
jmp -61
acc +46
jmp -63
nop -55
nop -320
jmp -11
acc +10
jmp -424
jmp -11
acc +3
jmp -71
acc +42
acc -13
jmp +4
nop -155
nop -138
jmp +62
acc +11
acc +19
acc +15
acc +17
jmp -73
acc -11
jmp -273
acc +8
acc +6
acc -7
acc +41
jmp -311
jmp -111
jmp -260
jmp +50
jmp -60
jmp +1
nop -89
acc +36
acc +14
jmp -220
nop -415
acc +28
jmp -402
acc +41
jmp -165
acc +9
acc -13
acc -18
acc +18
jmp -504
acc -9
acc +29
acc +44
jmp -444
acc +5
acc +47
jmp -545
acc +23
acc +7
nop -240
jmp -320
jmp -141
jmp +1
acc +28
nop -287
jmp -118
acc +44
acc -7
jmp -550
acc +10
acc +20
acc -3
jmp -401
acc +45
acc +36
jmp -375
jmp -485
acc +9
jmp -338
jmp -510
jmp -196
acc -16
jmp -372
acc +0
jmp -380
acc -3
nop -473
nop -361
jmp -311
acc +0
nop +20
jmp -436
acc +9
jmp +1
jmp -215
acc +19
jmp -451
jmp -43
acc -13
acc -10
acc -5
jmp -208
acc -11
jmp -156
acc +11
acc -2
nop -357
jmp -73
acc +21
jmp -159
acc +28
acc -16
acc +12
acc +1
jmp -282
jmp -131
acc -11
acc +45
acc +0
acc +28
jmp +1"""

Building the data structure

With the data imported, the next step was to build an appropriate data structure. Since today’s puzzle was based on simplified microprocessor instructions, I thought that the data structure should do the same.

I wanted my data structure to look like the table below, which shows the instructions from extracted from the first five lines of the data given to me:

Index Opcode Operand
0 acc 37
1 acc -4
2 nop 405
3 jmp 276
4 acc 39

Here’s the function that I wrote to convert the input data into the data structure:

def input_to_instructions(input_data):
    instructions = []
    
    split_input = input_data.splitlines()
    
    for item in split_input:
        instruction = {}
        opcode_operand = item.split()
        instruction["opcode"] = opcode_operand[0]
        instruction["operand"] = int(opcode_operand[1])
        instructions.append(instruction)
        
    return instructions

With the function defined, here’s how I used it to create the data structure, which I assigned to a variable named instructions:

>>> instructions = input_to_instructions(main_raw_input)
>>> print (instructions)

[{'opcode': 'acc', 'operand': 37},
 {'opcode': 'acc', 'operand': -4},
 {'opcode': 'nop', 'operand': 405},
 {'opcode': 'jmp', 'operand': 276},
 {'opcode': 'acc', 'operand': 39},

...

]

I then wrote accumulator_value_at_first_repeat(), the function that would use the data structure contained within instructions to solve the first challenge:

def accumulator_value_at_first_repeat(instructions):
    program_length = len(instructions)
    program_counter = 0
    accumulator = 0
    executed_instructions = set()
    repeat_instruction_encountered = False
    
    while 0 <= program_counter < program_length:
        current_instruction = instructions[program_counter]
        
        if program_counter in executed_instructions:
            repeat_instruction_encountered = True
            break
        else:
            executed_instructions.add(program_counter)
            
        if current_instruction["opcode"] == "jmp":
            program_counter += current_instruction["operand"]
            continue
        elif current_instruction["opcode"] == "acc":
            accumulator += current_instruction["operand"]
        elif current_instruction["opcode"] == "nop":
            pass
        else:
            print("Something went wrong in accumulator_value_at_first_repeated_instruction().")
            print(f"pc = {program_counter} acc = {accumulator}")
            print(f"instruction:\n{instruction}")
            
        program_counter += 1
    
    if repeat_instruction_encountered:
        print(f"The accumulator's contents at the first repeated instruction is: {accumulator}.")
    else:
        print("Reached end of instructions without repeating any of them.")

When run, it sets up the following variables:

  • program_length: The number of instructions in the data structure.
  • program_counter: The program’s equivalent of the “program counter (PC)” register in a microprocessor; contains the index the instruction to be executed.
  • accumulator: The program’s equivalent of an accumulator in a microprocessor. For those of you who aren’t familiar with what happens at the microprocessor level, think of the accumulator as a “scratchpad” variable where you do all the math.
  • executed_instructions: A set (which means that every value in it is unique) of the indices of all the instructions that have already been executed. We use it to determine if a given instruction has already been run, at which point we should stop the program and see what the value in the accumulator is.
  • repeat_instruction_encountered: A flag that should be set to True when an instruction is about to be executed a second time.

The function’s main loop performs a greatly simplified version of a microprocessor’s “fetch-decode-execute” cycle:

  1. Fetch the current instruction, which is the one whose index is specified by program_counter.
  2. See if the instruction has been executed before. If this is the case, exit the loop; otherwise, recording this instruction as having been executed.
  3. Decode the current instruction:
    • If the instruction is jmp, add the operand value to program_counter and go back to the start of the loop.
    • If the instruction is acc, add the operand value to accumulator.
    • If the instruction is nop, do nothing.
    • If the instruction is anything else, display an error message.
  4. After the loop is done, if the repeat_instruction_encountered flag is set, we’ve found the value we’re looking for — display it! Otherwise, display a message saying that we’ve reached the end of the instructions without ever repeating one.

I ran the function…

>>> accumulator_value_at_first_repeat(instructions)

The accumulator's contents at the first repeated instruction is: 1801.

…and got my result: 1801.

The Day 8 challenge, part two

The TinkerGen GameGo programmable handheld game console. Tap to find out more!

The challenge

After some careful analysis, you believe that exactly one instruction is corrupted.

Somewhere in the program, either a jmp is supposed to be a nopor a nop is supposed to be a jmp. (No acc instructions were harmed in the corruption of this boot code.)

The program is supposed to terminate by attempting to execute an instruction immediately after the last instruction in the file. By changing exactly one jmp or nop, you can repair the boot code and make it terminate correctly.

For example, consider the same program from above:

nop +0
acc +1
jmp +4
acc +3
jmp -3
acc -99
acc +1
jmp -4
acc +6

If you change the first instruction from nop +0 to jmp +0, it would create a single-instruction infinite loop, never leaving that instruction. If you change almost any of the jmp instructions, the program will still eventually find another jmp instruction and loop forever.

However, if you change the second-to-last instruction (from jmp -4 to nop -4), the program terminates! The instructions are visited in this order:

nop +0  | 1
acc +1  | 2
jmp +4  | 3
acc +3  |
jmp -3  |
acc -99 |
acc +1  | 4
nop -4  | 5
acc +6  | 6

After the last instruction (acc +6), the program terminates by attempting to run the instruction below the last instruction in the file. With this change, after the program terminates, the accumulator contains the value 8 (acc +1acc +1acc +6).

Fix the program so that it terminates normally by changing exactly one jmp (to nop) or nop (to jmp). What is the value of the accumulator after the program terminates?

Here’s the function I wrote to solve this challenge:

def accumulator_value_and_halt_at_first_repeat(instructions, switch_opcode_address=-1):
    program_length = len(instructions)
    program_counter = 0
    accumulator = 0
    executed_instructions = set()
    
    while 0 <= program_counter < program_length:
        current_instruction = instructions[program_counter]
        
        if program_counter in executed_instructions:
            return {
                "halted": False,
                "program_counter": program_counter,
                "accumulator": accumulator
            }
        else:
            executed_instructions.add(program_counter)
            
        opcode = current_instruction["opcode"]
        operand = current_instruction["operand"]
            
        if program_counter == switch_opcode_address:
            print(f"Changing opcode at address {program_counter}")
            if opcode == "jmp":
                print("- Changing jmp to nop")
                opcode = "nop"
            elif opcode == "nop":
                print("- Changing nop to jmp")
                opcode = "jmp"
            
        if opcode == "jmp":
            program_counter += operand
            continue
        elif opcode == "acc":
            accumulator += operand
        elif opcode == "nop":
            pass
        else:
            print("Something went wrong in accumulator_value_at_first_repeated_instruction().")
            print(f"pc = {program_counter} acc = {accumulator}")
            print(f"instruction:\n{instruction}")
            
        program_counter += 1
            
    return {
                "halted": True,
                "program_counter": program_counter,
                "accumulator": accumulator
            }

The function, accumulator_value_and_halt_at_first_repeat(), is an expanded version of the function from part one, accumulator_value_at_first_repeat().

In addition to a set of instructions, it takes an additional parameter: the address of an instruction that should be changed — either from jmp to nop, or from nop to jmp.

The function still performs the “fetch-decode-execute” loop, and it exits the loop if it’s about to execute an instruction that’s already been executed. The main difference is that if the current instruction is the one flagged for change, it changes the instruction appropriately.

I wrote the accumulator_value_and_halt_at_first_repeat() function to be used by the function below:

def run_instructions_with_mods(program):
    
    for index in range(len(program)):
        instruction = program[index]
        if instruction["opcode"] != "acc":
            print(f"Found jmp or nop at address: {index}")
            result = accumulator_value_and_halt_at_first_repeat(program, index)
            if result["halted"]:
                print(f"Found it! {result}")
                break
            else:
                print(f"Not the correct instruction.")

This function goes through all the instructions in the set, looking for any jmp or nop instructions. When it finds one, it runs the program using accumulator_value_and_halt_at_first_repeat(), marking the jmp or nop instruction as the one to be changed.

This lets us modify the program, one jmp or nop instruction at a time, in order to find which change to a jmp or nop instruction is the one that allows the program to reach the end of the instructions.

Here’s an abridged version of what happened when I ran the function:

>>> run_instructions_with_mods(instructions)

Found jmp or nop at address: 2
Changing opcode at address 2
- Changing nop to jmp
Not the correct instruction.
Found jmp or nop at address: 3
Changing opcode at address 3
- Changing jmp to nop
Not the correct instruction.
Found jmp or nop at address: 7
Not the correct instruction.
Found jmp or nop at address: 10
Changing opcode at address 10
- Changing jmp to nop
Not the correct instruction.

...


Found jmp or nop at address: 207
Changing opcode at address 207
- Changing jmp to nop
Not the correct instruction.
Found jmp or nop at address: 209
Changing opcode at address 209
- Changing jmp to nop
Not the correct instruction.
Found jmp or nop at address: 210
Changing opcode at address 210
- Changing jmp to nop
Found it! {'halted': True, 'program_counter': 623, 'accumulator': 2060}

I entered 2060 as my answer, and step two was complete.

Solutions for other days in Advent of Code 2020