Last week we enjoyed having Max Steele here for a week of work experience. Max is a 6th form student, currently studying for his A-levels and hoping to pursue a career in Computer science. Before his time here Max had never done any coding so we thought we would throw him in at the deep end and set him the task of programming a Blackjack game in F#. It was very interesting to teach someone about functional programming from the ground up without them having written an imperative program before. In fact this lack of knowledge might actually have helped, as he was not tempted to fill the code with for loops etc! Here is what Max has to say about his experience in Cambridge.
This week I have been here in The Applied Games Group on work experience over my summer vacation from school. I have currently just completed an AS-level year in Further Mathematics, Philosophy and Economics and intend to apply to university in the coming months for something along the lines of a Maths and Computer Science course.
When I came into the Group I was put under David Stern’s wing, with no prior experience to any sort of programming whatsoever. I was very keen to learn about programming and gain a better understanding of how computers work on the whole. Unfortunately there was no other option other than to be thrown straight into the deep end with a book called ‘Expert F#’, a book that definitely is not for someone in my position. As I tried to read through sections like the introduction of this book and other articles on functional programming I slowly started to grasp loose concepts, despite sometimes understanding only a few words a sentence. Talking with Phillip about how the platforms of computers are compiled helped greatly and although I went home with an aching head each night I am sure a lot of this information clung on to something to recall on in the future.

