Closed shugo256 closed 3 years ago
ちなみにadvance_steps
でsteps
を指定しないと、今まで通り最後まで進めるgeneratorとなる
1stepじゃなくなった結果、actionが正しく更新されないっぽいことがわかったので、一旦draftに戻す(draftに戻すボタンがない)
ready for review
action
は↑みたいなfor文の形でも(pythonのオブジェクトは参照なので)ちゃんと更新されていたが、非直感的なので、普通に毎step引数で渡す形式に変更した
10ステップずつやるとしたら↓みたいなイメージ
while not bfs.has_finished():
for _ in range(10):
if bfs.has_finished():
break
(st, rw) = bfs.step(action)
一方でgeneratorの形式を残しつつ、次のactionを指定するためだけのメソッドを生やすという方法も考えられる
while not bfs.has_finished():
for (st, rw) in bfs.advance_steps(10):
bfs.set_next_action(action)
@niconico22 どっちがいいかな?
上の方が直感的だが、ステップ数が10で割り切れない時のケアを使う側でする必要があるという弱点もある(下は、advance_steps
側で範囲チェックを入れられる)
とりあえず前者の形で実装してくれていると思うのでそれを使ってあとはAI側で調整してみます
3 の一部(複数xml対応はまた別でやる)
みたいにすると、二つ目のfor文は10ステップ目(0-indexed)からスタートする データセットを消費し切ったかどうかは
でチェック可能