Skip to content

joseferben/clj-2048-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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})

About

Solving 2048 using expectimax and Clojure.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published