From the course: Code Clinic: JavaScript

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Computing solutions

Computing solutions - JavaScript Tutorial

From the course: Code Clinic: JavaScript

Start my 1-month free trial

Computing solutions

- So it's time to start working on the actual solutions. And as I mentioned, our goal is to essentially create some functions that will allow you to test each position of these queens and check to see if there's already a board piece placed horizontally, vertically, or diagonally. So, all we're doing here is just going through the different options and doin' it with code. So, right after this number of columns, what we'll do is we'll create this method called tryNewQueen here. And this is going to be... a function that's gonna get a row, and then in here we'll have to create a loop that just goes through all of the columns. So, we'll just set that up, let column equal zero, column is less than the number of columns, and then increment through each of the columns. So we're just going through each one of the columns here. And then just doin' our tests here. So if this... So what I'm gonna do here is just make sure that I can test if any of the columns are currently blocked. And then…

Contents