Giter Club home page Giter Club logo

ai_maze's Introduction

基于多种智能算法的python迷宫游戏

动态生成迷宫

使用深度优先遍历算法生成迷宫,可以在settings.py中设置生成迷宫的动画显示。

# 是否显示迷宫生成过程
self.SHOW_DRAW = True

环境要求: python3.8以上版本,pygame

pip install pygame

# 启动命令
python start.py

显示的动态效果如下:

迷宫生成

控制模式

左侧小球

左侧小球由WASD方向键控制

右侧小球

右侧小球的控制模式有4种:

  • 手动模式(MAN):由键盘右侧的方向键控制
  • AI1模式:随机方向控制策略,这种策略下,AI随机选择方向(很笨)
  • AI2模式:广度优先策略找路径,这种方式找的路径不一定是最好的,但是一定可以走通,每一步操作做了200毫秒的延时,可以跟一般的人类玩家打平手。
  • AI3模式:使用A*算法,找到的是最短的路径,每步操作延时50毫秒,人工玩家很难取胜。

在游戏过程中可以随时切换四种控制模式(用鼠标点击即可)。

游戏演示:

如果对你有用,请我喝杯咖啡吧

donate

交流请联系我:[email protected]

ai_maze's People

Contributors

dlwangsan avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.