Luckily, towards the end of my first day I was found an exercise by David to teach take me through some of the basic functions including arrays and lists as well. Progressing from this we decided to try to create a Blackjack game. The aim was to first create the most basic program where the player can play head on against a dealer with set rules to his gameplay. After more than two days full of work and new functions I finally was able to create the most simple of games allowing you to keep score against the dealer as you play. David is due a lot of credit for this work and I am very grateful for the hours of time he put in over the week to help me understand this completely new way of thinking. What was most exciting was to realise that I had learnt enough of this to think on my own and write new functions by myself. After creating the main structure as well as the user interface controlling the player with David, I was able to go on and create almost all of the dealer actions by myself. All of what seemed like unbearable slow progress in learning this code earlier in the week really came together and gave me a great feeling of accomplishment at this point.
As for the future, I am really glad I have been able to enjoy the experience of this week and will definitely continue on with this work in the future at home to create a complete Blackjack game where all actions like “split” and “double down” will be possible. I would lastly like to thank everyone for their help and friendliness both in and outside of work this week and hope that I may meet some of you again one day if I end up in a similar line of work. Enjoy the game! - Max
I have attached Max's code to this post - have fun!
- David Stern
Following the publication of the F# source code for the TrueSkill Through Time paper, we have used the same inference library code to demonstrate how the original TrueSkill algorithm can be coded. In the attached source code, only the program.fs file is different to the TrueSkill through Time blog post and it builds up the factor graph for an arbitrary N-player game with an arbitrary draw probability. Both these numbers can be entered on the command line when running the resulting sample. We tried to make sure to stay as close as possible to the description on page 3 of the TrueSkill technical report.
The attached ZIP file contains the entire source code which should compile without problems with F# 1.9.3.14. You can either load the solution in Visual Studio 2008 or simply run build.bat form the command line - in either case you will end up with a trueskill.exe program.
Update: Following the release of the F# September 2008 CTP we have updated the source code to work with F# 1.9.6.2. Also, we added one of the new features of F#, namely units-of-measure, which makes the TrueSkill update invocation calls now read as follows:
let priorMu = 25.0<SkillPoints>
let priorSigma = priorMu / 3.0
let priorSkills = Array.init noPlayers (fun i -> Gaussian.Create (priorMu, priorSigma))
let (posteriorSkills, logZ) =
NPlayerTrueSkillUpdate (0.5*priorSigma, 0.01*priorSigma, drawProb / 100.0) priorSkills
Note that one can no longer accidentally pass the variance instead of the standard deviation because the former being of type float<SkillPoints^2>. Try yourself!
Update 2: We had some feedback from Andrew Kennedy that we exploited a current "bug" in the units-of-measure code where literals (such as 1.0) can have generic units. We removed the incorrect usages and re-posted the ZIP file.
Update 3: We extended the example to work with draws. Thanks to Chih-Jen Lin for the suggestion!
Ralf Herbrich & Thore Graepel
Popfly has a great Alpha that lets you create a game in your browser, no programming required, and then easily embed it on your own site.
The following is one of the sample games - Space Boy:
You can read more on Somasegar's WebLog: PopFly Game Creator. It looks like Silverlight is going to be a very interesting platform for games.
Phil
Today Ralf & I were looking at ways to bundle up a bunch of .Net assemblies into a single assembly for use within our group; the goal to expose only the functionality we want and only need to reference one assembly in our projects. Enter command line app ILMerge by Michael Barnett of Microsoft Research which lets you merge a set of dlls into a single assembly and selectively hide functionality by changing public access modifiers to internal. The first assembly you specify on the command line is the primary one and it's types maintain their access modifiers, the subsequent assembles are the ones that can be hidden by using ILMerge's ExcludeFile parameter where you can specify a file which in turn contains a list of regular expressions for the types you would like to keep public. When you merge the assemblies if you have also written XML code documentation files these get merged too, so you even get to keep the intellisense tooltips on the classes and functions you have documented with /// comments. For C# projects you can specify XML documentation output in the project's Visual Studio build properties, and for F# projects you can use the command line -doc filename option. To quickly check if we were getting the desired results in our target assembly we used the ILdasm tool to walk through our types. While checking the output we noticed that by default in the current F#, triple slash XML comments get embedded in the assembly for use in Visual Studio for tooltips; but if you are already generating seperate XML documentation it is possible to turn off this feature with the --no-interface-data command line option. So in summary ILMerge appears to be a great, highly customisable tool that lets you distribute a single assembly exposing just the functionality you want to expose (just like linking good old .Lib files in C++ :)).
Phil
Its been yet another wet and windy bank holiday weekend here in the UK, so I decided to involve the family and create a video Blackjack called BabyJack, despite the baby's name being Sean not Jack :). Just press the Play button below to pit your wits against the baby...
For those of you interested in how it was done; the video was shot on a simple digital camera, and then sepia and film age effects were applied in Vista's Movie Maker, with sound generated by my eldest son Thomas playing piano in the background. The stills were created using Microsoft Paint and the Chiller font. The video itself was embedded in the page using the Windows Media Player Control; and the interaction was coded in Javascript using trusty Notepad.
Phil Trelford
While travelling to Microsoft HQ in Redmond earlier in the year for the annual TechFest event - for some fun I decided to have a go at writing a small retro game in F# using XNA 2.0, and attached are the results. When moving over to Pacific time I usually find myself waking up at 4am for the first few days, leaving me with plenty of wide awake hours I wouldn't normally have to while away, and this is when the sample was born. I decided on an implementation of Lunar Lander basically because it is pretty simple both logically and graphically, and at the same time fun and achievable in a relatively short time. The sample lets you play with a game pad or keyboard ('Z' and 'X' to rotate, Space to thrust), and to complete the game you must land on the long flat section before you run out of fuel and hit the jagged terrain.

For those interested, the source is attached to this post, which comprises a Visual Studio 2005 solution, a C# XNA 2.0 shell project to take advantage of the content pipeline for audio, an F# game implementation project and a small utility project to create terrain vectors from points in an image file. Please feel free to download and play with it, in theory if you have XNA 2.0 and F# installed then you should be able to just load the solution and press F5 to build and run.
Phillip Trelford
We have recently come accross Jeff Keegan's solution to being obsessed with Halo 3's Forge mode, but stuck at work without an Xbox:
The LEGO Halo 3 Foundry Forge Kit! (LH3FFK)

