• "In this way, Dynamic Yield is part of a generation of companies whose core technology, while extremely useful, is powered by artificial intelligence that is roughly as good as a 24-year-old analyst at Goldman Sachs with a big dataset and a few lines of Adderall."

    This is good – and largely well written, bar an unnecessary cheap shot at one point. It overlaps with lots of what I have to teach students about AI: namely, those letter have become this huge suitcase concept for anything from gnarly machine learning problems and recurrent neural networks down to applied statistics and a splash of arithmetic. And meanwhile, everyone just keeps adding to this cyclone of nonsense as they try to out-claim one another. It's exhausting, and it pollutes the public sphere, such that inexperts – politicians, policymakers – get themselves tangled up about all the wrong things. Sigh.

  • "From 1950 to 1990, Tinsley had been the world champion of checkers whenever he wanted to be. He’d occasionally retire to work on mathematics or devote himself to religious study, but he’d eventually return, beat everyone and become champion again. In that 40-year span, he lost five total games and never once dropped a match." Brilliant article from Alexis Madrigal on the race to solve draughts/checkers, one man and his computer, and another man and his faith.
  • "Since I got my iPhone 4S, I’ve been intrigued, fascinated and alarmed by Siri’s fast-growing capabilities. I thought it would make sense to introduce her to my psychotherapist, Eliza." Now I think about it, surprised it's taken someone so long to do this (considering all the other Siri 'gags' floating around).
  • "Someone at work recently asked how he should go about studying machine learning on his own. So I’m putting together a little guide." Ooh, useful. Lots of starting points for machine learning in R.
  • "When you look at the dubstep scene you realize quickly that it’s a fairly young genre. Not in terms of its own existence as a named thing, but as a measure of the age of many of its prominent musicians. They’re of the generation that doesn’t know a world before the Nintendo Entertainment System and a lot of the music reflects that… If you had a giant Venn Diagram of dubstep and 8-bit chiptunes, you’d see a large overlap between the two. Why dubstep is particularly prone to this, more than other electronic styles, I don’t know. Maybe it has to do with its relatively lo-fi, home studio feel of the genre? … There’s a hidden, untold history there, but it’d be best told by someone that knows the genre, and its players, better than I do. In the meantime, I’ll continue enjoying it until it’s pillaged and destroyed for all its worth." Mike on the overlap between dubstep and chiptune culture.
  • "All artworks have been created using data from the game "Unreal Tournament". Each image represents about 30 mins of gameplay in which the computers AI plays against itself. There are 20-25 bots playing each game and they play custom maps which I create. Each map has been specially designed so that the AI bots have a rough idea of where to go in order to create the image I want. I log the position (X,Y,Z) of each bot, every second using a modification for the game, I also log the position of a death. I then run my own program written in Processing to create printable postscript files of that match."

As a little post-Christmas present, I thought I’d share a little code toy I’ve been working on recently.

You might know that I’m a fan of Twitter as a messaging bus, and I’ve already built some entertainingly daft bots in my time with it. Recently, I decided to flex my programming skills a bit and build not one but four bots. And, more specifically: four bots that talk to each other.

Enter @louis_l4d, @zoey_l4d, @bill_l4d and @francis_l4d. You might notice that they’re named for the characters in Left 4 Dead.

This is not a coincidence.

One of the most wonderful things in that game (which I’ve already commented on the brilliance of) is the banter between the four player characters. There’s so much dense, specific scripting, and enough dialogue so that it rarely repeats. I thought it would be interesting to see if you could simulate the four players’ dialogue over Twitter, sharing some state between the bots, but also finding a way to make them communicate a little with each other.

Well, a bit later, I worked out how, and this is the result:

twit4dead.jpg

You get the picture. They run a scenario, they bump into boss zombies, they find stuff, they get hurt (and help each other), they get scared (and reassure each other). At the moment, there are some dialogue overlaps; my main work at the moment is adding more unique dialogue for each bot. Bill is sounding pretty good, but the rest of them need work. It takes about 2-3 hours for them to run a scenario, and it’s usually fun to watch. (And, as you can see, it makes sense to follow all four of them).

So how does it work?

It turned out that rather than trying to build any real AI, it was much more fun just to simulate intelligence. The bots are state machines; they have a variety of states, which they transition in or out of dependent on factors, and suitable dialogue for each state.

I wrote the bots in Ruby. There are two main components to the twit4dead code: the Actor class and the Stage class. The Stage is a singleton; it’s where the state of the world is determined, and global variables tracked. It’s also where all the probabilities are run from. The Actor class is what each of the bots are, and it’s based on the Alter Ego state-machine library for Ruby. We have a lot of states, rules for transition, a selection of methods to handle being helped or talked to by friends, and a method to choose a random piece of dialogue appropriate to the current state.

All the bots are instantiated from a YAML file. For each bot, I store its Twitter username and password, and a nested tree of dialogue for each state. This means it’s really easy to add new states and maintain the dialogue for each bot. It’s also easy to add new bots – you just create a top-level entry in the YAML file.

Originally, I thought about the bots broadcasting and listening over Twitter, but the API calls were just going to get out of hand, and it turned out that Twitter didn’t like being bombarded with messages and would drop a few over time. So I separated out writing the script and broadcasting it. A small utility generates a script file; each line of this file consists of three delimited fields for username, password, and message to send to Twitter. Then, another program – which I currently run on a screened shell – reads that file and broadcasts one line of it every minute until it’s done.

And that’s it. I have to run it by hand for now, which is fine – it’s more something I fire up every now and then, rather than something you want to permanently run. I originally was going to keep track of loads of statistics – health, zombies in play, etc – but found a cruder set of rules worked much better. Every time they’re in combat, there’s a slim chance somebody gets hurt; every time somebody’s hurt, a friend will rush to save them. That sort of thing. Simulated Intelligence, then, rather than Artificial Intelligence.

Alter Ego turned out to be a lovely library; dead simple to use, and as a result the bots are really nicely modelled (or, at least, I’m very happy with how they’re modelled). The notion of a Stage with Actors, rather than a Game with Players, feels about right, and the modularity of it all is pretty nifty. It still requires a little refactoring, but the architecture is solid, and I’m proud of that.

I think my favourite aspect of it, though, is that at times, watching the bots play together is a little like magic. The first time I saw them talk to each other, cover each other whilst reloading, help each other up after a Boomer attacked, I felt a little (only a little, mind) like a proud father. They’re dumb as a sack of hammers, but they look convincing, and that was the real goal. It’s fun to watch them fight the horde amidst all my other friends on Twitter.

Nonsense, then, but a fun learning exercise about state machines, object orientation, and simulating conversations. State machines are a ton of fun and if you’ve not seriously played with them, I thoroughly recommend it.

Do follow the four of them, if you fancy; I’ll make sure I run them with reasonable regularity, and I’ll be fixing the dialogue over time. After all, I want to keep Francis happy.