{"size": 566, "ext": "js", "max_stars_repo_path": "scripts/free-space.js", "max_stars_repo_name": "marcusoftnet/tankwars", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "scripts/free-space.js", "max_issues_repo_name": "marcusoftnet/tankwars", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "scripts/free-space.js", "max_forks_repo_name": "marcusoftnet/tankwars", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.5833333333, "max_line_length": 69, "alphanum_fraction": 0.5971731449}
/*global module */
module.exports = function freeSpace(existingObjects, width, height) {
	'use strict';
	var allPositions = [],
		result = [],
		index;
	for (index = 0; index < width; index++) {
		allPositions[index] = new Array(height).fill(true);
	}
	existingObjects.forEach(function (ob) {
		if (ob.x >= 0 && ob.x < width && ob.y >= 0 && ob.y < height) {
			allPositions[ob.x][ob.y] = false;
		}
	});
	allPositions.forEach(function (column, x) {
		column.forEach(function (val, y) {
			if (val) {
				result.push({x: x, y: y});
			}
		});
	});
	return result;
};
