// GLOBAL VARIABLES ================================================
var ROWS = 7;
var COLUMNS = 7;
//==================================================================

//==================MODEL CLASS=====================================
function Model(){
	// Local Variables
	var grid = initGrid(ROWS, COLUMNS); // calls with global vars

	// Fields
	this.grid = grid;   

	// Public Methods  

	//--Static Methods

	//--Instance Methods               

	// Private Methods
	function initGrid(rows, columns) {
		var grid = [];
		for (var i = 0; i < rows; i++) {
			var row = [];
			for (var j = 0; j < columns; j++) {
				row.push("");
			}
			grid.push(row);
		}
		return grid;
	};

	//console.table(grid);  (TESTING)

} // end of class
//==================================================================

//==================CONTROLLER CLASS================================


function Controller(){
	// Static Variables
	var canvasID = document.getElementById('canvas');
	var view = new View(canvasID);
	var model = new Model();
	canvasID.addEventListener("click",nextState,false);
	
	// Static Methods
	function nextState(e){
		var x_Pos = e.clientX;
		var y_Pos = e.clientY;
		var position = normalize(x_Pos,y_Pos);
		console.log(position.x+","+position.y);

		// will be moved to its own function in due time.
		// quick and dirty check to see if they entered exactly 1 char
		// TODO: check if a-->z
		var letter = prompt("Enter a letter");
		console.log(letter.length);
		if (letter != "" || letter != null) {  // cancel returns null
			if (letter.length == 1) {
				view.addLetter(letter,position.x, position.y);
			} else {
				window.alert("please select a valid letter");
			}
		}
	}

	function normalize(x_Pos,y_Pos){
		var canvasSize = canvasID.getBoundingClientRect();
		

		var deltaX = (canvasSize.right-canvasSize.left)/COLUMNS;
		var deltaY = (canvasSize.bottom-canvasSize.top)/ROWS;

		// rel_x and rel_y are the grid coordinates starting from (0,0) bottom left
		var rel_x = Math.floor(((x_Pos - canvasSize.left)/(deltaX)));
		var rel_y = Math.floor(((y_Pos - canvasSize.top)/(deltaY)));
		return {x:rel_x,
			    y:rel_y
			   };	
	}

	


} // end of Controller class
//==================================================================


//==================VIEW CLASS======================================

function View(canvasID){
	var width =50;  // eventually will be globals
	var height =50;  // designating width of each cell
	
	var ctx = canvasID.getContext('2d');

	// Draws the rectangles
	for(var rows = 0; rows < ROWS; rows++) {
		for (var cols = 0; cols < COLUMNS; cols++) {
			ctx.strokeStyle = "black";
			ctx.fillStyle = "yellow";
			ctx.beginPath();
			ctx.lineWidth = 1;
			ctx.rect(width*rows, height*cols, width, height);
			ctx.closePath();
			ctx.fill();
			ctx.stroke(); 
		}
	}

	this.addLetter = function (letter, x, y) {
		ctx.fillStyle="black";
		ctx.font="25px Georgia";
		ctx.fillText(letter,(15+(x*50)),35+(y*50));
	};


} // end of View Class


@@ -679,16 +679,17 @@
 d;%0A%09%7D;%0A%0A
+%0A
 %09//conso
@@ -1448,38 +1448,8 @@
 %22);%0A
-%09%09console.log(letter.length);%0A
 %09%09if
@@ -1588,16 +1588,125 @@
 ion.y);%0A
+%09%09%09%09model.grid%5Bposition.y%5D%5Bposition.x%5D = letter; // note: opposite%0A%09%09%09%09console.table(model.grid); // TESTING%0A
 %09%09%09%7D els

Update script.js