Posts tagged fsharp

The North Pole Type Provider: Escape from Santa’s Grotto!

:: fsharp, xmas, type providers

This post is part of the F# advent calendar, which is filled with all sorts of other cool blog posts, be sure to check it out. Thanks to Sergey Tihon for organising!

It’s Christmas!

Happy Christmas everyone! I have the honour of the Christmas Day F# advent calendar post

Thanks Tomas, ha!. I had a whole bunch of different ideas, and typically, I decided to choose the largest, most complicated one. Because of this, there is a lotof code written in just a couple of evenings. It is for the most part, badly designed, horribly written, nowhere near finished and should not be used as an example on how to write anything approaching nice F# code! /disclaimer

2048 – Type Provider Edition

:: fsharp, type providers

I’m sure you would have all seen the highly addictive and annoying game 2048 by now (if not, follow the link and have a go now, don’t forget to come back here though! ). Fellow F#er @brandewinder wrote a bot that wins the game for you, subsequently turning it into an cool F# dojo. It is London’s turn for this dojo next Thursday, so I figured before then I would have a go myself and do the obvious thing which is to turn it into a type provider :)

2048 TP Edition is available as part of my type provider abstraction the Interactive Provider. You will want to set your tooltips to a fixed-width font for this to render for you properly. Here is a picture of it in action !

image

CRUD Operations and Experimental ODBC support in the SQLProvider

:: fsharp, sqlprovider, type providers

The SQL provider now supports basic transactional CRUD functionality and an ODBC provider. A new nuget package is up for you to grab here. As always, you can download and build from source here.

The nuget package is still pre-release. You can find it in Visual Studio by toggling the search filter to include pre-release packages. I'm sure Xamarin has a similar feature. Once this work has been tested well enough, I will likely upgrade the SQL Provider to a proper release.

BASIC’s 50th Anniversary … and more crazy F# type providers!

:: fsharp, type providers

Did you know that it is the 50th anniversary of the BASIC programming language today? (1st May) No? Well why not! BASIC is the language that brought computers to the mainstream. Back in the day, if you had a computer, you learnt how to program it in basic. Infact, when you switched it on, that’s what you were presented with. These computers wanted to be programmed. Thousands of people purchased these expensive computers purely to learn how to program them.

I figured I should do something to mark the anniversary. Many of you will already know about my various crazy type providers, including MineSweeper and Choose Your Own Adventrue. So, I thought to myself, wouldn’t it be great if we could write some equivalents of the very early BASIC games via a re-usable and extensible type provider? One which doesn’t require you to write any type-providing code, but is abstracted away from all that …

Solving Puzzle Quest with F# Part 1

:: fsharp

Tomas Petricek posted an article recently about how he used F# to solve a puzzle he had been given for Christmas. This reminded me of several similar mini-projects I have developed in the past, the most recent being a program to help solve a specific sort of puzzle in the game Puzzle Quest, which I shall now describe.

Puzzle Quest is a match-3 game, with various game modes. One game mode in particular, “Capture”, has a specific layout of tiles which can be matched in a certain way to leave no tiles behind at the end. Some of these are really quite tricky, and I thought it would be fun to write a program to solve them. Here is a example of a puzzle:

The Don Syme type provider

:: fsharp, type providers

Someone asked me what the secret type provider I am working on is.  I neglected to tell them, and instead joked that it would be the Don Syme type provider.  Later I reflected that the idea had actually been a stroke of genius, so just knocked this together in 20 of your English minutes – the Don Syme fact provider!  It will produce an endless stream of true facts about the mystery man known as the Father of F#.  Get it from my github here.

image

 image

image