canvas随机生成一个迷宫并自动寻找出口算法效果代码

代码语言:html

所属分类:其他

代码描述:canvas随机生成一个迷宫并自动寻找出口算法效果代码

代码标签: canvas 迷宫 破解

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="UTF-8">





    <style>
        form {
          padding: 20px;
        }
        
        label {
          padding: 5px;
        }
    </style>

</head>

<body>
    <form name="mazedetails" action="javascript:letsGo()">

        <label for="width">Width:</label> <input type="number" name="width" id="width" value="40" size="5" min="2" max="40">

        <label for="height">Height:</label> <input type="number" name="height" id="height" value="24" size="5" min="2" max="40">

        <label for="boxsize">Box Size:</label> <input type="number" name="boxsize" id="boxsize" value="15" size="5" min="6" max="50">

        <input type="submit" value="Generate a new maze">

        <button type="button" onclick="javascript:solveAnimation()">Solve Animation</button>
    </form>

    <canvas id="mymaze" width="650" height="650"></canvas>


    <script>
        let maze, interval;
        
        class Square {
          constructor() {
            this.south = true;
            this.east = true;
            this.accessible = false;
            this.color = "white";
          }
          openSouth() {
            this.south = false;
          }
          openEast() {
            this.east = false;
          }
          markAccessible() {
            this.accessible = true;
          }
          setColor(color) {
            this.color = color;
          }}
        
        
        class Maze {
          const.........完整代码请登录后点击上方下载按钮下载查看

网友评论0