placeBlock() {
		let lastBlock = this.getLastBlock();

		// Check for overlap
		if (this.placedBlocks.length > 0) {
			if (this.posx >= lastBlock.posx + lastBlock.length || this.posx + this.length - 1 < lastBlock.posx) {
				// Missed it, game over
				this.running = false;
				this.vuePage.running = false;
				this.reset();
				this.vuePage.score = 0;
				return;
			}
		}

		// Valid move
		
		// Check if we need to cut off the next block
		let newBlock = {"posx": this.posx, "posy": this.posy, "length": this.length};
		if (this.placedBlocks.length > 0) {
			if (this.posx == lastBlock.posx) {
				// Same spot
				this.length = Math.min(this.length, lastBlock.length);
				newBlock.length = this.length;
			} else if (this.posx < lastBlock.posx) {
				// Left of last block
				let overhang = lastBlock.posx - this.posx;
				this.length -= overhang;
				newBlock.posx = this.posx + overhang;
				newBlock.length = this.length;
			} else {
				// Right of last block
				let overhang = this.posx - lastBlock.posx;
				this.length -= overhang;
				newBlock.posx = this.posx;
				newBlock.length = this.length;
			}
		}

		// Place the block, move up
		this.placedBlocks.push(newBlock);
		this.posy--;

		this.vuePage.score += this.length;

		// Win the game
		if (this.posy < 0) {
			this.running = false;
			this.vuePage.running = false;
			accessHighscores.updateHighscores(this.vuePage.score, prompt("Enter a name:", "stacker"));
			this.reset();
		}
	}
/*
     * Name: placeBlock
     * Description: Places the block that the user is holding and moves the cursor up
     * Return: None
    */
placeBlock
Description: Places the block that the user is holding and moves the cursor up
Return: None
placeBlock Description : Places the block that the user is holding and moves the cursor up Return : None
placeBlock() {
		let lastBlock = this.getLastBlock();
		if (this.placedBlocks.length > 0) {
			if (this.posx >= lastBlock.posx + lastBlock.length || this.posx + this.length - 1 < lastBlock.posx) {
				this.running = false;
				this.vuePage.running = false;
				this.reset();
				this.vuePage.score = 0;
				return;
			}
		}
		let newBlock = {"posx": this.posx, "posy": this.posy, "length": this.length};
		if (this.placedBlocks.length > 0) {
			if (this.posx == lastBlock.posx) {
				this.length = Math.min(this.length, lastBlock.length);
				newBlock.length = this.length;
			} else if (this.posx < lastBlock.posx) {
				let overhang = lastBlock.posx - this.posx;
				this.length -= overhang;
				newBlock.posx = this.posx + overhang;
				newBlock.length = this.length;
			} else {
				let overhang = this.posx - lastBlock.posx;
				this.length -= overhang;
				newBlock.posx = this.posx;
				newBlock.length = this.length;
			}
		}
		this.placedBlocks.push(newBlock);
		this.posy--;
		this.vuePage.score += this.length;
		if (this.posy < 0) {
			this.running = false;
			this.vuePage.running = false;
			accessHighscores.updateHighscores(this.vuePage.score, prompt("Enter a name:", "stacker"));
			this.reset();
		}
	}
placeBlock ( ) { let lastBlock = this . getLastBlock ( ) ; if ( this . placedBlocks . length > 0 ) { if ( this . posx >= lastBlock . posx + lastBlock . length || this . posx + this . length - 1 < lastBlock . posx ) { this . running = false ; this . vuePage . running = false ; this . reset ( ) ; this . vuePage . score = 0 ; return ; } } let newBlock = { "posx" : this . posx , "posy" : this . posy , "length" : this . length } ; if ( this . placedBlocks . length > 0 ) { if ( this . posx == lastBlock . posx ) { this . length = Math . min ( this . length , lastBlock . length ) ; newBlock . length = this . length ; } else if ( this . posx < lastBlock . posx ) { let overhang = lastBlock . posx - this . posx ; this . length -= overhang ; newBlock . posx = this . posx + overhang ; newBlock . length = this . length ; } else { let overhang = this . posx - lastBlock . posx ; this . length -= overhang ; newBlock . posx = this . posx ; newBlock . length = this . length ; } } this . placedBlocks . push ( newBlock ) ; this . posy -- ; this . vuePage . score += this . length ; if ( this . posy < 0 ) { this . running = false ; this . vuePage . running = false ; accessHighscores . updateHighscores ( this . vuePage . score , prompt ( "Enter a name:" , "stacker" ) ) ; this . reset ( ) ; } }
Name: placeBlock
 Description: Places the block that the user is holding and moves the cursor up
 Return: None
Name : placeBlock Description : Places the block that the user is holding and moves the cursor up Return : None
// Check for overlap // Missed it, game over // Valid move // Check if we need to cut off the next block // Same spot // Left of last block // Right of last block // Place the block, move up // Win the game