<commit_before>function help(){
	//pass in a function name and it will return the help property of the function.
	if (arguments.length == 0){
		console.log("This is a console game where you type javascript methods into the console to do something.");
		console.log("Type \"Help(<verb>)\" to get specific help on a method.")
		console.log("Known methods are, go, walk, run, climb.")
	} else {
		for (var i = 0; i < arguments.length; i += 1){
			console.log(arguments[i].help);
		}
	}
}

function Motion(action){
	this.help = "Type " + action + ".direction(\"<direction word>\") in the console to " + action + " in that direction.";
	this.validDirections = ["north", "n", "south", "s", "east", "e", "west", "w"];

	this.direction = function(dir){
		if (this.validDirections.indexOf(dir) == -1) {
			console.log("you can't " + action + " " + dir);
		} else {
			var dirText = (dir.length == 1) ? this.validDirections[this.validDirections.indexOf(dir) - 1 ] : dir;
			console.log("You " + action + " " + dirText);
		}	
	}
}

var go = new Motion("go");
var run = new Motion("run");
var walk = new Motion("walk");
var climb = new Motion("climb");
climb.validDirections = ["up", "u", "down", "d"];

<commit_msg>Adding options to the Motion method<commit_after>function help(){
	//pass in a function name and it will return the help property of the function.
	if (arguments.length == 0){
		console.log("This is a console game where you type javascript methods into the console to do something.");
		console.log("Type \"Help(<verb>)\" to get specific help on a method.")
		console.log("Known methods are, go, walk, run, climb.")
	} else {
		for (var i = 0; i < arguments.length; i += 1){
			console.log(arguments[i].help);
		}
	}
}

function Motion(action, options){
	this.defaultOptions = {
		directions: ["north", "n", "south", "s", "east", "e", "west", "w"]
	}
	
	// go through the default options. If the options that were passed in do not 
	// include some of the keys, add them in from the defaults so options is a full set
	for (var attrname in options) { 
		if (options[attrname] == undefined)
		 	options[attrname] = this.defaultOptions[attrname]; 
	}
    	
	
	this.help = "Type " + action + ".direction(\"<direction word>\") in the console to " + action + " in that direction.";

	this.direction = function(dir){
		if (this.options['directions'].indexOf(dir) == -1) {
			console.log("you can't " + action + " " + dir);
		} else {
			var dirText = (dir.length == 1) ? this.options['directions'][this.options['directions'].indexOf(dir) - 1 ] : dir;
			console.log("You " + action + " " + dirText);
		}	
	}
}

var go = new Motion("go");
var run = new Motion("run");
var walk = new Motion("walk");
var climb = new Motion("climb", {
	directions: ["up", "u", "down", "d"]
});


{'fraction_non_alphanumeric': 0.17424242424242425, 'fraction_numerical': 0.004329004329004329, 'mean_word_length': 3.7, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '4677147', 'n_tokens_mistral': 978, 'n_tokens_neox': 890, 'n_words': 302}