Today we are going to write a bot using Clojure to beat the game 2048. We are going to use a variation of the minimax algorithm called expectimax.

1. game rules

You can merge tiles by merging the whole board either horizontally or vertically. If you manage to get the 2048 tile, you win. After a merge (= player's turn), a tile will appear randomly on an empty slot. The chance of that tile being a 4 is 0.1, the chance of it being a 2 is 0.9. After reaching the 2048 you can keep...

I'm happy to be able to share one of the building blocks of the software solution I'm currently working on: fsdb - a Clojure library that provides a reasonably convenient database on top of the file system.

Don't get me wrong, I'm not talking about a file system database like sqlite here. I'm using the term database loosly. Think of a bunch of config files that make up a database that you want to query. That's what fsdb can do for you. You point it to a directory and it reads the data from the directory tree and returns a...

  • clojure
  • opensource
  • clojure
  • filesystem
  • database

TL;DR I was looking for a prototype of a Clojure macro that fulfills three requirements: (1) Generates a function. (2) Takes options as parameters and provides those to the generated function. (3) And lastly the generated function takes arguments. Spoiler! This is it...

  • clojure
  • macro
  • metaprogramming
  • prototype