Learn how the diagonal, vertical, and horizontal attacks from the queen are resolved by placing the chessboard into a two-dimensional array. Discover how this presents the data in a more readable fashion, which makes the solution to the eight queens puzzle more obvious.
- [Instructor] Despite success with the N Queens code,…I wanted to try it again.…Specifically I wanted to work on the recursive routine…to ensure that I fully understood the diagonal attack.…Because my stumbling block was the single dimension array…I figured I would return back to a two dimensional…character array.…Unlike my first disastrous attempt to solve this problem,…I would track only the queen's location…and not her attack vectors.…So this third solution was really a combination…of both my previous attempts,…with the emphasis on making a diagonal attack…easier for me to code.…
A two dimensional character array is faked right here…at line 62.…I use a pointer instead of two dimensional array notation…simply because this is the C language…and pointers are a big deal.…Of course, that also requires some pointer math,…but for some reason my brain could handle that type of math…better than the row column thing…going on with the single dimension integer array…as covered in the previous movie.…Space is allocated for the array,…
Skill Level Intermediate
1. Summarize the Weather
2. Geolocation with C
3. Eight Queens with C
4. Build a Musical Instrument with C
5. Face Recognition with C
6. Web Dashboards with C
Next steps1m 2s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.