<commit_before>/*global THREE*/

/**
 * CG Space Invaders
 * Game field - CG45179 16'17
 *
 * @author: <NAME> ( ist181045 )
 * @author: <NAME> ( ist181586 )
 * @author: <NAME> ( ist181700 )
 */

class Field extends THREE.Object3D {

	constructor( x, y, z, w = 250, l = 250 ) {

		super();

		this.type = 'Field';

		this._width  = w;
		this._length = l;

		this._buildField( 0, 0, 0 );

		this.position.set( x, y, z );

	}

	get width () {

		return this._width;

	}

	get length () {

		return this._length;

	}

	_buildField ( x, y, z ) {

		let w = this._width;
		let l = this._length;

		console.log( `${w} : ${l}` );

		let barriers = new THREE.Group();

		let barrierMaterial = new THREE.MeshBasicMaterial( {
			color: new THREE.Color( 0xFFFFFF )
		} );

		let floorMaterial = new THREE.MeshBasicMaterial( {
			color: new THREE.Color( 0x1A1A1A ),
			side: THREE.DoubleSide
		} );

		this.children.splice( 0, this.children.length );

		this._addFloor( this, x, y, z, floorMaterial );
		this._addVerticalBarrier( barriers, x + w / -2, y, z, barrierMaterial );
		this._addVerticalBarrier( barriers, x + w /  2, y, z, barrierMaterial );
		this._addHorizontalBarrier( barriers, x, y, z + l / -2, barrierMaterial );
		this._addHorizontalBarrier( barriers, x, y, z + l /  2, barrierMaterial );

		this.add( barriers );

	}


	_addFloor ( obj, x, y, z, material ) {

		let geometry = new THREE.PlaneGeometry( this._width, this._length );
		let mesh = new THREE.Mesh( geometry, material );

		mesh.position.set( x, y, z );
		mesh.rotateX( Math.PI / -2 );
		
		obj.add( mesh );

	}

	_addVerticalBarrier ( obj, x, y, z, material ) {

		let geometry = new THREE.CubeGeometry( 4, 2, this._length );
		let mesh = new THREE.Mesh( geometry, material );

		mesh.position.set( x > 0 ? x - 2 : x + 2, y, z );

		obj.add( mesh );
<commit_msg>Remove clog, refactor<commit_after>/*global THREE*/

/**
 * CG Space Invaders
 * Game field - CG45179 16'17
 *
 * @author: <NAME> ( ist181045 )
 * @author: <NAME> ( ist181586 )
 * @author: <NAME> ( ist181700 )
 */

class Field extends THREE.Object3D {

	constructor( x, y, z, w = 250, l = 250 ) {

		super();

		this.type = 'Field';

		this._width  = w;
		this._length = l;

		this._buildField( 0, 0, 0 );

		this.position.set( x, y, z );

	}

	get width () {

		return this._width;

	}

	get length () {

		return this._length;

	}

	_buildField ( x, y, z ) {

		let w = this._width;
		let l = this._length;

		let barriers = new THREE.Group();

		let barrierMaterial = new THREE.MeshBasicMaterial( {
			color: new THREE.Color( 0xFFFFFF )
		} );

		let floorMaterial = new THREE.MeshBasicMaterial( {
			color: new THREE.Color( 0x1A1A1A ),
			side: THREE.DoubleSide
		} );

		this.children.splice( 0, this.children.length );

		this._addFloor( this, x, y, z, floorMaterial );
		this._addVerticalBarrier( barriers, x + w / -2, y, z, barrierMaterial );
		this._addVerticalBarrier( barriers, x + w /  2, y, z, barrierMaterial );
		this._addHorizontalBarrier( barriers, x, y, z + l / -2, barrierMaterial );
		this._addHorizontalBarrier( barriers, x, y, z + l /  2, barrierMaterial );

		this.add( barriers );

	}

	_addFloor ( obj, x, y, z, material ) {

		let geometry = new THREE.PlaneGeometry( this._width, this._length );
		let mesh = new THREE.Mesh( geometry, material );

		mesh.position.set( x, y, z );
		mesh.rotateX( Math.PI / -2 );

		obj.add( mesh );

	}

	_addVerticalBarrier ( obj, x, y, z, material ) {

		let geometry = new THREE.CubeGeometry( 4, 2, this._length );
		let mesh = new THREE.Mesh( geometry, material );

		mesh.position.set( x > 0 ? x - 2 : x + 2, y, z );

		obj.add( mesh );

{'fraction_non_alphanumeric': 0.15261707988980716, 'fraction_numerical': 0.029201101928374655, 'mean_word_length': 2.916936353829558, 'pattern_counts': {'":': 0, '<': 9, '<?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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5772363', 'n_tokens_mistral': 1533, 'n_tokens_neox': 1302, 'n_words': 375}