The Minimax Algorithm is my Boyfriend Now
You can find the code here: https://github.com/Yasmin-A95/tictactoe
Week 3 of my software engineering immersive: design a tic-tac-toe program from scratch. No HTML or CSS to speak of, our first from-the-ground-up project. Jesus help me.
Day 1: Furiously writing notes from my living room office; class is on zoom today for "Digital Nomad Monday". The plan: get the MVP done as soon as possible and with the least hitches I could manage so that I could stop the evil voices claiming I'd never be able to finish it and that I'd made a terrible mistake by signing up for General Assembly.
Day 2: I awoke from the haze of anxious planning after said two days in a sea of ripped-up sketchbook paper with a headache and a terrible pain in my neck from crouching amongst my precious papers and hissing at the delivery people who had come to make sure I don't get scurvy. Zoom again today as my class had to quickly change the plans from "Digital Nomad Monday" back in class by Tuesday, to "All Zoom All the Time!!" when a classmate got Covid.
Day 3: time to put fingers to the keyboard and get this thing off the ground.
Day 3 (2 h 2 m): Cry because nothing is working; I can't even console log. What the heck is going on?
Day 3 (4 h 30m): Oh yeah I wrapped my entire program in a render function and then never called that function. Gah! Why am I like this?
Day 4: Yay! It's done, it works, life is good! What to do next? I might skip all the css extra for now since I've focused on that in previous homework and feel pretty comfortable with it. Let's go for the unbeatable algorithm challenge.
Day 5: I have an Algorithm that randomly generates moves from the wins array full of arrays. Now how do I go about getting it to analyse that array further and pick the next available move from a win that uses its previous move. My head spins trying to pseudo code that. Time to get some guidance.
My instructor has a look at my code and is surprised at how fancy I'm making it, which was a nice way of saying I overcomplicated something that could have been pretty simple. Since I'm doing something complicated anyway, he says, I should try and implement the minimax algorithm. I'd looked at that on day 4 and dismissed it as confusing, but I tell him I'll have another look. "It's a hard thing to implement, don't be mad if it doesn't work. Try to have fun!" (paraphrasing). Spoiler, I was mad.
Day 5 (6 h 6 m 6 s): I'm once again in a sea of notes. I'm ready to start trying to implement this thing.
Day 5 (9h): it's not working I am mad, back to the note-taking.
Day 5 (12 h 12 m): It's time for bed. It didn't work, I am sad about that. Importantly though, I'm for the first time amazed at how beautiful code can be designed, and instead of feeling dazed and confused after a long slog of endlessly fixing bugs and retiring to nurse my wounds, I'm feeling refreshed and sharp. It was somehow the most enjoyable failure of my life, and I think that with some time and guidance I'll be able to successfully implement it now that I understand it so much more deeply. Galaxy brain Yasmin is just around the corner, I can sense it.
Subscribe to my newsletter
Read articles from Yasmin Archibald directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Yasmin Archibald
Yasmin Archibald
Former child