我先把我的伪代码放在这里,请根据现实世界的行人运动建议它的有效性,以及如何改进它。
前提:一只乌龟从它的出生点走到目标。在途中,它遇到了其他乌龟。相同颜色的海龟将被视为“伙伴”,并会靠近它,模拟“朋友-走在街上”的场景。距离较近的同色海龟优先级较高,例如朋友 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.
请建议改进?