Skip to content

Commit

Permalink
deploy: 7bc3873
Browse files Browse the repository at this point in the history
  • Loading branch information
ShenMian committed Oct 22, 2024
1 parent 6563f92 commit 3c55eb8
Show file tree
Hide file tree
Showing 19 changed files with 130 additions and 52 deletions.
2 changes: 1 addition & 1 deletion 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@

<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<div class="sidebar-scrollbox">
<ol class="chapter"><li class="chapter-item expanded affix "><a href="introduction.html">介绍</a></li><li class="chapter-item expanded "><a href="level/design.html"><strong aria-hidden="true">1.</strong> 设计 🚧</a></li><li class="chapter-item expanded "><a href="level/index.html"><strong aria-hidden="true">2.</strong> 关卡</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="level/representation.html"><strong aria-hidden="true">2.1.</strong> 表示</a></li><li class="chapter-item expanded "><a href="level/construction.html"><strong aria-hidden="true">2.2.</strong> 构造</a></li><li class="chapter-item expanded "><a href="level/normalization.html"><strong aria-hidden="true">2.3.</strong> 标准化 🚧</a></li></ol></li><li class="chapter-item expanded "><div><strong aria-hidden="true">3.</strong> 动作</div></li><li class="chapter-item expanded "><a href="solver/index.html"><strong aria-hidden="true">4.</strong> 求解器 🚧</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="solver/solving_strategy.html"><strong aria-hidden="true">4.1.</strong> 搜索策略 🚧</a></li><li class="chapter-item expanded "><a href="solver/heuristic_function.html"><strong aria-hidden="true">4.2.</strong> 启发式函数 🚧</a></li><li class="chapter-item expanded "><a href="solver/optimization.html"><strong aria-hidden="true">4.3.</strong> 优化</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="solver/tunnels.html"><strong aria-hidden="true">4.3.1.</strong> 隧道</a></li><li class="chapter-item expanded "><a href="solver/deadlocks.html"><strong aria-hidden="true">4.3.2.</strong> 死锁 🚧</a></li><li class="chapter-item expanded "><div><strong aria-hidden="true">4.3.3.</strong> 割点</div></li></ol></li><li class="chapter-item expanded "><div><strong aria-hidden="true">4.4.</strong> 双向搜索</div></li><li class="chapter-item expanded "><div><strong aria-hidden="true">4.5.</strong> 特征</div></li></ol></li><li class="chapter-item expanded "><div><strong aria-hidden="true">5.</strong> 优化器</div></li><li class="chapter-item expanded "><a href="resources.html"><strong aria-hidden="true">6.</strong> 资源</a></li><li class="chapter-item expanded "><a href="glossary_of_terms.html"><strong aria-hidden="true">7.</strong> 术语表</a></li></ol>
<ol class="chapter"><li class="chapter-item expanded affix "><a href="introduction.html">介绍</a></li><li class="chapter-item expanded "><a href="design.html"><strong aria-hidden="true">1.</strong> 设计 🚧</a></li><li class="chapter-item expanded "><a href="level/index.html"><strong aria-hidden="true">2.</strong> 关卡</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="level/representation.html"><strong aria-hidden="true">2.1.</strong> 表示</a></li><li class="chapter-item expanded "><a href="level/construction.html"><strong aria-hidden="true">2.2.</strong> 构造</a></li><li class="chapter-item expanded "><a href="level/normalization.html"><strong aria-hidden="true">2.3.</strong> 标准化 🚧</a></li></ol></li><li class="chapter-item expanded "><div><strong aria-hidden="true">3.</strong> 动作</div></li><li class="chapter-item expanded "><a href="solver/index.html"><strong aria-hidden="true">4.</strong> 求解器 🚧</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="solver/solving_strategy.html"><strong aria-hidden="true">4.1.</strong> 搜索策略 🚧</a></li><li class="chapter-item expanded "><a href="solver/heuristic_function.html"><strong aria-hidden="true">4.2.</strong> 启发式函数 🚧</a></li><li class="chapter-item expanded "><a href="solver/optimization.html"><strong aria-hidden="true">4.3.</strong> 优化</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="solver/tunnels.html"><strong aria-hidden="true">4.3.1.</strong> 隧道</a></li><li class="chapter-item expanded "><a href="solver/deadlocks.html"><strong aria-hidden="true">4.3.2.</strong> 死锁 🚧</a></li><li class="chapter-item expanded "><div><strong aria-hidden="true">4.3.3.</strong> 割点</div></li></ol></li><li class="chapter-item expanded "><div><strong aria-hidden="true">4.4.</strong> 双向搜索</div></li><li class="chapter-item expanded "><div><strong aria-hidden="true">4.5.</strong> 特征</div></li></ol></li><li class="chapter-item expanded "><div><strong aria-hidden="true">5.</strong> 优化器</div></li><li class="chapter-item expanded "><a href="resources.html"><strong aria-hidden="true">6.</strong> 资源</a></li><li class="chapter-item expanded "><a href="glossary_of_terms.html"><strong aria-hidden="true">7.</strong> 术语表</a></li></ol>
</div>
<div id="sidebar-resize-handle" class="sidebar-resize-handle">
<div class="sidebar-resize-indicator"></div>
Expand Down
93 changes: 66 additions & 27 deletions level/design.html → design.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#ffffff">

