0

最初に疑似コードをここに置きます。実際の歩行者の動きによるその有効性と、それを改善する方法についてアドバイスしてください。

前提: スポーン地点からゴールまで亀が歩く。途中、他のカメと遭遇。同じ色のカメは「仲間」として扱われ、「友達が通りを歩いている」シナリオをシミュレートして、その近くに行きます。距離が近い同じ色のカメが優先されます。たとえば、友達 A は友達 B よりも近いので、最初に友達 A に近づきます。

ゴールに近づくと、カメはスポーン ポイントに戻ります。

擬似コード:

determine if i am already in the goal
if yes,
    determine if there are patches I can walk on
    set eyes on nearest patch I can walk on (for the goal path)
    if there is a friend nearby, approach friend
    if there is no friend nearby, continue walking the goal path
    if im already in the goal, respawn.

改善のためのアドバイスをお願いします?

4

1 に答える 1

1

前提は、スポーン ポイントに戻る方法については何も述べていないので、1 ステップのアクションであると仮定します (つまり、それらの詳細には興味がありません)。私は次の線に沿ってもっと何かを見ます

spawn loop: 
  spawn
  goal loop: 
    determine if turtle already reached goal
    if no,
      determine if there are patches I can walk on
      set eyes on nearest patch I can walk on (for the goal path)
      if there is a friend nearby, approach friend
      if there is no friend nearby, continue walking the goal path
    if yes, 
      setup so can respawn (return to spawn loc, etc)
      goal loop ends
于 2013-12-23T14:07:27.607 に答える