board-game-agricola-fence
v1.6.1
Published
npm install board-game-agricola-fence
Downloads
34
Readme
how to install
npm install board-game-agricola-fence
how to use
import { renderBoard } from "board-game-agricola-fence";
const { fenceKeySet, watch } = renderBoard(document.getElementById("root")!);
//設定柵欄
[
"3-0-H",
"2-1-V",
"2-0-V",
"2-0-H",
"2-2-H",
"4-2-H",
"5-1-V",
"4-0-H",
"5-0-V",
"4-1-V",
"3-1-H",
"2-1-H",
"3-2-H",
].map((key) => fenceKeySet.add(key));
//監看柵欄並回傳柵欄和圈地
watch((fenceStore, closureStore) => {
console.log(fenceStore, closureStore);
});DEMO
https://taiwan.im/article/board-game-agricola-fence.html
農家樂圈地判斷
- 需要判斷圈地為連續封閉
- 完成後計算圈地及可放動物種類及數量
- 以圈地為準反推柵欄,判斷木頭量
- 以柵欄為準反推圈地,判斷封閉判斷木頭量
- 以點為準畫柵欄,判斷封閉判斷木頭量
- 每個圈地不需要連續
TODO
- [x] 判斷柵欄圈地是封閉
- [x] place store
- [x] 模組化 npm
注意事項
- StrictMode tag render 會執行兩次,使 pixi layout 產生錯誤
