<commit_before>function Game(scale, dev) {
	var self = this;
	
	generate();

	function generate() {
		self.puzzle = new GameGrid(scale, this, defaultFour[Math.floor(Math.random() * defaultFour.length)]);
		self.starter = new Object();
		for (var rn in self.puzzle.grid) {
			row = new Object();
			for (var cell in self.puzzle.grid[rn]) {
				row[cell] = self.puzzle.grid[rn][cell].getState();
			}
			self.starter[rn] = row;
		}
		buttonSetup();
	}
	
	function buttonSetup() {
		restartButton = document.getElementById('restartBtn');
		restartButton.onclick = function() {
			restart();
		}
		mainMenuButton = document.getElementById('mainMenuBtn');
		mainMenuButton.onclick = function() {
			endGame();
		}
	}
	
	function restart() {
		self.puzzle.destroy();
		self.puzzle = new GameGrid(scale, this, self.starter);<commit_msg>fixed potential bug<commit_after>function Game(scale, dev) {
	var self = this;
	
	generate();

	function generate() {
		self.starter = new Object();
		if (scale == 4) {
			self.puzzle = new GameGrid(scale, this, defaultFour[Math.floor(Math.random() * defaultFour.length)]);
			for (var rn in self.puzzle.grid) {
				row = new Object();
				for (var cell in self.puzzle.grid[rn]) {
					row[cell] = self.puzzle.grid[rn][cell].getState();
				}
				self.starter[rn] = row;
			}
		}
		else {
			emptyGrid = Array.apply(null, Array(scale)).map(function (_, i) {return i;});
			for (var row in emptyGrid) {
				gridRow = new Object();
				for (var cell in emptyGrid) {
					gridRow[cell] = 1;
				}
				self.starter[row] = gridRow;
			}
			self.puzzle = new GameGrid(scale, this, self.starter);
		}
		buttonSetup();
	}
	
	function buttonSetup() {
		restartButton = document.getElementById('restartBtn');
		restartButton.onclick = function() {
			restart();
		}
		mainMenuButton = document.getElementById('mainMenuBtn');
		mainMenuButton.onclick = function() {
			endGame();
		}
	}
	
	function restart() {
		self.puzzle.destroy();
		self.puzzle = new GameGrid(scale, this, self.starter);
{'fraction_non_alphanumeric': 0.15522388059701492, 'fraction_numerical': 0.0009950248756218905, 'mean_word_length': 3.6550925925925926, 'pattern_counts': {'":': 0, '<': 3, '<?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': '282223', 'n_tokens_mistral': 805, 'n_tokens_neox': 671, 'n_words': 145}