class BinaryNode<Element> {
var value: Element
var leftChild: BinaryNode?
var rightChild: BinaryNode?
init(value: Element) {
self.value = value
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func checkLink(link string, c chan string) { | |
| 10 start := time.Now() | |
| 11 _, err := http.Get(link) | |
| 12 | |
| 13 if err != nil { | |
| 14 fmt.Println(link, " is not working") | |
| 15 return | |
| 16 } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_neighbors(d, x, y, coll): | |
| # d == abbr. for dungeon is our board | |
| # For example: | |
| #[-8, -13, -8] | |
| #[-24, 28, 28] | |
| #[-13, -13, -30] | |
| # coll == abbr. for collection, how I keep track of all returned neighbors | |
| # We start our knight in the upper left hand corner |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| board = [ | |
| [3, 9, -1, -1, 5, -1, -1, -1, -1], | |
| [-1, -1, -1, 2, -1, -1, -1, -1, 5], | |
| [-1, -1, -1, 7, 1, 9, -1, 8, -1], | |
| [-1, 5, -1, -1, 6, 8, -1, -1, -1], | |
| [2, -1, 6, -1, -1, 3, -1, -1, -1], | |
| [-1, -1, -1, -1, -1, -1, -1, -1, 4], | |
| [5, -1, -1, -1, -1, -1, -1, -1, -1], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Word Solver | |
| Part 1 | |
| Write some code that: | |
| Takes a 7-character string (either as a command-line argument or as an argument to a function) | |
| Prints out the words that can be made from those characters, along with their Scrabble scores, one word per line, in descending score order | |
| Example input and output: | |
| $ python scrabble_cheater.py SPCQEIU # Use any language you like. |