2048 game with F# + WebSharper

Andras Janko

Andras Janko

Sep 16, 2014

Reading time:

1 mins

Share via:

This small logic game written in JavaScript+HTML5 has spawned quite a lot of variants. There is a site called Make Your Own 2048 where you can switch the original's numbers to any text or image and share your creation. However, modifying the game logic requires some programming knowledge and sometimes bigger rework of the original JavaScript code.

Try it live

My goal with an F#-based version was to have an easily overriden game rules class to enable writing a new variant in a few lines of code. In CloudSharper, you can write and play your variant right in your browser window. Clone this shared workspace and look for the file Variants.fs for editing. Build the project and open index.html and switch to Document/Split view for easiest testing, or use the Workspace/Deploy locally (Ctrl+D) menu option.

Clone in CloudSharper

Currently the grid size and the tiles' appearance can't be customized, but expect this demo to be expanded to show off more features coming to CloudSharper.

Read more from

Can’t find what you were looking for? Drop us a line.

Andras Janko
Found a typo?

This blog post is hosted on GitHub here. Feel free to file a ticket or send a PR.

Newsletter

We will not spam you or give your details to anyone.