Giter VIP home page Giter VIP logo

c-mazesolver's Introduction

C-MazeSolver

自己想的一个关于迷宫障碍物寻路的逻辑

首先生成一个7x7的全部为0的矩阵,代表这个范围是空的,然后用户输入有几个障碍物,并输入各个障碍物的位置(位置输入模板:x,y,代表第x行第y个)。然后将第一行第一个作为起点,第七行第七个作为终点开始寻路,要求数组从1开始。寻路逻辑为:在当前方块向上下左右四个方向各走一步(超出矩阵范围则跳过),并选择离终点距离最近的一步(不踩到障碍物)作为新起点并重复上述过程直到走到终点。如果没有路,则输出NOWAY,有路就输出完整路线

代码为ChatGPT所写,我进行修改

c-mazesolver's People

Contributors

meowcata 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.