Code viewer for World: Mind Tutorial v0.1
let actionEnum = Object.freeze({up: 0, down: 1, right: 2, left: 3});
let agent;
let coins = [];

function World() 
{ 

	this.newRun = function()
	{
		
 	    ABWorld.init2d ( 100, 1000, "black" ); 
 	    
 	    agent = new THREE.Mesh( new THREE.SphereGeometry( 5, 32, 32 ), new THREE.MeshBasicMaterial({color: "red"}) );
 	    ABWorld.scene.add(agent);
 	    
 	    coins.push( new THREE.Mesh( new THREE.SphereGeometry( 2, 32, 32 ), new THREE.MeshBasicMaterial({color: "yellow"}) ));
 	    coins.push( new THREE.Mesh( new THREE.SphereGeometry( 2, 32, 32 ), new THREE.MeshBasicMaterial({color: "yellow"}) ));
 	    coins.push( new THREE.Mesh( new THREE.SphereGeometry( 2, 32, 32 ), new THREE.MeshBasicMaterial({color: "yellow"}) ));
 	    
 	    coins[0].position.set(50,0,-50);
 	    coins[1].position.set(-25,0,-50);
 	    coins[2].position.set(-25,0,25);
 	    
 	    for (let i=0; i<3; i++)
 	    {
 	        ABWorld.scene.add(coins[i]);
 	    }
 		
	};


	this.takeAction = function ( action )		 
	{
		// Code for Three.js re-drawing of objects.  
	};


	this.endRun = function()
	{
	};


	this.getState = function()
	{
	    let state = {
	        agentPos: agent.postion,
	        coin0Pos: coins[0].postion,
	        coin1Pos: coins[1].postion,
	        coin2Pos: coins[2].postion
	    };
	    
	  return ( state );  				 
	};

	
	this.getScore = function()
 	{
	  return ( 0 );		
	};

}