See how to display results as chessboards.
- [Man] In this video we'll finish our project…by printing the results.…Back in the source directory, I'm inside of the…core.clj file and inside of my name space,…I'll add a require expression, and I'll pull in…from the queens.inductive name space…the generate function using refer.…Next I'll use clojure.string from the standard library…and I'll alias that as str.…Lastly I'll add the gen-class keyword inside…of an expression here, so that Leiningen…can compile our program.…
Start with a function called board-display that…given a board in the representation we're using…will print the board.…I'll start with a let binding.…Since we print the board by rows, but we're representing…it by column, we'll need to transpose the board…we're given by switching its x and y…for y and x values.…Call this representation by-rows,…and I'll create it first by using map-indexed…and building a function that takes an x and a y…and returns a vector of y and x.…
We'll map over board, so I'll write board here.…Next I need to sort this by its y value.…
Skill Level Intermediate
1. Problem 1: Exploring Lake Pend Oreille
2. Problem 2: Image Analysis
3. Problem 3: Eight Queens
4. Problem 4: Accessing Peripherals
5. Problem 5: Recursion and Directories
6. Problem 6: 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?
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.