| 
					
				 | 
			
			
				@@ -12,6 +12,8 @@ from gym_minigrid.envs import DoorKeyEnv 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 # Test importing wrappers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from gym_minigrid.wrappers import * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+############################################################################## 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 print('%d environments registered' % len(envSet)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 for envName in sorted(envSet): 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -59,3 +61,26 @@ for envName in sorted(envSet): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         env.render('rgb_array') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     env.close() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+############################################################################## 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+# Test the env.agentSees() function 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+env = gym.make('MiniGrid-Empty-6x6-v0') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+goalPos = (env.grid.width - 2, env.grid.height - 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+def goalInObs(obs): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    grid = Grid.decode(obs) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    for j in range(0, grid.height): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for i in range(0, grid.width): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            cell = grid.get(i, j) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if cell and cell.color == 'green': 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return True 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    return False 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+env.reset() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+for i in range(0, 200): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    action = random.randint(0, env.action_space.n - 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    obs, reward, done, info = env.step(action) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    assert env.agentSees(*goalPos) == goalInObs(obs) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if done: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        env.reset() 
			 |