Code viewer for Mind: Cloned Complex Mind
/*

ALi Raza
14447642
This is my Mind for the Assignment 

There was problems with uploading pictures,they had to be over certain resloution(over 800*420)

I also encountered problems with uploading models, the had to be under 2MB, the car 
model that i made was 5.4MB, was unable to upload this-had to change game plan

I couldn't upload .json files, only .Obj files were allowed to upload

*/

//game explation
/*
The game is set in a swimming pool and the cubes float.The red/white cubes displays the track.


The idea behind this game is to catch the cubes to increase score, IF AND ONLY IF the score is >= 10 at 10,00 steps then the player wins
Whats interesting in this game is that if the cube is not caught then the score is minisued by 1 every time,
and the game is finished if it reaches 10,000 steps or the score goes to -14 which ever occour first, then the game is ended and the
player is informed by displaying the end game string. What makes the problem hard is that the cube is moved
into a new random position if not not caught in certain milliseconds. In some places I made the track in diagonal
position which makes the packman harder to move fast around the track. The game gets quite addective after a few plays.
Once the coin is eaten then the cube reappers in a new position.
The game is set in a swimming pool stadium with people observing the game, just like in the Olympics.


*/

function initLogicalEnemy()
{
// start in random location:
 score--;
 var i, j;
 do
 {
  i = randomintAtoB(1,gridsize-2);
  j = randomintAtoB(1,gridsize-2);
 }
 
 while ( occupied(i,j) );     // search for empty square 

 ei = i;
 ej = j;
}

//check if coin 
function checkIfCoin()
{
    if(ei == ai+1 && ej == aj+1 || ei == ai-1 && ej == aj-1 || ei == ai+1 && ej == aj-1 || ei == ai-1 && ej == aj+1 || ei == ai && ej == aj+1 || ei == ai && ej == aj-1 || ei == ai+1 && ej == aj || ei == ai-1 && ej == aj)
    {
       score = score + 2; 
       initLogicalEnemy();
    }
}

function Mind() { 


//--- public functions / interface / API ----------------------------------------------------------


	this.newRun = function()
	{
	      initLogicalEnemy();
	};

	this.endRun = function()
	{
	};



	this.getAction = function ( x )		// x is an array of [ ai, aj, ei, ej ]
	{ 
	    //end if max steps reached
	    if(step == MAXSTEPS)
	    {
	        this.endCondition = true;
	    }
 		checkIfCoin();
	};

}