I have been struggling to think up content for this blog. It is difficult to come up with examples that show reasonable techniques in completely context-less examples. One has to invent some contrived reason to do something and that is actually a bad foundation to teach good engineering principles. I have ideas about what techniques should be talked about, or at least can be, but coming up with examples that are both simple enough to create a short blog entry that can’t instantly be refuted with, “But why would you do that?? It overcomplicates the issue,” is really tough.
Some recent interactions online have given me an idea for a good project I can use to examine my approach to software engineering: chess. There are a lot of reasons this domain provides a good test-bed to learn from. First of all, the most basic engines are pretty thin. We need to only learn a couple things to get started. On the other hand, there’s a basically endless road to travel enhancement wise–we might even branch out and play with things like CUDA and distributed computing.
Somewhere between 12 and 15 years ago I began the process of creating my own chess AI. I had decided at that point to write a Chinese Chess program since regular, western chess is basically a solved problem. Why not take a slight deviation in other words. I began it as a personal project through college and eventually turned it into my team’s senior project for a BS in computer science. I spent a lot of time reading the research of others (a lot of people call this ‘research’ but real research isn’t just using google to learn new stuff but to lay out completely new track) and then leveraging it to create my own AI. I succeeded even if the AI was always rather weak.
I spent some time after college working on it. I thought I was going to make a complete set of tools for Chinese Chess players to use to play and analyze games. At some point I sort of lost interest. Others tried to leverage my work at this point and I feel a bit sorry for them :p I left it in a very bad state and its very out of date in its dependencies. That work can be found here. I have a decade of professional software development experience since then.
This time I am going to write a western chess AI, at least to start. We are going to pretend that we are responding to requirements from a customer or a boss. This is still going to represent a rather utopian view of the career you may be entering into, since working on what we call “green field” code is pretty uncommon. After some time though the project should begin to gain some legacy weight that will have to be resolved as our “customer” comes up with new requirements and feature requests.
One issue we’re not likely to run into though is a large blob of legacy code that has no unit tests–I’m going to start using them right away. Honestly I don’t have a firm grasp on how many firms out there use unit tests to begin with. In my experience its not many, firms that use C++ tend to be working with large legacy code bases that have existed before a lot of the important agile methods were really well known. Things like automated unit tests, continuous integration, etc… are often not in active use. Often the company will be in an extended effort to become “agile”, and there will be a whole massive mess surrounding that. I’m not even going to get into that bit with this project–maybe I’ll address some of those issues in off-category posts (this isn’t the only thing I’ll blog about here).
We’ll see where it takes us. One big issue in this career is the massive weight of personal ignorance. We like to think we can anticipate the future but eventually we learn we just can’t. Software engineering then becomes not the well thought out process of planning something out and implementing it, but in constantly struggling to respond to completely unanticipated requests from customers and business people with their new, brilliant ideas. Nobody knows how to do this, myself included, so I’m just going to try working through the process and writing it down as I go.
With that in mind, our customer has asked us to create a program that will play chess with a human opponent. They think this is great and new and they’re awesome for coming up with this great plan. This is all the information they’ve given us. Our first task is to do a bit of googling and to set up a new project. The latter is going to be what the next entry in this category will be about.