We loved the idea, and asked Jeff to tell us the story. Here it is in Jeff's very own words:
"Halo 3 has a feature that lets you modify existing maps, but it's limited in that it only lets you place/move/remove objects - you can't change the terrain. That limitation changed slightly when Bungie gave us the Halo 3 map "Foundry", a large warehouse where virtually every object in the room is removable, and the terrain is basically a big empty box. With Foundry, they essentially threw down the gauntlet and said "Here's a blank slate - go have fun and create something cool". Many of us have risen to the occasion, pouring hours upon hours into the art of placing virtual shipping containers, bridges, staircases, crates, and wire fences in that big empty box, all to create that one perfect sandbox to play in.
One day, while talking about some map ideas with my friend Aron at work, we found ourselves drawing whiteboard illustrations just to convey the ideas that were coming to mind. Someone had already created a PDF file showing a top-down view of the empty warehouse (and a bunch of paper cutouts of containers that were to scale), but that crude tool only allowed you to create these very two-dimensional maps, hugging the ground. Looking at the Lego constructions on my desk, Aron said what I'd already been thinking for a while - someone should do this with Lego bricks. A few days later I had the entire design modeled in Lego Digital Designer - my Lego Halo 3 Foundry Forge Kit (LH3FFK). Before clicking the check-price button to see how much the actual pieces would cost, I wondered to myself how much I could stomach.. I imagined the best case scenario: that 20 years from now I'd fondly remember that cool Halo Lego map thing I did back in '08, that I'd create a bunch of incredible maps we play every Thursday, that I'd have fun building and using it, and that at least a few people said they thought it was cool. How much would I pay for that? I thought, maaaaybe, at the most, umm.. ehh.. $300? I cringed at the amount, amazed that I'd let myself go that high. I clicked the button and saw $380. Doh!
After one initial scaled-down purchase ($80), a cost saving trip to the local Lego store, some more self convincing, a final big purchase from Lego's Pick-a-Brick website, and more than 30 days of waiting for overseas shipping, I now have my kit. It took two days to sort out all of the Lego pieces and build the LH3FFK pieces. It's incredibly satisfying designing levels by hand; Forge is great (and also satisfying), but actually holding the blocks and manipulating them just feels different. My favorite part about this whole exercise? When I was a kid, every time I built a Lego building or maze, I'd think "Man, I wish we could shrink ourselves down to that size and run around in there, climb this, jump off of that, and crawl through this". Now, I can! Well worth the price of ten pounds of acrylonitrile butadiene styrene.
Now if only I could keep my daughters from turning my Big Arena map into a Lego tea party."
We love Jeff's passion! Here are two more (clickable) screenshots:


