openai-gym - 改变网格中周期性出现的对象的速度
问题描述
我在minigrid 环境中工作。我目前有一个对象在屏幕上以每步数的一个网格空间移动(从左到右)。此对象当前定期出现在屏幕上的一半时间和一半时间。我想减慢对象的速度,使其在屏幕上的移动速度变慢。我不确定如何在不丢失周期性外观属性的情况下做到这一点。当前代码如下:
idx = (self.step_count+2)%(2*self.width) # 2 is the ratio of appear not appear
if idx < self.width:
try:
self.put_obj(self.obstacles[i_obst], idx , old_pos[1])
self.grid.set(*old_pos, None) # deletes old obstacle
except:
pass
else:
self.grid.set(*old_pos, None) # deletes old obstacle
解决方案
我有事要干。下面的代码片段包含一个名为“slow_factor”的整数,它降低了速度,但仍然具有对原始目的有用的 idx。
idx = (self.step_count+2)//slow_factor%(2*self.width)
推荐阅读
- flutter - Flutter - SingleChildScrollView 固定小部件
- cordova - Ionic 4 - chrome sockets udp 不创建套接字而不输出任何错误
- google-sheets - 在 Google 表格中搜索不同的列并计算特定值
- javascript - 从存储在数组中的键解构 js 对象
- android - Koin:如何在范围之间共享类实例
- r - R {drake}计划:将许多数据集读入单个目标
- python - 合并保持多索引的数据帧
- python - 如何返回字典中保存的数据框列
- php - PHP: strtotime vs mktime speed for getting 1 个月前
- pvs-studio - CLMonitor 退出代码