<commit_before>// when the user first naviagates to the page, hide everything but a form
// - accomplish this with CSS selectors and manipulation of the DOM
// when they enter information into the form it disappears and the game begins

// restrict input to string elements
// initializing game, should only be called once.
// creates a game state

// ########### model
// used only for persistence purposes, not involved in game logic
var User = function (name, score) {
    this.name = name;
    this.score = score;
}

// essentially the logical module of the game
var Round = function (color) {
    this.correctcolor = color; // the correct color 
    // this is where the below method will be called
    this.displaycolor = displayDetermine(color);
    this.match = ((this.correctcolor === this.displaycolor) ? true : false);
};


function displayDetermine(colorString) {
    var x = Math.floor(Math.random()*10);
    // only generate based on whether or not the random number is greater than 5
    if(x < 5) {
	var listOfColors = ['red', 'green', 'blue', 'purple','yellow', 'gray'];
	// now we must remove the above colorString from the below list of colors.
	for (var y in listOfColors) {
	    if (listOfColors[y] === colorString) {
		var omission = listOfColors.splice(y, 1);
	    }
	}
	// now the dom background as the color of x in listOfColors
	// dom.css.color = listOfColors[x];
	return listOfColors[x];
    }
    else {
	return colorString;
    }
};

// ##################### controller

var name = prompt('Please enter your name');
var x = begin(name);
function begin(name) {
    if (name != null && name != "") {
	var player = new User(name, 0);
	// the name should be retrieved from the controller
	var listofrounds = []; // used for when we repeat the below list
	var listOfColors = ['red', 'green', 'blue', 'purple','yellow', 'gray'];

	// inside of the event listener I need to consider the following:
	// the index of the listOfColors, assuming that I'm not looping
	// the player and the round
	var fail = false;
	var i = 0;
	var input;
	var individualround = new Round(listOfColors[i]);
	console.log(individualround);
	listofrounds.push(individualround);
	document.addEventListener('keydown', function temporaryEventListener(event) {
	    if (event.keyCode != 89 && event.keyCode != 78 && event.keyCode != 74 && event.keyCode != 75) {
		console.log('whiff');
	    }
	    else {
		// scaling stub, not being used atm
		// added for debug, to help us cheat :)
		// retrieves user input
		if(event.keyCode == 89|| event.keyCode != 74) {
		    i++;
		    console.log('yes!');
		    input = true;
		}if (event.keyCode == 78 || event.keyCode != 75) {
		    console.log('no!');
		    input = false;
		}
		if (i > 5) {
		    i = 0;
		}
		if (input == individualround.match) {
		    player.score++;
		    console.log('correct');
		}
		if (input != individualround.match) {
		    console.log('wrong');<commit_msg>Oops! I think my hands were broken last night. changed a != to a ==<commit_after>// when the user first naviagates to the page, hide everything but a form
// - accomplish this with CSS selectors and manipulation of the DOM
// when they enter information into the form it disappears and the game begins

// restrict input to string elements
// initializing game, should only be called once.
// creates a game state

// ########### model
// used only for persistence purposes, not involved in game logic
var User = function (name, score) {
    this.name = name;
    this.score = score;
}

// essentially the logical module of the game
var Round = function (color) {
    this.correctcolor = color; // the correct color 
    // this is where the below method will be called
    this.displaycolor = displayDetermine(color);
    this.match = ((this.correctcolor === this.displaycolor) ? true : false);
};


function displayDetermine(colorString) {
    var x = Math.floor(Math.random()*10);
    // only generate based on whether or not the random number is greater than 5
    if(x < 5) {
	var listOfColors = ['red', 'green', 'blue', 'purple','yellow', 'gray'];
	// now we must remove the above colorString from the below list of colors.
	for (var y in listOfColors) {
	    if (listOfColors[y] === colorString) {
		var omission = listOfColors.splice(y, 1);
	    }
	}
	// now the dom background as the color of x in listOfColors
	// dom.css.color = listOfColors[x];
	return listOfColors[x];
    }
    else {
	return colorString;
    }
};

// ##################### controller

var name = prompt('Please enter your name');
var x = begin(name);
function begin(name) {
    if (name != null && name != "") {
	var player = new User(name, 0);
	// the name should be retrieved from the controller
	var listofrounds = []; // used for when we repeat the below list
	var listOfColors = ['red', 'green', 'blue', 'purple','yellow', 'gray'];

	// inside of the event listener I need to consider the following:
	// the index of the listOfColors, assuming that I'm not looping
	// the player and the round
	var fail = false;
	var i = 0;
	var input;
	// 
	var individualround = new Round(listOfColors[i]);
	console.log(individualround);
	listofrounds.push(individualround);
	document.addEventListener('keydown', function temporaryEventListener(event) {
	    if (event.keyCode != 89 && event.keyCode != 78 && event.keyCode != 74 && event.keyCode != 75) {
		console.log('whiff');
	    }
	    else {
		// read key code
		if(event.keyCode == 89|| event.keyCode == 74) {
		    i++;
		    console.log('yes!');
		    input = true;
		}if (event.keyCode == 78 || event.keyCode == 75) {
		    i++;
		    console.log('no!');
		    input = false;
		}
		// reset counter for iterator loop
		if (i > 5) {
		    i = 0;
		}
		// if the user addresses the presented problem correctly
		if (input == individualround.match) {
		    player.score++;
		    console.log('correct');
		}
		// incorrect
		if (input != individualround.match) {
		    console.log('wrong');
{'fraction_non_alphanumeric': 0.1354306864064603, 'fraction_numerical': 0.008411843876177659, 'mean_word_length': 3.189570119802678, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4070840', 'n_tokens_mistral': 1898, 'n_tokens_neox': 1759, 'n_words': 658}