在健身房环境中动态增加观察空间

发布于 2025-02-07 05:21:15 字数 393 浏览 4 评论 0原文

我正在尝试为蛇游戏建立动态的健身环境。随着分数自然而增加,蛇的长度会增加。为了模拟动态性,我将随着分数的增加而逐渐在游戏中添加障碍物(墙壁)(当分数为5的倍数时)。墙的所有坐标都存储在列表中,每次分数通过5个倍数时,在随机位置添加了一个新段,并将其附加到列表中。

在参考现有解决方案时,我注意到有两种提及观察空间的方法:

  • 第一个包括使用Gunt.spaces.box的整个窗口(对我来说这不太好)。
  • 第二个是更紧凑的表示,得分更好。观察空间包括蛇的坐标,食物的坐标以及使用gym.spaces.dict的窗口尺寸。

我想为环境实施第二种方法,但是我不知道如何通过墙壁的坐标。

PS:这是我第一次在堆栈跨流上提出一个问题,因此,如果我的询问方式有任何问题/错误,请告诉我。

I am trying to build a dynamic gym environment for a snake game. As the score increases, naturally, the snake's length increases. To simulate dynamicity, I'm adding obstacles (walls) to the game gradually as the score increases (when the score is a multiple of 5). All the coordinates of a wall are stored in a list and every time the score passes a multiple of 5, a new segment is added at a random position and this is appended to the list.

While referring to existing solutions, I noticed that there are two ways of mentioning the observation space:

  • The first one includes passing the entire window (this hasn't worked too well for me) using gym.spaces.Box.
  • The second one is a more compact representation which resulted in a better score. The observation space included variables like the snake's coordinates, the food's coordinates, and the window size using gym.spaces.Dict.

I would like to implement the second approach for my environment, but I don't have any idea how I would pass the walls' coordinates.

P.S.: This is my first time asking a question on stack-overflow so if there's any issue/ mistake in my way of asking, do let me know.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文