<commit_before>/*
	pin 0 - positive
	pin 1 - negative
*/

let Board = function Board(w, h) {
	let width = 15,
		height = 15,
		board = new Array(width);
	
	for(let row = 0; row < width; row++){
		board[row] = new Array(height);
	}
	
	// To place component pins into respective slots
	function place(/*component, [x1,y1], [x2,y2], ...*/) {
		let component = arguments[0],
		    pins = arguments[1];
		
		Array.prototype.forEach.call(pins, (position, index) => {
		    let x = position[0],
				y = position[1];
			
			// Initialise to be a Slot if it is not one yet
			if(!board[x][y])
				board[x][y] = Slot(x,y);
			
			// Add the component to this Slot
			board[x][y].add(component, index);
		});
	}
	
	return {
		board: board,
		place: place
	};
};

let Slot = function Slot(x, y) {
	if(!isNumber(x) || !isNumber(y) || x < 0 || y < 0)
		logger('x and y has to be positive numbers');
	// To do: validate negatives
	
    let V = 0, // voltage of this slot
	    connected = new Map();
	/*
		key - component_id
		value - {
			pin,
			object
		}
	*/
	
	// Count only non-disabled components
	function connCount() {
		let count = 0;
		connected.forEach((component)=> { 
			if(!component.object.disabled) count++; 
		});
		return count;
	}
	
	// Count all components
	function realCount() {
		return connected.size;
	}
	
	// Add component
	function add(component, pin_index) {
		connected.set(
			component.id, 
			{ 
				index: pin_index, 
				object: component 
			}
		);
	}
	
	// Remove component
	function remove(component) {
		connected.delete(component.id);
	}
	
	// Check if True node - more than 3 non-disabled components connected
	function isTrueNode() {
		return connCount() >= 3;
	}
	
	return {
		V: V,
		x: () => x,
		y: () => y,
		get realCount() { return realCount(); },
		get connCount() { return connCount(); },
		get connections() { return connected; },
		add: add,
		remove: remove
	};
};

let Component = function Component(config) {
	let id = (Date.now() + Math.random()).toString(),
		type = config.type || 0 , // To do: Add component types
	    label = config.label || 'Component-'+id,
	    pins = [],
		V, R, I,
		openEnded = true || false,
		disabled = true || false,
		traveled = true || false;
	
	function isOpenEnded() {
		return openEnded;
	}
	
	function isDisabled() {
		return disabled;
	}
	
	function isTraveled() {
		return traveled;
	}
	
	function setDisabled(bool) {
		disabled = bool;
	}

	function setTraveled(bool) {
		traveled = bool;
	}
	
	function place(/*[x1,y1], [x2,y2], ...*/) {
		Array.prototype.forEach.call(arguments, (pin_position, index)=>{
			pins[index] = pin_position;
		});
		<commit_msg>Removing unused functions<commit_after>/*
	pin 0 - positive
	pin 1 - negative
*/

let Board = function Board(w, h) {
	let width = 15,
		height = 15,
		board = new Array(width);
	
	for(let row = 0; row < width; row++){
		board[row] = new Array(height);
	}
	
	// To place component pins into respective slots
	function place(/*component, [x1,y1], [x2,y2], ...*/) {
		let component = arguments[0],
		    pins = arguments[1];
		
		Array.prototype.forEach.call(pins, (position, index) => {
		    let x = position[0],
				y = position[1];
			
			// Initialise to be a Slot if it is not one yet
			if(!board[x][y])
				board[x][y] = Slot(x,y);
			
			// Add the component to this Slot
			board[x][y].add(component, index);
		});
	}
	
	return {
		board: board,
		place: place
	};
};

let Slot = function Slot(x, y) {
	if(!isNumber(x) || !isNumber(y) || x < 0 || y < 0)
		logger('x and y has to be positive numbers');
	// To do: validate negatives
	
    let V = 0, // voltage of this slot
	    connected = new Map();
	/*
		key - component_id
		value - {
			pin,
			object
		}
	*/
	
	// Count only non-disabled components
	function connCount() {
		let count = 0;
		connected.forEach((component)=> { 
			if(!component.object.disabled) count++; 
		});
		return count;
	}
	
	// Count all components
	function realCount() {
		return connected.size;
	}
	
	// Add component
	function add(component, pin_index) {
		connected.set(
			component.id, 
			{ 
				index: pin_index, 
				object: component 
			}
		);
	}
	
	// Remove component
	function remove(component) {
		connected.delete(component.id);
	}
	
	// Check if True node - more than 3 non-disabled components connected
	function isTrueNode() {
		return connCount() >= 3;
	}
	
	return {
		V: V,
		x: () => x,
		y: () => y,
		get realCount() { return realCount(); },
		get connCount() { return connCount(); },
		get connections() { return connected; },
		add: add,
		remove: remove
	};
};

let Component = function Component(config) {
	let id = (Date.now() + Math.random()).toString(),
	    pins = [],
		type = config.type || 0 , // To do: Add component types
	    label = config.label || 'Component-'+id,
		V = config.V || 0,
		R = config.R || 0,
		I = config.I || 0,
		openEnded = config.openEnded || false,
		disabled = config.disabled || false,
		traveled = config.traveled || false;
	
	function place(/*[x1,y1], [x2,y2], ...*/) {
		Array.prototype.forEach.call(arguments, (pin_position, index)=>{
			pins[index] = pin_position;
		});
		
{'fraction_non_alphanumeric': 0.15871774824081314, 'fraction_numerical': 0.01075058639562158, 'mean_word_length': 2.801634472511144, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, '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': '1016490', 'n_tokens_mistral': 2038, 'n_tokens_neox': 1751, 'n_words': 494}