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 - JavaScript Tutorial
From the course: Code Clinic: JavaScript
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Intro: Eight queens1m 45s
-
(Locked)
Solution overview1m 31s
-
(Locked)
Preparing the board6m 46s
-
(Locked)
Setting up the board4m 17s
-
(Locked)
Computing solutions3m 56s
-
(Locked)
Finishing calculations7m 23s
-
(Locked)
Storing board solutions4m 1s
-
(Locked)
Display solutions4m 7s
-
(Locked)
Navigating through solutions3m 32s
-
(Locked)
-
-
-