<link rel="icon" href="../favicon.svg">
<link rel="shortcut icon" href="../favicon.png">
<link rel="stylesheet" href="../css/variables.css">
<link rel="stylesheet" href="../css/general.css">
<link rel="stylesheet" href="../css/chrome.css">
<link rel="stylesheet" href="../css/print.css" media="print">
<link rel="icon" href="favicon.svg">
<link rel="shortcut icon" href="favicon.png">
<link rel="stylesheet" href="css/variables.css">
<link rel="stylesheet" href="css/general.css">
<link rel="stylesheet" href="css/chrome.css">
<link rel="stylesheet" href="css/print.css" media="print">

<!-- Fonts -->
<link rel="stylesheet" href="../FontAwesome/css/font-awesome.css">
<link rel="stylesheet" href="../fonts/fonts.css">
<link rel="stylesheet" href="FontAwesome/css/font-awesome.css">
<link rel="stylesheet" href="fonts/fonts.css">

<!-- Highlight.js Stylesheets -->
<link rel="stylesheet" href="../highlight.css">
<link rel="stylesheet" href="../tomorrow-night.css">
<link rel="stylesheet" href="../ayu-highlight.css">
<link rel="stylesheet" href="highlight.css">
<link rel="stylesheet" href="tomorrow-night.css">
<link rel="stylesheet" href="ayu-highlight.css">

<!-- Custom theme stylesheets -->

Expand All @@ -37,7 +37,7 @@
<div id="body-container">
<!-- Provide site root to javascript -->
<script>
var path_to_root = "../";
var path_to_root = "";
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light";
</script>

Expand Down Expand Up @@ -90,7 +90,7 @@

