Skip to content

garzon/2048withAI

 
 

Repository files navigation

2048 with AI

A clone of 2048 with AI by garzon.

此为在原版2048的基础上,添加了电脑AI解题,并稍微修改了UI添加按钮来触发AI。
AI的核心在/js/myAI.js里,相关函数在window.myPlugin里
核心算法是用dfs搜3步后使代价函数window.myPlugin.evalCost期望值最小的走法,
代价函数的设计目的是让块尽量按由大到小顺序堆叠在右上角,并合并。
实验效果是基本能保证到2048,偶尔到4096甚至8192(概率较小)。
可单独把myAI.js提取出来作为脚本在浏览器里直接运行

Changes

Add myAI.js - the core of AI
Modify index.html - link to the myAI.js and replace the note

License

(c) 2014 Garzon. Released under the terms of the MIT license. AI by Garzon.2048 by Gabriele Cirulli (http://gabrielecirulli.com/). The original game can be found at http://gabrielecirulli.github.io/2048/.

About

2048 with AI by garzon

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CSS 59.0%
  • JavaScript 40.6%
  • Ruby 0.4%