<commit_before>/* Board.js
	
	Class representing the game board.
*/

(function(sys) {

"use strict";

/* Constructor for Board object.
	canvas - Canvas DOM element.
	context - Canvas 2D context object.
	settings - Settings object for the board.
*/
function Board(canvas, context, settings) {
	// Default parameters
	if (sys.u.isCanvas(canvas) === false) {
		throw new sys.c.GameError(
			"Parameter 'canvas' is not a canvas DOM element.");
	}
	else if (sys.u.isContext(context) === false) {
		throw new sys.c.GameError(
			"Parameter 'context' is not a 2D canvas context.");
	}
	
	/*
	 * PRIVATE VARIABLES
	*/
	
	// Reference to self.
	var mSelf = this,
	
	// Game canvas DOM element.
	mCanvas = canvas,
	
	// Game canvas 2D context object.
	mContext = context,
	
	// Number of grid slots along the x axis.
	mWidth = typeof settings.slotsX === "number" ? settings.slotsX : 32,
	
	// Number of grid slots along the y axis.
	mHeight = typeof settings.slotsY === "number" ? settings.slotsY : 24,
	
	// Single grid slot width.
	mSlotWidth = mCanvas.width / mWidth,
	
	// Single grid slot height.
	mSlotHeight = mCanvas.height / mHeight,
	
	// Cached slot half width.
	mSlotHalfWidth = mSlotWidth * 0.5,
	
	// Cached slot half height.
	mSlotHalfHeight = mSlotHeight * 0.5,
	
	// Grid array.
	mGrid = null;
	
	/*
	 * PUBLIC VARIABLES
	*/
	
	/*
	 * PRIVILEGED FUNCTIONS
	*/
	
	/*
	 * PRIVATE FUNCTIONS
	*/
	
	/* Builds the grid array.
	*/
	function buildGrid() {
		console.log(mSlotWidth);
		console.log(mSlotHeight);
	}
	
	// Initializer
	(function() {
		buildGrid();
	})();
}

/*
 * STATIC FUNCTIONS
*/

/*
 * STATIC INITIALIZERS
*/

sys.c.Board = Board;

})(jsnake);<commit_msg>Added basic matrix creation logic<commit_after>/* Board.js
	
	Class representing the game board.
*/

(function(sys) {

"use strict";

/* Constructor for Board object.
	canvas - Canvas DOM element.
	context - Canvas 2D context object.
	settings - Settings object for the board.
*/
function Board(canvas, context, settings) {
	// Default parameters
	if (sys.u.isCanvas(canvas) === false) {
		throw new sys.c.GameError(
			"Parameter 'canvas' is not a canvas DOM element.");
	}
	else if (sys.u.isContext(context) === false) {
		throw new sys.c.GameError(
			"Parameter 'context' is not a 2D canvas context.");
	}
	
	/*
	 * PRIVATE VARIABLES
	*/
	
	// Reference to self.
	var mSelf = this,
	
	// Game canvas DOM element.
	mCanvas = canvas,
	
	// Game canvas 2D context object.
	mContext = context,
	
	// Number of grid slots along the x axis.
	mWidth = typeof settings.slotsX === "number" ? settings.slotsX : 32,
	
	// Number of grid slots along the y axis.
	mHeight = typeof settings.slotsY === "number" ? settings.slotsY : 24,
	
	// Single grid slot width.
	mSlotWidth = mCanvas.width / mWidth,
	
	// Single grid slot height.
	mSlotHeight = mCanvas.height / mHeight,
	
	// Cached slot half width.
	mSlotHalfWidth = mSlotWidth * 0.5,
	
	// Cached slot half height.
	mSlotHalfHeight = mSlotHeight * 0.5,
	
	// Grid array.
	mGrid = null;
	
	/*
	 * PUBLIC VARIABLES
	*/
	
	/*
	 * PRIVILEGED FUNCTIONS
	*/
	
	/*
	 * PRIVATE FUNCTIONS
	*/
	
	/* Builds the grid array.
	*/
	function buildGrid() {
		if (mGrid !== null) {
			return;
		}
		
		var row = [],
			col, i, j;
		
		for (i=0; i<mWidth; i++) {
			col = [];
			
			for (j=0; j<mHeight; j++) {
				// Add slot
			}
			
			row.push(col);
		}
	}
	
	// Initializer
	(function() {
		buildGrid();
	})();
}

/*
 * STATIC FUNCTIONS
*/

/*
 * STATIC INITIALIZERS
*/

sys.c.Board = Board;

})(jsnake);
{'fraction_non_alphanumeric': 0.13752847380410022, 'fraction_numerical': 0.00683371298405467, 'mean_word_length': 2.6862539349422874, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1329422', 'n_tokens_mistral': 1374, 'n_tokens_neox': 1211, 'n_words': 360}