<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<div class="sidebar-scrollbox">
<ol class="chapter"><li class="chapter-item expanded affix "><a href="../introduction.html">介绍</a></li><li class="chapter-item expanded "><a href="../level/design.html" class="active"><strong aria-hidden="true">1.</strong> 设计 🚧</a></li><li class="chapter-item expanded "><a href="../level/index.html"><strong aria-hidden="true">2.</strong> 关卡</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../level/representation.html"><strong aria-hidden="true">2.1.</strong> 表示</a></li><li class="chapter-item expanded "><a href="../level/construction.html"><strong aria-hidden="true">2.2.</strong> 构造</a></li><li class="chapter-item expanded "><a href="../level/normalization.html"><strong aria-hidden="true">2.3.</strong> 标准化 🚧</a></li></ol></li><li class="chapter-item expanded "><div><strong aria-hidden="true">3.</strong> 动作</div></li><li class="chapter-item expanded "><a href="../solver/index.html"><strong aria-hidden="true">4.</strong> 求解器 🚧</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../solver/solving_strategy.html"><strong aria-hidden="true">4.1.</strong> 搜索策略 🚧</a></li><li class="chapter-item expanded "><a href="../solver/heuristic_function.html"><strong aria-hidden="true">4.2.</strong> 启发式函数 🚧</a></li><li class="chapter-item expanded "><a href="../solver/optimization.html"><strong aria-hidden="true">4.3.</strong> 优化</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../solver/tunnels.html"><strong aria-hidden="true">4.3.1.</strong> 隧道</a></li><li class="chapter-item expanded "><a href="../solver/deadlocks.html"><strong aria-hidden="true">4.3.2.</strong> 死锁 🚧</a></li><li class="chapter-item expanded "><div><strong aria-hidden="true">4.3.3.</strong> 割点</div></li></ol></li><li class="chapter-item expanded "><div><strong aria-hidden="true">4.4.</strong> 双向搜索</div></li><li class="chapter-item expanded "><div><strong aria-hidden="true">4.5.</strong> 特征</div></li></ol></li><li class="chapter-item expanded "><div><strong aria-hidden="true">5.</strong> 优化器</div></li><li class="chapter-item expanded "><a href="../resources.html"><strong aria-hidden="true">6.</strong> 资源</a></li><li class="chapter-item expanded "><a href="../glossary_of_terms.html"><strong aria-hidden="true">7.</strong> 术语表</a></li></ol>
<ol class="chapter"><li class="chapter-item expanded affix "><a href="introduction.html">介绍</a></li><li class="chapter-item expanded "><a href="design.html" class="active"><strong aria-hidden="true">1.</strong> 设计 🚧</a></li><li class="chapter-item expanded "><a href="level/index.html"><strong aria-hidden="true">2.</strong> 关卡</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="level/representation.html"><strong aria-hidden="true">2.1.</strong> 表示</a></li><li class="chapter-item expanded "><a href="level/construction.html"><strong aria-hidden="true">2.2.</strong> 构造</a></li><li class="chapter-item expanded "><a href="level/normalization.html"><strong aria-hidden="true">2.3.</strong> 标准化 🚧</a></li></ol></li><li class="chapter-item expanded "><div><strong aria-hidden="true">3.</strong> 动作</div></li><li class="chapter-item expanded "><a href="solver/index.html"><strong aria-hidden="true">4.</strong> 求解器 🚧</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="solver/solving_strategy.html"><strong aria-hidden="true">4.1.</strong> 搜索策略 🚧</a></li><li class="chapter-item expanded "><a href="solver/heuristic_function.html"><strong aria-hidden="true">4.2.</strong> 启发式函数 🚧</a></li><li class="chapter-item expanded "><a href="solver/optimization.html"><strong aria-hidden="true">4.3.</strong> 优化</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="solver/tunnels.html"><strong aria-hidden="true">4.3.1.</strong> 隧道</a></li><li class="chapter-item expanded "><a href="solver/deadlocks.html"><strong aria-hidden="true">4.3.2.</strong> 死锁 🚧</a></li><li class="chapter-item expanded "><div><strong aria-hidden="true">4.3.3.</strong> 割点</div></li></ol></li><li class="chapter-item expanded "><div><strong aria-hidden="true">4.4.</strong> 双向搜索</div></li><li class="chapter-item expanded "><div><strong aria-hidden="true">4.5.</strong> 特征</div></li></ol></li><li class="chapter-item expanded "><div><strong aria-hidden="true">5.</strong> 优化器</div></li><li class="chapter-item expanded "><a href="resources.html"><strong aria-hidden="true">6.</strong> 资源</a></li><li class="chapter-item expanded "><a href="glossary_of_terms.html"><strong aria-hidden="true">7.</strong> 术语表</a></li></ol>
</div>
<div id="sidebar-resize-handle" class="sidebar-resize-handle">
<div class="sidebar-resize-indicator"></div>
Expand Down Expand Up @@ -152,7 +152,7 @@
<h1 class="menu-title">现代推箱子教程</h1>

