src/Maze.js
// If algorithm has already been run, you can't run the board again

If algorithm has already been run, you can't run the board again
If algorithm has already been run you can ' t run the board again
handleRun(event) {
		event.preventDefault();
		let path = null;
		if (!this.state.ranAlgorithm) {
			if (this.props.algorithm === "BreadthFirstSearch") {
				path = this.breadthAndDepthFirstSearch(this.props.rows, this.props.columns, this.state.start, this.state.goal, this.state.walls, "BreadthFirstSearch");
			}
			else if (this.props.algorithm === "DepthFirstSearch") {
				path = this.breadthAndDepthFirstSearch(this.props.rows, this.props.columns, this.state.start, this.state.goal, this.state.walls, "DepthFirstSearch");
			}
			else if (this.props.algorithm === "UniformCostSearch") {
				path = this.uniformCostSearch(this.props.rows, this.props.columns, this.state.start, this.state.goal, this.state.walls);
			}
			else if (this.props.algorithm === "AStarAlgorithm") {
				path = this.breadthAndDepthFirstSearch(this.props.rows, this.props.columns, this.state.start, this.state.goal, this.state.walls, "BreadthFirstSearch");
			}
			if (path === null) {
				this.setState({nopath: "Could not find a path."});
			}
			this.setState({ranAlgorithm: true});
		}
	}
handleRun ( event ) { event . preventDefault ( ) ; let path = null ; if ( ! this . state . ranAlgorithm ) { if ( this . props . algorithm === "BreadthFirstSearch" ) { path = this . breadthAndDepthFirstSearch ( this . props . rows , this . props . columns , this . state . start , this . state . goal , this . state . walls , "BreadthFirstSearch" ) ; } else if ( this . props . algorithm === "DepthFirstSearch" ) { path = this . breadthAndDepthFirstSearch ( this . props . rows , this . props . columns , this . state . start , this . state . goal , this . state . walls , "DepthFirstSearch" ) ; } else if ( this . props . algorithm === "UniformCostSearch" ) { path = this . uniformCostSearch ( this . props . rows , this . props . columns , this . state . start , this . state . goal , this . state . walls ) ; } else if ( this . props . algorithm === "AStarAlgorithm" ) { path = this . breadthAndDepthFirstSearch ( this . props . rows , this . props . columns , this . state . start , this . state . goal , this . state . walls , "BreadthFirstSearch" ) ; } if ( path === null ) { this . setState ( { nopath : "Could not find a path." } ) ; } this . setState ( { ranAlgorithm : true } ) ; } }
If algorithm has already been run, you can't run the board again
If algorithm has already been run you can ' t run the board again
/*
					TODO: THIS IS DOING BREADTH FIRST SEARCH
				*/