<commit_before>/* Copyright 2015 <NAME>.

   This file is part of Dash and the Jetpack Space Pirates.  The Dash
   and the Jetpack Space Pirates source code is distributed under the
   terms of the MIT license.  See LICENSE.txt for details. */
'use strict';

var color = require('./color');
var param = require('./param');
var util = require('./util');

/*
 * Emit the floor and ceiling tiles.
 *
 * tiles: The tiles layer
 * minX: The leftmost edge to generate
 * maxX: The right edge to generate
 * dirY: The vertical direction of tiles (ceiling +1, floor -1)
 * posY: The edge of the tile, vertically
 */
function emitBorder(tiles, minX, maxX, dirY, posY) {
	var remW = Math.floor((1 + maxX - minX) * 0.5);
	var state = Math.random() < 0.5 || remW <= 5;
	var x = minX;
	var newTiles = [];
	while (remW > 0) {
		var tw, th;
		if (state) {
			tw = util.randInt(3, 5);
			th = 3;
			state = false;
		} else {
			tw = util.randInt(5, 10);
			th = 2;
			state = true;
		}
		if (tw >= remW) {
			tw = remW;
		} else if (tw >= remW - 2) {
			if (tw < 5) {
				tw = remW;
			} else {
				tw -= 2;
			}
		}
		remW -= tw;
		newTiles.push({
			x: x + tw,
			y: posY + th * dirY,
			w: tw * 2,
			h: th * 2,
			color: color.rgb(Math.random(), Math.random(), Math.random()),
		});
		x += tw * 2;
	}
	tiles.add(newTiles);
}

/*
 * A segment of a level.
 */
function Segment() {
	this.length = 1000;
}

/*
 * Activate the segment.
 */
Segment.prototype.activate = function(game) {
	game.tiles.clear();
	var height = param.LevelY * 0.5;
	var floor = height * -0.5, ceiling = height * 0.5;
	emitBorder(game.tiles, -32, +128, -1, floor);
	emitBorder(game.tiles, -32, +128, +1, ceiling);
};

module.exports = {
	Segment: Segment,
};<commit_msg>remove debugging code<commit_after>/* Copyright 2015 <NAME>.

   This file is part of Dash and the Jetpack Space Pirates.  The Dash
   and the Jetpack Space Pirates source code is distributed under the
   terms of the MIT license.  See LICENSE.txt for details. */
'use strict';

var color = require('./color');
var param = require('./param');
var util = require('./util');

/*
 * Emit the floor and ceiling tiles.
 *
 * tiles: The tiles layer
 * minX: The leftmost edge to generate
 * maxX: The right edge to generate
 * dirY: The vertical direction of tiles (ceiling +1, floor -1)
 * posY: The edge of the tile, vertically
 */
function emitBorder(tiles, minX, maxX, dirY, posY) {
	var remW = Math.floor((1 + maxX - minX) * 0.5);
	var state = Math.random() < 0.5 || remW <= 5;
	var x = minX;
	var newTiles = [];
	while (remW > 0) {
		var tw, th;
		if (state) {
			tw = util.randInt(3, 5);
			th = 3;
			state = false;
		} else {
			tw = util.randInt(5, 10);
			th = 2;
			state = true;
		}
		if (tw >= remW) {
			tw = remW;
		} else if (tw >= remW - 2) {
			if (tw < 5) {
				tw = remW;
			} else {
				tw -= 2;
			}
		}
		remW -= tw;
		newTiles.push({
			x: x + tw,
			y: posY + th * dirY,
			w: tw * 2,
			h: th * 2,
			color: color.rgb(Math.random(), Math.random(), Math.random()),
		});
		x += tw * 2;
	}
	tiles.add(newTiles);
}

/*
 * A segment of a level.
 */
function Segment() {
	this.length = 1000;
}

/*
 * Activate the segment.
 */
Segment.prototype.activate = function(game) {
	game.tiles.clear();
	var height = param.LevelY;
	var floor = height * -0.5, ceiling = height * 0.5;
	emitBorder(game.tiles, -32, +128, -1, floor);
	emitBorder(game.tiles, -32, +128, +1, ceiling);
};

module.exports = {
	Segment: Segment,
};
{'fraction_non_alphanumeric': 0.16194331983805668, 'fraction_numerical': 0.027183342972816656, 'mean_word_length': 2.679787234042553, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '5581443', 'n_tokens_mistral': 1465, 'n_tokens_neox': 1296, 'n_words': 429}