Joaquin Quiñonero Candela
In December 2007, we published a paper about the application of TrueSkill to all recorded data of professional and semi-professional Chess play from 1850 to 2006. The dataset can be obtained from ChessBase. We are very happy to be able to release the F# source code that performed all these massive computations. A few things to bear in mind when running this code:
- The full factor graph has ~30,000,000 factors and ~25,000,000 variables. At this size, the analysis is among the largest applications of (approximate) Bayesian inference to date. Nevertheless, the full message passing schedule allocates no more than 11 GB of memory and is run in under 20 minutes on an Intel Pentium 4 processor. These numbers hold for the adaptive draw margin model run on 3.5 million games.
- Due to the huge amount of results (>1,200,000 skills of all players in all their active years) we use SQL server to store the result set. Please let us know if you think a purely text based result output is needed and we will add it.
- There is a very interesting, related paper by Prof. Mark Glickman which analyses subset of this data (88 top players of all time).
The attached ZIP file contains the entire source code which should compile without problems with F# 1.9.3.14. You can either load the solution in Visual Studio 2008 or simply run build.bat form the command line - in either case you will end up with a chessanalysis.exe program or an analysis.exe program. If you want to try out the application, we included the first 1,000 lines of match outcomes (this is part of the first 5 years of data we have).
As for running the code, here are the parameter switches of the command line application:
-no-safe Does not save results predictions (default: off)
-q Verbosity level off; only works on single runs (default: on)
-N <int> First N games only (default: ALL)
-delta <float> Maximum deviation in any marginal for convergence (default: 0.01)
-muS <float> Mean of prior skill belief (default: 1200)
-sigmaS <float> Standard deviation of prior skill belief (default: 400)
-muD <float> Mean of prior draw margin belief (default: 300)
-sigmaD <float> Standard deviation of prior draw margin belief (default: 100)
-beta <float> Standard deviation of performance distr. (default: 600)
-tauS <float> Standard deviation of skill dynamics distr. (default: 40)
-tauD <float> Standard deviation of draw margin dynamics distr. (default: 10)
-server <string> SQL server name for output (default: 'camresapga01')
-prefix <string> Table name prefix for output (default: 'Result')
-db <string> Name of the database for output (default: 'ChessBase')
-mf Fixed draw margin (default)
-mf2 Fixed draw margin with two factors for draw
-maf Fixed draw margin with ADF (iterate per year)
-maf2 Fixed draw margin with pure ADF
-mv Variable draw margin
-as Single run (default)
-am Model selection
So, a good first test is analysis.exe -no-safe SmallChessBase.csv.
We are very interested to hear your feedback - both on the model, our paper and the F# code.
Update: Following the release of the F# September 2008 CTP we have updated the source code to work with F# 1.9.6.2. Also, we added one of the new features of F#, namely units-of-measure. Note that one can no longer accidentally pass the variance instead of the standard deviation beceause the former being of type float<ELOPoints^2>. We have also added full debug support so simply press F5 to experiment with the -no-safe SmallChessBase.csv option mentioned above.
Update: We removed a reduant schedule creation in the function FixedDrawMarginADFAnalyse. Thanks to Henry (Xinhua) Zhang for pointing out this mistake!
Ralf Herbrich & Thore Graepel
Erroll Wood visited Microsoft Research Cambridge as an Arkwright scholar, and chatted to the Applied Games Group on Monday 11 of February 2008. Before handing in the mike to Erroll, let us link to some of the games he has written:
Now, here's the story of the Arkwright scholarship in Erroll's own words
In my GCSE year I took a paper and an interview for an Arkwright scholarship – a Design & Technology sponsorship scheme aimed to stimulate young people to raise the profile of the Design & Technology subject. Those who are accepted into the scheme are given £500 over 2 years to spend in the academic field and many more opportunities. Their school also receives £500 over two years to buy equipment. A few months after the interview I was pleasantly surprised to find out I’d secured a place with Microsoft Research Cambridge with its MD Andrew Herbert as my sponsor but I was most pleased to be given the chance to spend a few days in MSRC – a valuable experience.
I found the whole branch very impressive and the people working there really seemed to enjoy what they were doing. I was given a tour round plenty of different projects and it was interesting and exciting to get a peek at what might end up in big profile products in the near future. I also got a few days to work with the Computational Biology team helping them finish off a website though I did spend a lot of time just chatting and getting to know the team which was great.
This is a games blog I understand and I guess one of the reasons MSRC chose to sponsor me was my expressed interest in programming and games. As a hobby and to make some pocket money on the side I design and program games in flash to be played through web browsers. I’ve always enjoyed playing games and it’s a real pleasure to be able to make them as well so others can experience what you’ve created for them. It is a time consuming process however and I wish I was able to make more of them more often, but as it is I can only get them out during holidays when I’ve got more free time it seems.
To recap, thanks to all the guys who made my stay at MSRC so enjoyable and I wish everyone all the best!
Erroll
I very much enjoyed talking to Erroll, and got addicted to Turret Defence 2.
Joaquin Quiñonero Candela

