<commit_before>(function() {
	/**
	 * Main script for the game AD. Uses canvas to display the game board.
	 */

	// Creation of the 4 arrows to move the rows and columns.
	// attributes strings
	var cellSize = 'cellSize',
		gridWidth = 'gridWidth',
		grid = 'grid',
		sCanvas = 'canvas',
		click = 'click',
		img = 'img',
		moves = 'moves',
		pngMime = 'image/png',

		d = document, createElement = 'createElement',
		arrow = d[createElement](sCanvas),
		controlSize = 100,
		controlThird = controlSize / 3,
		controlTwoThird = controlThird * 2,
		controlHalf = controlSize / 2,
		controls = [
			[
				d[createElement](img),
				[controlThird, controlThird],
				[controlTwoThird, controlThird],
				[controlHalf, controlTwoThird]
			],
			[
				d[createElement](img),
				[controlTwoThird, controlThird],
				[controlTwoThird, controlTwoThird],
				[controlThird, controlHalf]
			],
			[
				d[createElement](img),
				[controlThird, controlTwoThird],
				[controlTwoThird, controlTwoThird],
				[controlHalf, controlThird]
			],
			[
				d[createElement](img),
				[controlThird, controlThird],
				[controlThird, controlTwoThird],
				[controlTwoThird, controlHalf]
			]
		],
		ctx,
		c,
		und = undefined,
		// attributes strings
		apply = "apply",
		getContext = "getContext",
		_256 = 256,
		_Math = Math,
		length = 'length',
		_controlButtons = '_controlButtons',

		// Methods
		ad,
		_init,
		_createInformationsTable,
		_getInformation,
		_updateInformation,
		_randomInt,
		_generateColors,
		_generateGrid,
		_displayGrid,
		_clickEvent,
		_onControl,
		_setEvents,
		_detectBlobs;

	if (!arrow[getContext]) {
		throw 'This browser does not support the use of canvas';
	}

	arrow.width = arrow.height = controlSize;
	ctx = arrow[getContext]('2d');

	ctx.fillStyle = '#888';
	ctx.strokeRect(0, 0, controlSize, controlSize);
	for (c = 0; c < 4; c++) {
		ctx.clearRect(1, 1, controlSize - 2, controlSize - 2);
		ctx.beginPath();
		ctx.moveTo(controls[c][1][0], controls[c][1][1]);
		ctx.lineTo(controls[c][2][0], controls[c][2][1]);
		ctx.lineTo(controls[c][3][0], controls[c][3][1]);
		ctx.fill();
		controls[c][0].src = arrow.toDataURL(pngMime).replace(pngMime, "image/octet-stream");
	}

	/**
	 * Game construct
	 */
	ad = function(parent, options) {
		var tmp, size, canvas;
		if (parent.tagName != 'DIV') {
			tmp = B.create('div');
			parent.parentNode.replaceChild(tmp, parent);
			parent = tmp;
		}

		this.parent = parent;
		options = options || {};
		size = options.size||300;
		canvas = B.create(sCanvas, {width: size, height: size}, this.parent);

		this.ctx = canvas[getContext]('2d');
		this[_controlButtons] = [],
		_init[apply](this, [options.nbCellsSide||4, options.nbColors||4]);
	};

	_createInformationsTable = function() {
		this.infos = {blobs: ['Blobs', 0], moves: [moves, 0], colors: ['Colors', this.colors.length]};

		Object.keys(this.infos).forEach(function(key) {
			this.infos[key][1] = B.create('span', {text: this.infos[key][1]}, B.create('div', {text: this.infos[key][0] + ': '}, this.parent));
		}.bind(this));
	};

	_getInformation = function(info) {
		return this.infos[info] ? 0|this.infos[info][1].innerHTML : false;
	};

	_updateInformation = function(info, value) {
		if (!this.infos[info]) return false;

		this.infos[info][1].innerHTML = value;
	};

	/**
	 * Method to init the game
	 * Private method
	 */
	_init = function(gridWidth, nbColors) {
		_generateColors[apply](this, [nbColors]);
		_generateGrid[apply](this, [gridWidth, nbColors]);
		_displayGrid[apply](this, [true]);
		_createInformationsTable[apply](this);
		_detectBlobs[apply](this);
		_setEvents[apply](this);
	};

	/**
	 * Method to generate a random integer
	 *
	 * Private method
	 */
	_randomInt = function(maxExcluded) {
		return 0 | _Math.random() * maxExcluded;
	};<commit_msg>this stored in a variable<commit_after>(function() {
	/**
	 * Main script for the game AD. Uses canvas to display the game board.
	 */

	// Creation of the 4 arrows to move the rows and columns.
	// attributes strings
	var cellSize = 'cellSize',
		gridWidth = 'gridWidth',
		grid = 'grid',
		sCanvas = 'canvas',
		click = 'click',
		img = 'img',
		moves = 'moves',
		pngMime = 'image/png',

		d = document, createElement = 'createElement',
		arrow = d[createElement](sCanvas),
		controlSize = 100,
		controlThird = controlSize / 3,
		controlTwoThird = controlThird * 2,
		controlHalf = controlSize / 2,
		controls = [
			[
				d[createElement](img),
				[controlThird, controlThird],
				[controlTwoThird, controlThird],
				[controlHalf, controlTwoThird]
			],
			[
				d[createElement](img),
				[controlTwoThird, controlThird],
				[controlTwoThird, controlTwoThird],
				[controlThird, controlHalf]
			],
			[
				d[createElement](img),
				[controlThird, controlTwoThird],
				[controlTwoThird, controlTwoThird],
				[controlHalf, controlThird]
			],
			[
				d[createElement](img),
				[controlThird, controlThird],
				[controlThird, controlTwoThird],
				[controlTwoThird, controlHalf]
			]
		],
		ctx,
		c,
		und = undefined,
		// attributes strings
		apply = "apply",
		getContext = "getContext",
		_256 = 256,
		_Math = Math,
		length = 'length',
		_controlButtons = '_controlButtons',

		// Methods
		ad,
		_init,
		_createInformationsTable,
		_getInformation,
		_updateInformation,
		_randomInt,
		_generateColors,
		_generateGrid,
		_displayGrid,
		_clickEvent,
		_onControl,
		_setEvents,
		_detectBlobs;

	if (!arrow[getContext]) {
		throw 'This browser does not support the use of canvas';
	}

	arrow.width = arrow.height = controlSize;
	ctx = arrow[getContext]('2d');

	ctx.fillStyle = '#888';
	ctx.strokeRect(0, 0, controlSize, controlSize);
	for (c = 0; c < 4; c++) {
		ctx.clearRect(1, 1, controlSize - 2, controlSize - 2);
		ctx.beginPath();
		ctx.moveTo(controls[c][1][0], controls[c][1][1]);
		ctx.lineTo(controls[c][2][0], controls[c][2][1]);
		ctx.lineTo(controls[c][3][0], controls[c][3][1]);
		ctx.fill();
		controls[c][0].src = arrow.toDataURL(pngMime).replace(pngMime, "image/octet-stream");
	}

	/**
	 * Game construct
	 */
	ad = function(parent, options) {
		var tmp, size, canvas;
		if (parent.tagName != 'DIV') {
			tmp = B.create('div');
			parent.parentNode.replaceChild(tmp, parent);
			parent = tmp;
		}

		this.parent = parent;
		options = options || {};
		size = options.size||300;
		canvas = B.create(sCanvas, {width: size, height: size}, this.parent);

		this.ctx = canvas[getContext]('2d');
		this[_controlButtons] = [],
		_init[apply](this, [options.nbCellsSide||4, options.nbColors||4]);
	};

	_createInformationsTable = function() {
		this.infos = {blobs: ['Blobs', 0], moves: [moves, 0], colors: ['Colors', this.colors.length]};

		Object.keys(this.infos).forEach(function(key) {
			this.infos[key][1] = B.create('span', {text: this.infos[key][1]}, B.create('div', {text: this.infos[key][0] + ': '}, this.parent));
		}.bind(this));
	};

	_getInformation = function(info) {
		return this.infos[info] ? 0|this.infos[info][1].innerHTML : false;
	};

	_updateInformation = function(info, value) {
		if (!this.infos[info]) return false;

		this.infos[info][1].innerHTML = value;
	};

	/**
	 * Method to init the game
	 * Private method
	 */
	_init = function(gridWidth, nbColors) {
		var that = this;
		_generateColors[apply](that, [nbColors]);
		_generateGrid[apply](that, [gridWidth, nbColors]);
		_displayGrid[apply](that, [true]);
		_createInformationsTable[apply](that);
		_detectBlobs[apply](that);
		_setEvents[apply](that);
	};

	/**
	 * Method to generate a random integer
	 *
	 * Private method
	 */
	_randomInt = function(maxExcluded) {
		return 0 | _Math.random() * maxExcluded;
	};
{'fraction_non_alphanumeric': 0.16463813636958513, 'fraction_numerical': 0.013872529773589845, 'mean_word_length': 3.978501628664495, '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': '1623985', 'n_tokens_mistral': 3073, 'n_tokens_neox': 2639, 'n_words': 559}