Recently, I had to sit an exam which involved questions on/about the functional language Haskell (it was an Oxford start of term exam, also known as a collection, if you're interested). To revise the feel and syntax of Haskell, I decided to write a minimal interpreter for my favourite esoteric language, Brainfsck, in Haskell.
Writing such an interpreter in C/C++ is fairly trivial, with the only slight difficulty being providing an array which is infinitely long in both directions. As Haskell is a functional language (function in the mathematical sense, rather than the sub-procedure sense), providing an infinitely long array is extremely simple, and it is everything else which is non-trivial. The code ends up making heavy use of monadic I/O (ironically, monadic I/O isn't really covered in the course syllabus beyond "you can construct a string and then pass it to putStr to write stuff"), and looks very different to how you'd implement it in C/C++:
Today marks the release of the first playable beta of CorsixTH, an open source Theme Hospital clone which I started a few months ago.
Relevant links: CorsixTH Homepage | Downloads | Release Annoucement.
It's been a while since since my first blog post on Theme Hospital, and there has been a reasonable amount of development since then, so I thought I'd post a video showing some of the new stuff:
As before, if you're interested in grabbing a copy, or contributing, then see the Google Code project.
Observe my wonderful Lua ASCII art creation:
_={_=_G
}for--[[--]]__
in(next),_["_"]do
(_)[_]=(__)_[#_[_]]
=_[_]_[_]="sub"end(_)
[_]=_[_] [_[_]]_[_._]=#"_._"_[
_[_._]]=_[_](_[_[_._]*_ [_._]],_[_._],_[_._
]).._[_](_[(_[_._]+_[_._]/_[_._ ])*_[_._]],_[_._]/
_[_._]+_[_._]/_[_._],_[_._]).._[_](_[_ [_._]*_[_._]],_
[_._]+_[_._]-_[_._]/_[_._],_[_._]+_[_._]-_[ _._]/_[_._]
).._[_](_[_[_._]*_[_._]],_[_._],_[_._]).._[_](_[ _
[_._]*_[_._]],_[_._]/_[_._]-_[_._] ,_[_._
]/_[_._]-_[_._])_[_[_._]*_[_._]+_ [_._]-
_[_._]/_[_._]]=(_)_[_[_._]*_[_._]+ _[_._
]+_[_._]/_[_._]]=(_)_[#_+_[_._]/_[ _._]]
=_._[_[#_-_[_._]-#_/#_]]_[_[#_]]=_[ #_](_[
_[_._]].."(".._[#_-#_/_[_._]].."('" .._[_[_
._]]..[[("\\'..(...+#_*(_[_._]+_[_._] ))..'")')
)()]])_[_[#_]]=_[_[_._]][_[_[#_]](_[_. _]*_[_._])
.._[_[#_]](#_-_[_._]/_[_._]).._[_[#_]](_ [_._]+_[_._]
+_[_._]/_[_._]).._[_[#_]](_[_._]^_[_._]-_[_ ._])]_[_[_[#_]](
#_)]=#_*#_/_[_._]_[_[_[#_]](#_)]=_[_[_[#_]](#_)]+_[_[_[#_]](#_)]/_[(
_._)]_._[_[ _[#_]](_[_[_[#_]](#_)]+#_-_[_._],_[_[_[#_]](#_)]+#_-
#_/#_,_[_[_[ #_]](#_)]+#_/_[_._],_[_[_[#_]](#_)]+#_-#_/_[_._], _[
_[_[#_]](#_) ]+#_+#_/#_)](_[_[#_+_[_._]-_[_._]]](#_*#_/_[_._]-_[_.
_],_[_[_[#_] ](#_)]+_[_._] /_[_. _],_[ _ [_[#_]](#_)]+#_
/_[_._]+_[_. _],_[_[_[#_]]( #_)]+ #_/ _[_. _]+_[_._],_[_[
_[#_]](#_)] +#_-_[_._]-_[_ ._]/_ [_._ ],#_ +#_+_[_._]-_[
_._]/_[_._] ,#_*(_[_._]+_[ _._]) -_[_. _ ],_[_[_[#_]](
#_)]+#_-_[ _._]-_[_._ ]/_ [_._] ,_[_ [_[ #_]](#_)]+#_
-#_/#_,_[ _[_[#_]]( #_) ]+#_/ _[_ ._]+ _[_._],_[_[
_[#_]]( #_)],# _+#_ +# _ /# _ + #_/#_,_[_
[_[#_ ]](#_) ]+_ [_._ ]-_ [_._]/_[_
._],_[_[_[#_]](#_)]+#_-_[_._]/_[_._],(_[_._])^_[_._]*(_[
_._]+_[_._]/_[_._])+_[_._],_[_[_[#_]](#_)]+_[_._]*_[_
._],#_+#_+#_/#_+#_/#_,#_*#_/_[_._]+_[_[_[#_]](#_)]/
_[_[_[#_]](#_)],_[_[_[#_]](#_)]+#_+_[_[_[#_]](
#_)]/_[_[_[#_]](#_)]+_[_[_[#_]](#_)]/_[_[
_[#_]](#_)],_[_[_[#_]](#_)]-_[_._]))
_._=_[_[_._]][_[_[_[#_]](#_)]
]_[(#_)^#_-_[_._]]=
_._As a continuation of my Lua abomination series, the below code is surely one of the most indecipherable versions of "print 'Hello World'" that you're likely to see.
_={_=_G}for--[[]]__--[[]]in(next),_["_"]do(_)[_]=(__)_[#_[_]],_[_[_]:byte(-#"#"
)+#_[_]-(#{}+#"(#''"*#"*#*#*"*#"_[_[]]")]=_[_],_[_]end(_)[_]=_._[_[#""]]{[_._[_
[#""]]]=_}_[""]=_._[_._[_[#[=[=#=]=]*-((#[=[#[=]#]=]))]](_._[_[-#[[_[-#[#_[_]]]
](_))]_[";"]=_._[_[#"#"+(#")#^")^#"#^"]]_["'"]=[[sub]]_['"']=_[""][_["'"]]_["/"
]=[[/_)=.,[#"('*:^;+]]_["'"]=_[""][_['"'](_[-#[[=[=]=]]],-#",_",-#"..").._["'"]
]_["["]=_['"'](_[-#"#-]_"],#",",#{_}).._['"'](_[-#"-"],#",",#"#").._['"'](_[-(#
"^#^")^#"^#"],#"-",#"(").._['"'](_[#_[-#"#"]*-#"[#"],#_[-#"#"],#_[-#"#"]).._[''
..'"'](_[-#[[=[]=]]],#_["/"]/#_["/"],#"/").._['"'](_[-(#"#)-")^#[[""]]],-#"-,",
-#[=[[]]=])_["]"]=_['"'](_[-#_[-#"-"]],#",",#"#").._[";"](_["["]..[=[('\]=]..(#
'#).'*#',..]]'*#'",#"#",'-#'(').."')")().._['"'](_[-#_[-#"-"]],-#_[-#"-"]-#"-",
-#_[-#"-"])_['_']=_[";"](_["["]..'(_[""].'.._[";"](_["["]..[[('\]]..((#_["/"]+#
"'")*#"#*("*#"..").."')")().._['"'](_[#_[-#"_"]*#"[_"],-#"#-,",-#"(,").._['"'](
_[-#_["/"]],-#",",-#"(")..'(_["/"],...,#"#","")-#"#")')_[";"](_["'"](_["'"]([[]
#/#)[([;#.))."[,[:[:[+)/,#[+#)[:[.)))^)^#/#)[([;#.))."[,[:[:[+)/,#[+#)[:[.)))^]
]],"[^".._["/"].."]",""),"(.)(.)",_[";"]("_['.'],_['#']=...".._["["].."(_['']."
.._["]"].."(_['_'](...)*#_['/']+_['_'](_['#'])))")))(...)_={#{...},#{#{}},#"#"}(If you don't believe me, it does print Hello World).
I thought this wonderful little wordplay from the Lua mailing list deserved some more visiblity:
Person A: IMO python is by far the better language for "first programming language" than Lua.
Person B: If you're going to make an audacious assertion, please back it up with justification :)
Person C: Justification changes the syntax.
Unfortunately, you need to have a fair bit of knowledge on computer programming languages to appreciate it.
As of today (September 20th 2009), corsix.org has moved server. It used to be hosted over at www.ecwhost.com, who I was very happy with up until recently, whereas now it is hosted on its own virtual private server. While I was moving server, I also updated Drupal (the software which runs this site) to the latest available version.
Hopefully, you won't notice any visible differences from this change. If you do, then leave a comment or drop me email at corsix@corsix.org (or, if my new DNS servers are also failing to serve MX records, corsix@gmail.com).
For the past two months or so, one of my side projects has been writing an open source clone of Theme Hospital. I recall Theme Hospital as being one of the great classic games I had when I was younger, and it's sad to watch it slowly become harder and harder to play on modern operating systems, with modern hardware, and with modern conveniences (like 3-button mice, screen resolutions larger than 640x480, and so on). A game like Theme Hospital really deserves a decent open source clone, and so I thought I'd have a stab at making one.
You can find downloads, source code, an issue tracker, etc. over at Google Code if you're interested.
Recently I undertook a hunt for a certificate authority which would issue Windows Authenticate code signing certificates to private individuals. There are lots of certificate authorities which issue code signing certificates, but almost all of them only issue them to businesses / organisations. Despite that bleak outlook, I believe that I've found a CA which does issue code signing certificates to individuals: Trustwave SSL.
Unfortunately, their certificates come at the rather expensive price of ~200 GBP per year. This is a shame, as I can't really justify £200 per year for something which I don't strictly need. Had they been asking for something closer to GoDaddy's ~120 GBP per year, I might well have purchased one, but students can only stretch so far.
If you happen to be in the market for a Windows code signing certificate for an individual, then Trustwave might be able to help you. If you do try and get one, or find another CA which issues them to individuals, then let me know (via comments or email).
Regular readers may remember a post a few months ago about a nice email from Oxford University, which was a notification of a conditional offer of a place to study Mathematics and Computer Science at Keble College, Oxford.
Exactly one week ago, A level and AEA results were published in the UK. I needed 3 A grades in order to get into Oxford. Luckily, I managed to achieve that, and had some room to spare:
| Subject | My result | Highest result possible |
|---|---|---|
| Physics | A (582/600) | A (600/600) |
| Computing | A (552/600) | A (600/600) |
| Mathematics | A (576/600) | A (600/600) |
| Further Mathematics | A (522/600) | A (600/600) |
| AEA Mathematics | Distinction | Distinction |
I've got a few weeks remaining before term starts in October, and then I'll be in for one hell of a ride.
Recent comments
1 week 9 hours ago
1 week 5 days ago
1 week 5 days ago
1 week 5 days ago
3 weeks 3 days ago
4 weeks 3 days ago
4 weeks 4 days ago
6 weeks 3 days ago
6 weeks 3 days ago
8 weeks 1 day ago