ArmoredBlitz, a first person tank shooter and a real-time strategy game all in one, was selected as one of the five winners of the Silicon Minds contest. Its creator, Jacob Liechty is a freshman at Purdue University studying Computer Science. Jacob also devotes much of his time apart from his studies to video game and graphical programming, spending the month leading up to contest deadline creating ArmoredBlitz and its assets from the ground up using XNA and C#.
I called Jacob to deliver the good news on Sunday, February 3rd. He was very happy, and so was I. Rise. Then I spoke the obligatory words of caution: we needed to check eligibility. Eligibility? Yes, things like making sure that the contestant resides in an eligible country - the US is eligible, so no problem here - and that no close family member works for Microsoft. Panic. You mean, like my brother? What do you mean your brother? My brother, Adam Liechty is a developer at Microsoft! Demise.
Well... you could... fire my brother? Just kidding, I'll try not to stress out :)
-Jacob
Dura lex sed lex. The Law is hard, but (hey) it's the law. There is no way on earth the fact that Adam works for Microsoft could have given Jacob an advantage. Yet, just to make sure there is not the shadow of a doubt, the rules need to be this hard.
So we're putting this blog post together to honour Jacob's efforts, and the fact that it was the Law that killed his game. We are researchers: we loved it and had selected it as a winner.
Joaquin Quiñonero Candela, Microsoft Research Cambridge
Here is a photo of Jacob:
And here are some links:
· Silicon Minds contest: www.dreambuildplay.com
· YouTube video: http://www.youtube.com/watch?v=Io6gBC8lnw4
This post tries to explore exception handling in F# with custom exception types.
Some background on .Net exceptions
- Exceptions happen: "Programs must be able to uniformly handle errors that occur during execution. The common language runtime greatly assists the design of fault-tolerant software by providing a model for notifying programs of errors in a uniform way. All .NET Framework operations indicate failure by throwing exceptions." - .NET Framework Developer's Guide: Handling and Throwing Exceptions.
- Deal with them: "To build successful and flexible applications that can be maintained and supported easily, you must adopt an appropriate strategy for exception management. You must design your system to ensure that it is capable of the following:
- Detecting exceptions.
- Logging and reporting information.
- Generating events that can be monitored externally to assist system operation."
- Microsoft patterns & practices: Exception Management Architecture Guide.
- But: "Do not rely on exceptions in your code. Exceptions can cause performance to suffer significantly, so you should avoid using them as a way to control normal program flow. If it is possible to detect in code a condition that would cause an exception, do so rather than catching the exception itself and handling the condition." - Microsoft TechNet: Developing High-Performance ASP.NET Applications.
- And: "In most cases, use the predefined exceptions types. Define new exception types only for programmatic scenarios. Introduce a new exception class to enable a programmer to take a different action in code based on the exception class." - .Net Framework Developers Guide - Best Practices for Handling Exceptions.
Quick guide to F# exception handling keywords
| F# |
C# equivalent |
Description |
| raise exception |
throw exception; |
Throws the specified exception. |
| rethrow () |
throw; |
Rethrows the current exception unchanged from a catch block. |
| try ... with |
try-catch |
Filters exceptions. |
| try ... finally |
try-finally |
Guarantees execution of specified final block. |
| failwith string |
|
Throws a Failure exception with the specified string. |
F#'s predifined library exceptions
| Exception |
Usage |
Description |
| Failure of string |
failwith "Bang!" |
General failure. |
| InvalidArgument of string |
invalid_arg "arg1" |
Invalid argument exception. |
| exn |
raise (new exn("Bang!")) |
System.Exception type abbreviation. |
Filtering Failures
Exceptions are caught/filtered using pattern matching and a Failure exception can be matched like a discriminated union type:
try failwith "Too many errors"
with | Failure s -> printf "%s" sOutputs: "Too many errors"
Some reusable System.Exception based classes
Frequently it is possible to simply reuse existing exception classes in your code:
Custom F# exceptions
In some cases we have a pragmatic reason to introduce our own custom exceptions, for example if we define our own data layer we may want to have an exception type for this layer. In the same way the .Net framework defines the SqlException class for SQL specific exceptions. F# Custom exceptions provide an extremely concise form definition like discriminated unions which makes them simarly easy to pattern match against:
- Defining a custom F# exception
exception AppException of string
-
Raising a custom F# exception
raise (AppException "Bang!")
-
Catching a custom F# exception
try raise (AppException "Bang!") with | AppException s -> printf "%s" s
Outputs: "Bang!"
-
Reading the Message property value of a custom F# exception try raise (AppException "Bang!") with | e -> printf "%s" e.Message
Outputs: "Exn+AppException[System.String]..."
So this all seems to make F# custom exceptions great for F# projects which are self-contained or which have F# projects as final consumers. However F# custom exceptions current concise construction syntax does not allow us to pass the values for the Message and InnerException properties to the underlying System.Exception. It is possible to override the System.Exception.Message property but then again we lose a lot of our original conciseness. So I think this means then that F# custom exceptions are probably not suitable if you are going to be throwing an exception out of your F# project to say a C# project or to a vanilla exception logging mechanism.
An Alternative - custom exceptions using plain old inheritance
You will see below custom exceptions using inheritance are also pretty concise for definition and for pattern matching and also allow you to easily initialize the System.Exception's Message and InnerException properties. Here we make good use of F#'s constructed classes, optional parameters and inheritance facilities:
- Defining an F# custom exception using inheritance
type VanillaException (message:string, ?innerException:exn) =
inherit ApplicationException (message,
match innerException with | Some(ex) -> ex | _ -> null)
- Pattern matching exception types in F#
try raise (new VanillaException("Vanilla!"))
with
| Failure s -> printf "%s" s
| :? VanillaException as e -> printf "%s" e.Message
| e -> e.MessageOutputs: "Vanilla!"
So it appears then that this approach is more suited to F# originated frameworks and libraries that expose exceptions to other languages and/or logging frameworks. Finally I would recommend that in this case that you catch any F# custom exceptions at the application boundary including Failure exceptions and rethrow them as vanilla .Net exceptions.
Phil Trelford
Further reading check out: Expert F# Chapter 4 Introducing Imperative Programming.
On the 8th December 2007 the Silicon Minds challenge was launched at the Machine Learning and Games workshop of the NIPS conference in the picturesque Canadian ski resort of Whistler.
The contest is to be judged on 3 criteria:
- Game A.I. (60%) – Game A.I. will be evaluated based on how it serves the game design, and how it contributes to the game experience. Novelty and originality of the AI is appreciated but not required: a novel use of an existing state-of-the AI method is in itself considered to be innovative. General applicability of the AI concepts/techniques is also valued.
- Fun Factor (20%) – The fun factor will be evaluated based on how the game design creates a positive user experience. This may include how intellectually challenging, relaxing, stimulating or satisfying the game is. A key indicator for the fun factor will be the desire to keep playing.
- Production Quality (20%) – Make your game world as polished as possible and hook your judges with exciting, entertaining action. Production quality will be evaluated based on how seamless the overall game play is, the quality of the assets used, and the structure, readability and level of documentation of the code.
The submission must include the following:
-
Your finished game in .ccgame XNA Creators Club Game Package form.
-
The source code and content of your game.
-
A design summary.
-
Three screenshots of your finished game.
To this end over the last week we have been having fun creating a mini-sample submission attached based on the board game Go demonstrating:
-
Using Monte Carlo methods to score the board - thanks to David Stern.
-
Some well documented source - thanks to Ralf Herbrich.
-
A sample design summary - thanks to Thore Graepel.
-
Disclaimer: The mini-game sample itself actually uses a rule based AI and should not be seen as an example of AI or game quality - more a sample of documentation quality and the submission files required.
What we do hope is that you will find the sample a useful reference on how to document your code (specifically the XGoLibrary project), how to comment code you have taken from other sources and how to write the design summary.
On coding standards, if you are starting afresh for the competition we suggest you take a look at the MSDN section ".Net Framework General Reference - Design Guidelines for Class Library Developers" for guidance. In summary this is what we would like to see in the code:
Don't forget though 60% of the score is based on Game AI... hope you enjoy the contest - we are really looking forward to seeing your submitted games.
Last but not least a quick special thanks to Joaquin Quiñonero Candela for working so hard organising the challenge.
Update 1: We have noticed that the PDF still had some review comments; they are removed now. Also, rendering during the scoring was accidently reset to constant black (rather than an alpha value proportional to the expected propability of the territory outcome). Finally, we slightly refined the passing algorithm of the AI: If the human player passes then the AI uses the Monte Carlo scorer to estimate whether or not each piece is already determined in colour up to a probability of at least 80%. If so, the AI passes already.
Update 2: We have noticed a couple of further bugs and easy improvements that can be made: The rule-based AI would start to fill in own eyes if the eye is either on the side of the board or in one of the four corners. This was not intended and has been fixe now. Also, the Monte Carlo sampling can be sped up significantly by only checking for move validity and "eye-ness" after a random move from the list of empty vertices has been determined. Checking a vertex for being empty is a lot faster than checking if a move is valid on that vertex.
At the beginning of this month (October) I attended and presented at the CUFP event in Freiburg, Germany. The talk was on some of the work our group has been doing over the last year using F# including the XBox 360 title Halo 3 and on predicting ad clicks for Windows Live. The slides (thanks Ralf) are now available online and for those who couldn't make it videos of all the talks are expected soon. There were plenty of interesting talks throughout the day, including Chris Waterson of Liveops "... using continuation passing monads to encapsulate computation state and hide the complexity of the non-blocking I/O layer" with OCaml, which seemed to be in a similar direction to F# asynchronous workflows. The day ended with a discussion led by Don Syme on the subject of hiring functional programmers; where it emerged that the remaining attendees were actively seeking over 40 new hires. Finally it was time to enjoy the remainder of a hot sunny day and some quality German beer.
Phil
This week it was my opportunity to present a topic for 15 minutes at the MLP group's ritual Tuesday afternoon tea and cakes session (yes - we are based in the UK). I thought it might be fun to knock up a little game with the Microsoft functional programming language F#. With only a few hours to spare at the weekend I decided to go with a retro style game and an old favourite of mine - the light cycle game sequence featured in the 80s movie Tron. So after about 4 hours I had a 2 player game in Windows Forms with optional support for XBox 360 controllers with managed DirectX all in under 200 lines of F#; and come tea time I even had some players. If you fancy having a go yourself the code can be viewed on the F# Wiki.

