/*
	Engine Constructor
		gid - unique game identifier, required for a game to start or resume
		gameLogic - will be populated on itialize with the game rules
	InitGame() - creates or resumes a game, based on the type specified
	Report() - the API for the UI to interact with the game engine
*/
var Engine = function(type,newGid){
	this.gid;
	this.gameLogic;
	this.waiting = false;
	this.updateCounter = 0;
	
	// If newGid is specified, a resume is assumed
	if(newGid)
	{
		this.gid = newGid;
		console.log('trying to resume a game, but the functionality hasn\'t been built yet!');
	}
	else
	{
		this.gid = ClientData.gameCounter;
		switch(type)
		{
			case 'Skeemo':
				this.gameLogic = new Skeemo();
				break;
			default:
				console.log('unkown type: '+type);
		}	
	}
};

/*
	Report
	This call determines what do with responses or executions from UI object
*/
Engine.prototype.Report = function(rObj)
{
	// rObj (Report Object) must contain an rType (Report Type)
	// The rType gets passed into gameLogic, it also checks to make sure that we are not waiting!
	if(rObj.rType && this.gameLogic[rObj.rType]) this.gameLogic[rObj.rType](rObj);
	else if(this.waiting == true) console.log('I am busy nao!');
	else console.log('This rType doesn\'t exist: '+rObj.rType);
};

/*
Example Report Object
rType must be defined
	var rObj =
	{
		rType: 'confirmation',
		locX: 0,
		locY: 2
	};
*/