(actions)
| 158 | |
| 159 | |
| 160 | def process_act(actions): |
| 161 | # 定义动作名称与数字的对应关系 |
| 162 | action_map = { |
| 163 | "stop":0, |
| 164 | "go straight": 1, |
| 165 | "turn left": 2, |
| 166 | "turn right": 3, |
| 167 | "go up": 4, |
| 168 | "go down": 5, |
| 169 | "move left": 6, |
| 170 | "move right": 7, |
| 171 | 'up':-1, |
| 172 | 'down':-2 |
| 173 | } |
| 174 | |
| 175 | # 转换列表 |
| 176 | transformed_list = [action_map[action['action']['type']] for action in actions] |
| 177 | |
| 178 | return transformed_list |
| 179 | |
| 180 | |
| 181 |