game.js
// Determines if any of the spaces entered by the user has already been used
Determines if any of the spaces entered by the user has already been used
Determines if any of the spaces entered by the user has already been used
isFreeLocation(array, board) {
		let spaceRegex = new RegExp(/[A-Z]|[0-9]+/g);
		let numberFalse = 0;
		for (let i = 0; i < array.length; i++) {
			let individualSpace = array[i].match(spaceRegex);
			let rowIndex = this.findRow(individualSpace[0], board);
			let columnIndex = individualSpace[1];
			if (board[rowIndex][columnIndex].includes("{")) {
				numberFalse++;
			}
		}
		if (numberFalse > 0) {
			return false;
		}
		else {
			return true;
		}
	}
isFreeLocation ( array , board ) { let spaceRegex = new RegExp ( / [A-Z]|[0-9]+ / g ) ; let numberFalse = 0 ; for ( let i = 0 ; i < array . length ; i ++ ) { let individualSpace = array [ i ] . match ( spaceRegex ) ; let rowIndex = this . findRow ( individualSpace [ 0 ] , board ) ; let columnIndex = individualSpace [ 1 ] ; if ( board [ rowIndex ] [ columnIndex ] . includes ( "{" ) ) { numberFalse ++ ; } } if ( numberFalse > 0 ) { return false ; } else { return true ; } }
Determines if any of the spaces entered by the user has already been used
Determines if any of the spaces entered by the user has already been used