Review an approach to solving the eight queens puzzle. first by building the output portions of the program. To find the queens, a recursive function is used. This solution failed because it couldn't keep track of which queen is attacking which square.
- [Instructor] I've looked at Eight Queens code before.…I can understand what's going on,…but the code always seemed so cryptic,…and it wasn't just single-letter variable names…that bothered me.…It was trying to decipher exactly how the code worked.…Yes, that's one of the shortcomings of the C language.…So I began my Eight Queens adventure by creating code…that operated on a character array, rows and columns.…First, to avoid the logic that comprises…the bulk of the code, I worked on the main function,…which examines the command line arguments.…
So the default of eight squares is set…when no arguments are specified,…and if the first argument is a value,…then that value is converted into an integer,…otherwise the help message is displayed.…Then, options for brief and board are checked,…and the output mode variable is set accordingly.…I also wrote the show board function,…which displays the board in brief output…I didn't even bother to code the brief output.…For this first approach I just wanted to see the board.…
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.