Skip to content

Latest commit

 

History

History
44 lines (27 loc) · 824 Bytes

README.md

File metadata and controls

44 lines (27 loc) · 824 Bytes

clj-2048-ai

This bot uses the expectimax search to beat 2048. You can read more about it in this blog post.

Prerequisites

You will need Leiningen 2.0.0 or above installed.

Running

To start a web server on localhost:3000 for the bot, run:

lein ring server

Usage

Simply POST the game board you want the best move for to http://localhost:3000.

Request:

POST / HTTP/1.0
Content-Type: application/json

[[16 2 2 0] [8 2 0 0] [4 2 2 0] [0 0 0 2]]

Response:

2

This is the mapping of int to move:

(def moves-map {:up 0 :down 1 :left 2 :right 3})