<commit_before>function boxlog ( message ) {
	el = $( "#log-area" );
	el.text( message + "\n" + el.text() );
}

var LC = {

	tile_width: 20,
	tile_height: 20,

	ctx: null,
	map: null,
	sprites: null,

	sprite_map: {
		// name    :  [ x, y,  w,  h ]
		'cat_west' :  [ 0, 0, 20, 20 ],
		'cat_south':  [ 20, 0, 20, 20 ],
		'cat_east' :  [ 40, 0, 20, 20 ],
		'cat_north':  [ 60, 0, 20, 20 ],
	},

	map_offset: [ 0, 0 ],

	user_offset: [ 0, 0 ],
	user_orientation: 'south',

	objects: [],

	faye: null,

	init: function () {
		LC.ctx = document.getElementById( "objects" ).getContext( "2d" );
		LC.map = $( "#map" );
		LC.sprites = document.getElementById( "sprites" );
		$( 'html' ).live( 'keyup', LC.keyUp );

		$.getJSON( '/init.json', function ( config ) {
			LC.faye = new Faye.Client( "http://" + window.location.hostname + ':' + config.port + '/faye', {
				timeout: 120
			} );
			LC.faye.subscribe( '/join', function ( message ) {
				boxlog( "SOMEBODY JOINED!" );
			} );
			LC.faye.subscribe( '/move', function ( message ) {
				boxlog( "SOMEBODY MOVED!" );
			} );

			LC.user_id = config.uniqueID;
			LC.spawn( config.spawnPoint );
		});

	},

	clearSprite: function ( sprite, x, y ) {
		boxlog( "Clear: " + sprite + " @ " + x + ", " + y );
		LC.ctx.clearRect( x, y, LC.tile_width, LC.tile_height );
	},

	drawSprite: function ( sprite, x, y ) {
		LC.ctx.clearRect( x, y, LC.tile_width, LC.tile_height );
		boxlog( "Draw: " + sprite + " @ " + x + ", " + y );
		LC.ctx.drawImage(
			LC.sprites,
			LC.sprite_map[sprite][0],
			LC.sprite_map[sprite][1],
			LC.sprite_map[sprite][2],
			LC.sprite_map[sprite][3],
			x,
			y,
			LC.sprite_map[sprite][2],
			LC.sprite_map[sprite][3]
		);
	},

	moveMap: function ( x, y ) {
		LC.map_offset[0] = LC.map_offset[0] + x;
		LC.map_offset[1] = LC.map_offset[1] + y;

		if( LC.map_offset[0] < 0 ) { LC.map_offset[0] = 0; }
		if( LC.map_offset[1] < 0 ) { LC.map_offset[1] = 0; }
		if( LC.map_offset[0] >= 500 ) { LC.map_offset[0] = 500; }
		if( LC.map_offset[1] >= 500 ) { LC.map_offset[1] = 500; }

		boxlog( 'Move Map: -' + LC.map_offset[0] + 'px -' + LC.map_offset[1] + 'px' )

		LC.map.css(
			'background-position',
			'-' + LC.map_offset[0] + 'px -' + LC.map_offset[1] + 'px'
		);
	},

	spawn: function ( point ) {
		LC.user_offset = point;
		LC.drawSprite( 'cat_' + LC.user_orientation, LC.user_offset[0], LC.user_offset[1] );
		edge_proximity = [
			( LC.map_offset[0] + 500 - LC.user_offset[0] ),<commit_msg>Make map move to view any random spawn point.<commit_after>function boxlog ( message ) {
	el = $( "#log-area" );
	el.text( message + "\n" + el.text() );
}

var LC = {

	tile_width: 20,
	tile_height: 20,

	ctx: null,
	map: null,
	sprites: null,

	sprite_map: {
		// name    :  [ x, y,  w,  h ]
		'cat_west' :  [ 0, 0, 20, 20 ],
		'cat_south':  [ 20, 0, 20, 20 ],
		'cat_east' :  [ 40, 0, 20, 20 ],
		'cat_north':  [ 60, 0, 20, 20 ],
	},

	map_offset: [ 0, 0 ],

	user_offset: [ 0, 0 ],
	user_orientation: 'south',

	objects: [],

	faye: null,

	init: function () {
		LC.ctx = document.getElementById( "objects" ).getContext( "2d" );
		LC.map = $( "#map" );
		LC.sprites = document.getElementById( "sprites" );
		$( 'html' ).live( 'keyup', LC.keyUp );

		$.getJSON( '/init.json', function ( config ) {
			LC.faye = new Faye.Client( "http://" + window.location.hostname + ':' + config.port + '/faye', {
				timeout: 120
			} );
			LC.faye.subscribe( '/join', function ( message ) {
				boxlog( "SOMEBODY JOINED!" );
			} );
			LC.faye.subscribe( '/move', function ( message ) {
				boxlog( "SOMEBODY MOVED!" );
			} );

			LC.user_id = config.uniqueID;
			LC.spawn( config.spawnPoint );
		});

	},

	clearSprite: function ( sprite, x, y ) {
		boxlog( "Clear: " + sprite + " @ " + x + ", " + y );
		LC.ctx.clearRect( x, y, LC.tile_width, LC.tile_height );
	},

	drawSprite: function ( sprite, x, y ) {
		LC.ctx.clearRect( x, y, LC.tile_width, LC.tile_height );
		boxlog( "Draw: " + sprite + " @ " + x + ", " + y );
		LC.ctx.drawImage(
			LC.sprites,
			LC.sprite_map[sprite][0],
			LC.sprite_map[sprite][1],
			LC.sprite_map[sprite][2],
			LC.sprite_map[sprite][3],
			x,
			y,
			LC.sprite_map[sprite][2],
			LC.sprite_map[sprite][3]
		);
	},

	moveMap: function ( x, y ) {
		LC.map_offset[0] = LC.map_offset[0] + x;
		LC.map_offset[1] = LC.map_offset[1] + y;

		if( LC.map_offset[0] < 0 ) { LC.map_offset[0] = 0; }
		if( LC.map_offset[1] < 0 ) { LC.map_offset[1] = 0; }
		if( LC.map_offset[0] >= 500 ) { LC.map_offset[0] = 500; }
		if( LC.map_offset[1] >= 500 ) { LC.map_offset[1] = 500; }

		boxlog( 'Move Map: -' + LC.map_offset[0] + 'px -' + LC.map_offset[1] + 'px' )

		LC.map.css(
			'background-position',
			'-' + LC.map_offset[0] + 'px -' + LC.map_offset[1] + 'px'
		);
	},

	spawn: function ( point ) {
		LC.user_offset = point;

		boxlog( "Spawn: " + point[0] + ", " + point[1] );

		LC.moveMap( -1 * LC.map_offset[0], -1 * LC.map_offset[1] ); // Back to 0,0
		LC.moveMap( LC.user_offset[0] - 260, LC.user_offset[1] - 260 ); // Move map out to player

		LC.drawSprite(  'cat_' + LC.user_orientation, LC.user_offset[0] - LC.map_offset[0], LC.user_offset[1] - LC.map_offset[1] );

		edge_proximity = [
			( LC.map_offset[0] + 500 - LC.user_offset[0] ),
{'fraction_non_alphanumeric': 0.21149425287356322, 'fraction_numerical': 0.035632183908045977, 'mean_word_length': 2.913793103448276, 'pattern_counts': {'":': 0, '<': 7, '<?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': '615923', 'n_tokens_mistral': 2627, 'n_tokens_neox': 2237, 'n_words': 436}