A-Star算法穿越迷宫效果代码

代码语言:html

所属分类:其他

代码描述:A-Star算法穿越迷宫效果代码,A*算法,A*(A-Star)算法是一种静态路网中求解最短路径最有效的直接搜索方法,也是解决许多搜索问题的有效算法。算法中的距离估算值与实际值越接近,最终搜索速度越快。

代码标签: A-Star 算法 穿越 迷宫

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


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

<head>

  <meta charset="UTF-8">
  

  
  
<style>
body {
  background: #222;
  height: 100vh;
  display: grid;
  place-items: center;
  margin: 0;
}

[hidden] {
  display: none;
}

canvas {
  display: block;
  width: var(--size, 90vmin);
  height: var(--size, 90vmin);
  margin: 0 auto;
}

#out {
  position: fixed;
  background: rgba(0,0,0, 0.5);
  color: #fff;
  top: 0;
  left: 0;
  font-family: monospace;
}
</style>


</head>

<body>
  <svg hidden id="wall" width="32" height="32"><path fill="#f52" d="M0 1h21v15H0zM22 1h10v15H22zM0 17h11v15H0zM12 17h20v15H12z"/></svg>
<svg hidden id="poo" width="32" height="32">
  <path fill="#654" d="M8 30 q-4 0-4-4q0-4 4-4h16q4 0 4 4 q0 4 -4 4z M10 21.5q-3 0-3-3q0 -3 3-3h12q3 0 3 3q0 3-3 3zM12 15q-2 0-2-2q0-2 2-2h8q2 0 2 2 q0 2 -2 2z M16 10.5q-2 0-2-1v-1 q 0 -2 -2 -2 h2 q 4 0 4 2q0 2-2 2z"/>
</svg>

<canvas role="img" aria-label="It's a shitty maze with walls and piles of poo. There is an algorithm ru.........完整代码请登录后点击上方下载按钮下载查看

网友评论0