登录
首页 » 算法 » 有脑子的贪吃蛇

有脑子的贪吃蛇

于 2022-06-01 发布 文件大小:4.65 kB
0 131
下载积分: 2 下载次数: 1

代码说明:

一个贪吃蛇AI的js实现,基本思想:先模拟一条蛇使用去吃食,若吃到食物后(广度优先寻最短路径)蛇处于安全状态,则让真蛇去吃;若不安全,则跟着蛇尾走(广度优先寻最长路径),没走一步都需进行一次上述判断。注:只要能找到蛇头到蛇尾的路径,则蛇安全。 上述算法仍可能导致蛇进入死循环,则没有安全路径可以吃到食物,该情况发生在大部分食物已经吃完的时候,目前没找到解决办法,若有兴趣或有更好的解法,欢迎联系。

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • basic sentinel Operational procedures for speech coding fixed
    基本定点运算程序库,语音编码或DSP定点实现-basic sentinel Operational procedures for speech coding fixed-point DSP to achieve or
    2022-01-21 02:06:35下载
    积分:1
  • 这是一个简单的演示如何评价文本的数学表达式
    This a simple demo of how to evaluate mathematical expressions in text format, including provision for variables and functions. The code consists of three simple classes: 1) Calc - which does the main calculations, 2) Stack - which is used to push and pop intermediate operators and numbers and 3) Symbol Table. The symbol table is a collection of calc symbols, a type structure consisting of various elements, including the expression name, function name, and the final value of the expression The evaluation procedure is done in three steps: 1) simplify the expression by removing all the elements within () and storing them in subexpressions within the symbol table. 2) Each of these sub expressions are then converted to RPN format (Reverse polar notation) and evaluated 3) Finally, the main expression is converted to RPN and evaluated-This is a simple demo of how to evaluate mathematical expressions in text format, including provision for variables and functi
    2022-02-20 06:26:41下载
    积分:1
  • 课程教学管理的系统
    实现一个对学生课程教学管理的系统,可以对学生的个人信息进行维护,还有学生的选课,课程分数,等
    2022-03-02 21:10:49下载
    积分:1
  • 16:00 Fourier algorithm, using standard C language, and optimized computing spee...
    16: 00傅里叶算法,采用标准C语言,优化计算速度,比传统算法快得多
    2022-12-31 04:55:03下载
    积分:1
  • TPS变形、线性插值、最近邻插值
    应用背景线性插值、最近邻插值算法,自己写的代码,可以作为参考实现opencv里cvresize的功能,可以应用在图像变形后插值不成功的点,效果不错,根据实际情况选择算法。TPS变形算法应用于图像变形,矫正摄像机畸变。关键技术线性插值、最近邻插值算法,都是自己写的,可以作为参考实现opencv里cvresize的功能,TPS薄板样条函数变形算法应用于图像变形,真的蛮实用的,希望可以帮到你。TPS就是一种插值方法,它寻找一个通过所有的控制点的弯曲最小的光滑曲面;就像一个薄铁板,通过所给定的几个“样条”(比如木条),铁板表面是光滑的。
    2022-01-22 11:00:18下载
    积分:1
  • 几种常见随机数的产生
    几种常见随机数的产生-several common random number generated
    2022-03-24 17:23:30下载
    积分:1
  • Newton,最基本的,经典的
    Newton法,最基本的,经典的算法了-Newton law, the most basic, a classic algorithm
    2022-12-07 03:10:03下载
    积分:1
  • 黄金分割,抛物线插值,单行替换是机械优化设计中的三中重要方。...
    黄金分割法,抛物线插值法,单行替换法是机械优化设计中的三中重要方法。-Golden section method, parabolic interpolation method, one-way is to replace mechanical optimal design method of the three most important.
    2022-01-25 23:40:14下载
    积分:1
  • used for the preparation of the polynomial interpolation algorithm
    用c++编写的关于多项式插值的算法-used for the preparation of the polynomial interpolation algorithm
    2022-01-26 01:14:55下载
    积分:1
  • calculation of Newton interpolation algorithm to achieve vc
    计算方法的牛顿前插值算法vc实现-calculation of Newton interpolation algorithm to achieve vc
    2023-04-15 14:35:04下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载