On my absence

EDIT: Or not. Did well in exams but I’m still busy…

Although probably very few people have noticed, I have not been very active on this blog in the past few months. This has been deliberate.

Around this time of last year, I was working on the post for my 2048 clone, when I really should have been preparing for my second year exams. This ‘should’ became very evident in my exam results.

I made the decision to try to focus more on my studies in the third year, and am pleased to report (to whoever is listening) that I seem to be having a bit more success than in the past. I still have a bit of a way to go, so I will need to maintain e-silence.

However despair not, my countless readers, for I have many plans for things to write about this summer! Until then, I will return to my studies and leave you to yours.

needle: ASCII-fied arrow notation


Haskell programmers have access to so-called arrow notation for programming with arrows (i.e. generalised functions). It looks something like this:

{-# LANGUAGE Arrows #-}

f :: (Int, Int, Int) -> (Int, Int, Int, Int)
f = proc (a,b,c) -> do
    d <- (+1) -< a
    e <- uncurry div -< (d,c)
    f <- negate -< e
    g <- (*2) -< b
    returnA -< (d,e,f,g)

To me this is not very satisfying. It doesn’t seem to convey the abstraction of data traveling through a network of machines particularly well, and it can be difficult to track the path of each variable through the network.

Read more

Tetris in Haskell with Netwire and GLFW


A few weeks ago, I found myself on a ten hour plane journey, with nothing much to do1. What better time, I thought to myself, than to hone my programming skills on a quick project? Why not a Tetris clone in Haskell? The fact that I was offline and so had no access to documentation only added to the challenge. I slid my laptop out of my bag, and got to work.

Read more

Dabbling in Computational Linguistics


About a month ago, /u/5outh posted an article called Modeling and Simulating Markov Chain Evolution in Haskell to /r/haskell. It’s an interesting read, and it has a fairly amusing conclusion — a twitter account called rapcandy that gives a single line of stochastic rap every day, using patterns drawn from the wisdom of Eminem.

Read more

Kachushi, an artificial intelligence for the game of Open Face Chinese Poker


A while ago my friends and I came upon Open Face Chinese1 Poker (OFC for short), a game that has gained some popularity in the last couple of years. It is not like most forms of poker — very few betting decisions are made, and bluffing is completely absent. The game almost feels closer to something like bridge. Players must focus on thinking analytically about the possible combinations of the cards left in the deck which could arise, and act accordingly.

The space of decisions to be made in OFC is both fairly small and easily defined — there are 232 possible choices on the first turn, and then at most a mere 3 for each of the next 7 turns, while the choice at the last turn is always predetermined. This relative simplicity made me think that a basic artificial intelligence would not be too difficult to implement and that doing such a thing would be both instructive and enjoyable.2

Thus Kachushi3, an artificial intelligence for OFC written in Haskell, was born.

Read more