此代码应该是健身房自定义环境的开始,但是我无法获得以下for循环的语法。我不知道该怎么做。
#importing packages
import numpy as np
import matplotlib.pyplot as plt
#Gr
class GridWorld(object):
def __init__(self,m,n,magicSquares):
#m and n for the matrix size m*n
self.m=m
self.n=n
#representing the matrix by a list of zeros of size m*n
self.grid(np.zeros(m,n))
#This one i don't get it ? i thought it was supposed to be the matrix as a whole
self.stateSpace=[i for i in range]
虽然不清楚上面需要解释哪些代码行,但我相信您的问题是关于python中的List Comprehensions,因为这是问题标题的重点。