Today I managed to fit in some design, some coding, AND some bug fixing (by way of a bit of a redesign). This was not nearly as frustrating as the bug the other day and although in the end not a lot of visible progress was made, things are a lot more streamlined and ready to go now. Functionality-wise, we can now properly check to see if a given player should have a turn and immediately skip them if they have no moves available.
Category: Devember 2016
This category contains posts about Devember, a little contract with developers everywhere to spend 30 days writing code, blogging about it, and sharing it with the public. Learn more at http://devember.org.
This post is going to be pretty short (like for real, not how I usually say that it’s going to be short and then I ramble on anyway. Just short. Except for this explanation about how it’s going to be short). I fixed the bug that I was facing yesterday and, as predicted, it was pretty simplistic once I eventually figured out what was going on. This took enough time that (besides some new debugging output code), nothing else was accomplished. However, things look like this now:
— Terence Martin (@OdatNurd) December 22, 2016
If I had to sum up this evening in one word, it would probably be rather profane, so I’m not going to do that. Instead, I’ll just use a sound. *sigh*.
Continuing with yesterday’s integration of the new state machine to track what’s going on, we now have a computer player that can take its own turn instead of a key to press that causes the human player to take a turn. Visually, that looks a little something like this:
— Terence Martin (@OdatNurd) December 20, 2016
The long awaited FSM has been implemented, an an alternate title for this post might be “Many steps taken, back where we started” since for the most part the only outwardly visible change to anything is some console output and the fact that you can no longer move the player avatar while a ball is dropping through the maze (which presumes you ever tried).
Still, this lays the groundwork for what’s to come and I’ve already built out some new framework for the upcoming changes, so that’s good.
For the second day in a row I abandoned my plan to get to work on the state machine that will drive the different parts of the game. This time around it was less because I wanted to work on something else and more that I wanted to think a little more on how exactly I want to go about working it. That requires sitting down and thinking a bit of all of the states I’m going to need and I didn’t have time to do that and code, so I did some coding again instead.
So what we have is a little bit of code cleanup and some extensions to yesterday’s AI code to make it a little smarter.
Well, this is another later night than I was hoping to put in due to my making some stupid (classic) mistakes, but lets not talk of that right now. Instead we’ll (quickly) talk about how I implemented some AI for today’s update. As I did before, here is a link to a tweet that has a big animated GIF of what we’re about to talk about:
— Terence Martin (@OdatNurd) December 17, 2016
Here we are at Day 15, I’m a little tired from getting to bed late last night, but today’s change has been completed! We now have a player entity that walks back and forth over the top of the maze, and can push the ball into the maze:
Just perusing my git log for commits pushed today shows that my first commit was done at 11:51:55 PST and the last was at 22:13:53 PST. Of course I wasn’t coding for that entire time, but I DID know that today was going to be a bit of an investment, so I got started early and put in more time; my vacation started today and apparently I know how to let the good times roll.
I’ll go over the changes made, but to begin with I’d like to point out that this little refactoring and reorganization exercise cut the length of the Maze entity from an astounding 1846 lines down to 953, which is ~51% shorter. Before anyone goes off on how that’s still an excessive length, a quick perusal of the Maze.ts source file (or any of the source files) will show that I am pathologically verbose in commenting my code. So there.
For today’s changes we have some slight refactoring as well as the change that I wanted to complete yesterday before I ran out of time. Well technically I could have worked on it longer, but as it was I was up rather late and these old bones don’t like that very much any more. Ahh, the vigors of youth, how I miss you.
For video of this in action, I direct you to a tweet I posted:
— Terence Martin (@OdatNurd) December 14, 2016