The MineSweeper Type Provider

by Pezi 2. February 2014 05:06

Being able to play Mine Sweeper inside your IDE via intellisense, that is what you have always wanted right?  Well, I’m always willing to lend a hand!  With this fantastic new type provider you can pretend you are working when really you are avoiding mines.   To get started simply clone and build the provider from here.  Reference your new shiny type provider library from a script file and create a type alias and then an instance of it like so:

image

The three parameters you can pass determine the grid width, height and amount of mines.

Navigate to the “Start” property of your instance to begin the game. Intellisense will show a representation of the grid state on the top property marked “# Mine Field” and an additional property for each available move in the format of X:Y

image

To play the game simply navigate to the property that represents the tile you would like to reveal.

image

Unfortunately once again it seems that Microsoft simply didn’t have this kind of thing in mind when they were designing intellisense, and it isn’t very happy about making the text line up nicely.  I have tried my best for it to not get too difficult.

Disclaimer:  Development managers, I am not responsible for any loss of productivity from your staff  that this type provider may cause.

EDIT:  Props to Phil Trelford for the original minesweeper code from fssnip, which is largely intact here with a few modifications.

Tags:

F# | type providers

The amazing Squirrelify type provider

by Pezi 1. February 2014 01:26

Introducing my latest top-o-the-line type provider that everyone wants and needs. The Squirrelify provider!  This very useful type provider will create an INFINITE type system and show you random pictures of ASCII art in intellisense. 

It turns out that intellisense was not really designed for this and it struggles with various formatting and layout, but the provider tries the best it can. It also doesn't have many images as I couldn't find a webservice for them and had to do it manually.

"Wow Ross!" I hear you cry.  "How can we get started with this??"

It's easy! simply go and build the source from here, then reference the library it produces in a script file as shown in the picture below.  Once you have done that, you will need to alias a type and call create() on it. The resulting type will have an infinite series of properties named ``Squirrelify!``which will display said ASCII art.

Note that this is the LITE version of the type provider.  They PRO pay-for version includes a static parameter "keyword" which is used to search google images, convert said images to ASCII and display them.  

 edit - this is not just squirrels. You can expect other delights such as unicorns, snowmen, and various other things you will not be able to identify