<div class="right-buttons">
<a href="../print.html" title="Print this book" aria-label="Print this book">
<a href="print.html" title="Print this book" aria-label="Print this book">
<i id="print-button" class="fa fa-print"></i>
</a>
<a href="https://github.com/ShenMian/sokoban-tutorial" title="Git repository" aria-label="Git repository">
Expand Down Expand Up @@ -186,7 +186,46 @@ <h1 class="menu-title">现代推箱子教程</h1>
<div id="content" class="content">
<main>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.4/dist/katex.min.css">
<h1 id="设计-"><a class="header" href="#设计-">设计 🚧</a></h1>
<h1 id="设计"><a class="header" href="#设计">设计</a></h1>
<h2 id="结构体设计"><a class="header" href="#结构体设计">结构体设计</a></h2>
<ul>
<li><code>Map</code>: 存储地图数据.
<ul>
<li>包含所有地图元素的数组.</li>
<li>包含玩家位置, 箱子和目标位置: 方便快速读取, 否则需要遍历数组来获取相应元素的坐标.</li>
</ul>
</li>
<li><code>Actions</code>: 存储玩家的动作, 包括动作的类型(移动或推动), 以及方向(上下左右).</li>
<li><code>Level</code>: 关卡, 包含地图和玩家动作. 可以执行或撤销动作.</li>
</ul>
<p><code>Level</code> 中与地图相关的内容分离到 <code>Map</code> 中, 是为了将地图数据与关卡功能分离. 许多涉及地图的操作(例如计算两个地图之间的相似度)与关卡功能无关.</p>
<blockquote>
<p><code>Map</code> 的数组是否应该包含玩家和箱子元素? 🤔</p>
<ul>
<li>包含:
<ul>
<li>在修改玩家位置或移动箱子时, 需要同步数组中的数据. 可能引入导致数据不一致的 BUG. 但因为实现十分简单, 因此引入 BUG 的可能性不大.</li>
<li>存在数据冗余, 但是冗余的数据量很小, 不至于造成显著的内存占用率变化.</li>
</ul>
</li>
<li>不包含: 读取时需要判断是否与玩家或任意箱子的位置相同, 如果有就追加相关元素的枚举值. 导致读取比写入有更大的开销. 取比写入开销大违反直觉, 违背了 POLA<sup class="footnote-reference"><a href="#POLA">1</a></sup>.</li>
</ul>
<p>综上所述, 本文倾向于在数组里包含这些元素.</p>
</blockquote>
<blockquote>
<p><code>Map</code> 的数组应该是一维的还是二维的? 🤔</p>
<p>由于该数组是动态数组, 二维动态数组的分配与释放需要更大的开销. 而使用一维动态数组, 内存布局会更加紧凑, 且可以提供使用二维坐标读取地图内容的关联函数. 因此使用一维数组更为合适.</p>
</blockquote>
<h2 id="转换关系"><a class="header" href="#转换关系">转换关系</a></h2>
<pre class="mermaid">flowchart LR
A[String] --&gt;|XSB 格式| B[Map]
A --&gt;|LURD 格式| C[Actions]
C --&gt;|重建| B
B --&gt; D[Level]
</pre>
<div class="footnote-definition" id="POLA"><sup class="footnote-definition-label">1</sup>
<p><a href="https://en.wikipedia.org/wiki/Principle_of_least_astonishment">https://en.wikipedia.org/wiki/Principle_of_least_astonishment</a></p>
</div>


<!-- Giscus -->
Expand All @@ -200,12 +239,12 @@ <h1 id="设计-"><a class="header" href="#设计-">设计 🚧</a></h1>

<nav class="nav-wrapper" aria-label="Page navigation">
<!-- Mobile navigation buttons -->
<a rel="prev" href="../introduction.html" class="mobile-nav-chapters previous"
<a rel="prev" href="introduction.html" class="mobile-nav-chapters previous"
title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>

<a rel="next prefetch" href="../level/index.html" class="mobile-nav-chapters next"
<a rel="next prefetch" href="level/index.html" class="mobile-nav-chapters next"
title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
Expand All @@ -216,12 +255,12 @@ <h1 id="设计-"><a class="header" href="#设计-">设计 🚧</a></h1>
</div>

<nav class="nav-wide-wrapper" aria-label="Page navigation">
<a rel="prev" href="../introduction.html" class="nav-chapters previous" title="Previous chapter"
<a rel="prev" href="introduction.html" class="nav-chapters previous" title="Previous chapter"
aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>

<a rel="next prefetch" href="../level/index.html" class="nav-chapters next" title="Next chapter"
<a rel="next prefetch" href="level/index.html" class="nav-chapters next" title="Next chapter"
aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
Expand All @@ -237,17 +276,17 @@ <h1 id="设计-"><a class="header" href="#设计-">设计 🚧</a></h1>
</script>


<script src="../elasticlunr.min.js"></script>
<script src="../mark.min.js"></script>
<script src="../searcher.js"></script>
<script src="elasticlunr.min.js"></script>
<script src="mark.min.js"></script>
<script src="searcher.js"></script>

<script src="../clipboard.min.js"></script>
<script src="../highlight.js"></script>
<script src="../book.js"></script>
<script src="clipboard.min.js"></script>
<script src="highlight.js"></script>
<script src="book.js"></script>

<!-- Custom JS scripts -->
<script src="../assets/mermaid.min.js"></script>
<script src="../assets/mermaid-init.js"></script>
<script src="assets/mermaid.min.js"></script>
<script src="assets/mermaid-init.js"></script>


</div>
Expand Down
Loading

0 comments on commit 3c55eb8

Please sign in to comment.