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.
Finishing calculations - JavaScript Tutorial
From the course: Code Clinic: JavaScript
Finishing calculations
- [Instructor] It's said to start pushing these solutions into a solutions array and then also use recursion to go through all of the available options. So what we're doing is asking the computer to place a queen somewhere and then go through some checks. Make sure that no queens can be placed in the same horizontal position but what we need to do is once we're done with a row, we're going to be doing some calculations with the new row but this new row needs to know about the previous row and that's where recursion is going to come in handy. Once we sort of figure out what's happening in this row, that's not gonna work, this is not gonna work. Potentially this one here will work and we're sort of done because we can't place any more queens here so we need to move to the new row but this new row needs to know about these other two. So it's going to try to put something here and that's not going to work. Diagonally, that one doesn't work here. This won't work either. That one won't…
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)
-
-
-