Have fun,
Phil
Last week we had James Budnik over for a “work experience week”: a nice opportunity for British high school students to get a feel for what it is like to sit in an office all day and a way to gather some extra data to make an informed study career decision. It was good fun to have him over and to see him work on his first ever computer program.
It brought back memories of my first coding experience on my old TI 99/4A, with a squeaking tape recorder, a black and white TV, and an elementary form of basic. We have come a long way since then. James could start with a slick laptop fitted with a silent hard disk, a high-res colour screen and F# instead of basic!
Here is what he wrote himself about the experience. --Onno
My name is James Budnik and I have just completed a week’s work experience from the 25th to the 29th of June here at the Applied Games Group. As the end of term drew near for me after the completion of my AS examinations I had the opportunity to apply for work experience. Instead of applying to any old local company I decided I would look for a placement further a field that would allow me to see where subject choices may lead me. I am personally very interested in Computer Science and I am taking the A levels with an aim to study it at university. After a great deal of searching I discovered Microsoft Research’s website, whose combination of exciting cutting edge technology and obvious relevance to Computer Science was exactly what I was looking for. I was lucky enough to get a place (thanks to Mel Digny for her help with that), at the Applied Games Group, at the envy of many of my classmates.
For the duration of my time here I was with Phil, Onno and Lukasz who I had the chance to talk with over the course of the five days, giving me an insight into what they do. This was useful as it let me see a whole range of roles within the department: Phil as a developer, Onno as a researcher and Lukasz as an intern, which has helped me think about what kind of path I would like to take. It was also pleasing for me to see how enthusiastic many members of this department were about what they do. After some discussion of what I would like to accomplish during my time here it was decided I would look at programming in the F# language. This was the first time I have encountered programming which I found both challenging and rewarding. I began with a few introductory tasks but eventually I was given a project to write a game of Tic Tac Toe in the new language I had learned. Through a great deal of trial and error and extensive help from members of the Applied Games Group I have managed to complete this objective. It’s very satisfying to see something you have programmed come to life, as I’m sure many of you reading this have experienced firsthand a great deal more than I have.
I am very grateful to Phil, Onno and Lukasz whose time, help and enthusiasm have made this both innovative and thoroughly enjoyable. I leave now even keener to pursue a career in Computer Science thanks to this experience and I hope to be fortunate enough to return here in the future, not as a student, but as employee.
James Budnik