Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
プログラムで迷路を作る
Search
inoha_naito
August 01, 2021
Programming
0
360
プログラムで迷路を作る
inoha_naito
August 01, 2021
Tweet
Share
Other Decks in Programming
See All in Programming
せっかくモデル図描くのなら、嬉しいことが多い方がいいよね!
kuboaki
1
1.3k
オブジェクトしこう
okuramasafumi
2
130
Go1.22からの疑似乱数生成器について/go-122-pseudo-random-generator
convto
1
160
Kotlinを用いたDSL的な設計手法と使用上の注意
kohii00
3
530
The Future of C++ Interoperability: Insights from Porting a Game to Swift
teamhimeh
0
260
Compiling Python to WebAssembly with py2wasm
syrusakbary
0
130
プロンプトエンジニアリング入門
tomokusaba
2
970
incrementalモデルの理解を深める
ikkimiyazaki
2
640
LLMチャットボットのアプリケーション設計Tips
os1ma
4
650
Parallel Socket Communication in Swift
s_shimotori
0
210
設計の知識と技能で駆動するソフトウェア開発
masuda220
PRO
18
10k
Data Contracts In Practice With Debezium and Apache Flink (Kafka Summit London)
gunnarmorling
2
270
Featured
See All Featured
Fantastic passwords and where to find them - at NoRuKo
philnash
35
2.4k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
242
20k
Fashionably flexible responsive web design (full day workshop)
malarkey
397
65k
WebSockets: Embracing the real-time Web
robhawkes
59
6.9k
Principles of Awesome APIs and How to Build Them.
keavy
119
16k
Making the Leap to Tech Lead
cromwellryan
122
8.4k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
19
1.6k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
124
32k
RailsConf 2023
tenderlove
0
510
Code Review Best Practice
trishagee
54
15k
The Cost Of JavaScript in 2023
addyosmani
13
3.7k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
14
1.3k
Transcript
プログラムで迷路を作る
自己紹介 HN: いのは Twitter: @inoha_naito Webサイト: miraiportal(技術系ブログ) https://miraiportal.com/ 最近は、 ジョジョの7部経由で
SOUL‘d OUTの『ウェカピポ』にハマり 1日4,5回くらい聴いています。
今回の内容 迷路生成アルゴリズムのひとつ 「棒倒し法」を JavaScriptのライブラリ 「p5.js」を用いて実装しています。 日本語少なめ、 画像マシマシです。
準備
1. 格子を描画する
2. 配列に対応するセルを塗る
本編
3. 配列に外壁をセットする
4. 配列に内壁をセットする
5. 配列に壁をランダムにセットする
シード値を設定する(おまけ)
まとめ 今回のプログラム https://editor.p5js.org/inoha_naito/sketches/QGkMf2Mhv 他にも、 迷路生成だと「穴掘り法」や「壁伸ばし法」 迷路探索だと「幅優先探索」や「深さ優先探索」 また、ダンジョン生成アルゴリズムなどもある。