-
Notifications
You must be signed in to change notification settings - Fork 1
Ltg monad
nushio3 edited this page Jun 19, 2011
·
8 revisions
AIを組み立てるための便利なライブラリ
-
data Simulator
- { turnCnt :: !Int
- , phase :: !Bool -- sente turn : True, gote turn : False
- , p1State :: State
- , p2State :: State
-
data State
- { field :: MV.IOVector Value
- , vital :: MV.IOVector Int
- , monitor :: MV.IOVector Monitor
- , backlog :: IORef [Hand] -- そのプレイヤーがプレイした手が「最新のものから順に」過去に向かって格納されている。
-
type Hand = (Int, Int, String)
-
type HandC = (Int, Int, Card)
- (typ, pos, name) もしくは (typ, pos, card)
- typeは左右の区別。1 は left, (
$>) を表し、2 は right, ($ <)を表す。 - posはカードを適用した場所。Stringはカードの名前, Cardはカード型そのもの
- 3つ組を分解するには get13 :: (a1,a2,a3)->a1, get23 :: (a1,a2,a3)->a2, get33 :: (a1,a2,a3)->a3 を使う。
- typeは左右の区別。1 は left, (
- (typ, pos, name) もしくは (typ, pos, card)
-
data Monitor
- { propHandCount :: Int -- そのプレイヤーがproponentとしてこのスロットにカードをapplyした回数
- , zombieSeedCount :: Int -- このスロットにゾンビが植え付けられた回数
敵味方の挙動を観察できるよう、 Monitor型に情報を蓄積することにした。 ./SpyDuckというサンプルAIを作ったので参考にしていただきたい。./SpyDuckは何もしないが、「敵のスロット利用状況」「自分スロットでゾンビが起動した位置と回数」「相手の棋譜」を報告する。使い方は、
../bin/ltg -silent true match './nostderr.rb ./KyoukoRevive' ./SpyDuck