Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
形四のWebアプリ作ってみた
Search
西村 備山
February 25, 2026
Technology
14
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
形四のWebアプリ作ってみた
2026.02.21 デジもく会 での発表
西村 備山
February 25, 2026
More Decks by 西村 備山
See All by 西村 備山
SPRESENSEで可愛いロボット ~ H/W・S/W設計のポイント
lipoyang
0
140
イチから作る超軽量な音声合成
lipoyang
0
35
製作物紹介 & 小ネタ集
lipoyang
0
13
パワポを操作してカンペを表示するスカウター型デバイス
lipoyang
0
20
マイコンとデジファブによる創作電子楽器の製作
lipoyang
0
48
GitHub Copilot 対 Cursor
lipoyang
0
51
つくろか!3 出展について
lipoyang
0
22
光る縄文土器を作る
lipoyang
0
82
IoT渾天儀で太陽の運行を知る
lipoyang
0
2k
Other Decks in Technology
See All in Technology
フィンテック養成勉強会#68
finengine
0
160
二歩目のフロントエンド・ウェブアクセシビリティ
camiha
2
690
Code for Security プロジェクト紹介 2026年10月
yu23ki14
0
110
CloudWatch Logsのコスト最適化:どこまでAIに任せてどこから人間が承認すべきか
yama3133
0
120
M5Stackで作る BLEマウス GPSログの世界
tomokusaba
PRO
0
440
会社紹介資料 / Sansan Company Profile
sansan33
PRO
31
430k
初海外で注意すべきこと12選!!!安全快適なre:invent生活にするために
yuuuuuuu168
1
180
古い指輪から広がった JAVA コミュニティ とのつながり
yamad
0
130
[JAWS-UG彩の国埼玉#12]そろそろ準備する?re:Invent2026をやさしく解説 / reinvent2026-sainokuni
sh_fk2
1
360
AI導入は済んだ。次は統制を作り替える番だ_AI×開発組織 Summit 2026
techtekt
PRO
0
390
自作バイナリを動かす「入口」8選
puhitaku
2
1.3k
オントロジーって 結局なにもの? AI エージェントに「意味」を渡す知識設計の話
greenmidori
0
240
Featured
See All Featured
Designing for humans not robots
tammielis
254
26k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
Site-Speed That Sticks
csswizardry
13
1.6k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.2k
Scaling GitHub
holman
464
140k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
710
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
600
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
710
Transcript
2026.02.21 デジもく会 西村備山 (@lipoyang) 形四のWebアプリ作ってみた
自己紹介 •デジもく会 •奈良県在住 •組込み系技術者 西村備山 (@lipoyang)
形四とは? 白黒4つのコマで正方形をつくるボードゲーム 「形四」ゲームの解説 dnjiro's 9VAe blog より
既存の形四アプリ 「形四96番勝負」 by @dnjiro さん Android / Chromebook 版(Google Play)
Windows版 (keishi96w.zip) Mac版 (keishi96m.zip) Amazon Fire タブレット版(Amazonアプリストア) X68000 Z版(kc96x.zip)
まずは C# で自作 • Windows用フォームアプリ • 以前作ったオセロのアプリを改造して作成 • ひとまず動くようになるまで 9時間
(さすがに生成AIの速さには勝てない) • 形四96番勝負 相当のUIに作りこむ
KCSharp https://github.com/lipoyang/KCSharp ←レベル7は かなり強いぞ
Webアプリ版も作ってみた • UIは JavaScript で記述 • 思考エンジンは Rust で記述 •
Rust → WebAssembly にビルド • ネイティブアプリと遜色ない速度
WebKC ↓こちらで遊べます
ネット対戦機能がほしい • 人間 VS 人間 のネット対戦 • ソフト vs ソフト
のネット対戦 • 通信仕様どうする? • サーバどこに立てる?
またね~ Twitter: @lipoyang GitHub: lipoyang SlideShare: lipoyang http://lipoyang.net
高速化の工夫 • ミニマックス法 → アルファ・ベータ法 (アルゴリズムの改良) • 二次元配列 → ビットボード
(データ構造の改良) • 動的なオブジェクト生成をなるべく減らす • 無駄に同じ計算を繰り返さない。(メモ化)
静的評価関数 自乗形四率 (Square Keishi Rate) を以下のように定義 4つの石の座標を P i =
(x i , y i ) (i = 1, 2, 3, 4) とする。 相互の距離の自乗は D(P i , P j ) = (x i – x j )2 + (y i – y j )2 その最大値を D max 、最小値を D min とするとき 自乗形四率 k = D min / D max は 0 < k ≦ ½ であり、 四点が正方形をなすとき k = ½ となる。 どれだけ正方形に近いかの簡易な指標となる。
ヒューリスティック • 「必殺形」全30パターン (トリプル中パンチ) • 「恐怖系」全12パターン (大パンチ + ダブル中パンチ) •
これを評価関数に取り入れるのは… • 判定処理が面倒すぎて断念。 ( パターンは 回転、反転、平行移動 もありうる )