Join Patrick Royal for an in-depth discussion in this video My solution: Representing the chessboard, part of Code Clinic: Java.
Our first task in completing this challenge is to design…a data structure that represents the chessboard.…As I mentioned in the solution overview,…the most intuitive data structure,…a two dimensional array, is not the most efficient set up.…Instead, in the main class I define an ArrayList of points…that represent each of the squares on the chessboard.…A point is a very convenient object to use for this task…because each point contains both an x and a y coordinate…which can correspond to the x and y coordinates…of squares on a chessboard.…
You can start these coordinates from any corner…of the chessboard and it won't matter.…The solutions exhibit four-way symmetry…for the four sides of the chessboard.…Next, we define a small loop to initialize…the chessboard with 64 points,…each of which represents one square of the chessboard.…I then pass the chessboard to the place queens method…so that we can start placing the queens.…Many eight-queen strategies will mark squares…on the chessboard once they have queens on them.…
Patrick introduces challenges and provide an overview of his solutions in Java. Challenges include topics such as statistical analysis, searching directories for images, and accessing peripheral devices.
Visit other courses in the series to see how to solve the exact same challenges in languages like C#, C++, PHP, Python, and Ruby.
Skill Level Intermediate
Q: I am unable to access the Lake Pend Oreille data from outside the U.S.
A: A static copy of this data is provided here for lynda.com members outside of the U.S
Problem One: Exploring Lake Pend Oreille
Problem Two: Image Analysis
Problem Three: Eight Queens
Problem Four: Accessing Peripherals
Problem Five: Recursion and Directories
Problem Six: Building the Web
- 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.