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
| The first floor contains a 1 generator, a 2 generator, a 3 generator, a 4 generator, a 5 generator, a 6 generator, a 7 generator, a 8 generator, a 9 generator, a 10 generator, a 11 generator, a 1-compatible microchip, a 2-compatible microchip, a 3-compatible microchip, a 4-compatible microchip, a 5-compatible microchip, a 6-compatible microchip, a 7-compatible microchip, a 8-compatible microchip, a 9-compatible microchip, a 10-compatible microchip, and a 11-compatible microchip. | |
| The second floor contains nothing relevant. | |
| The third floor contains nothing relevant. | |
| The fourth floor contains nothing relevant. |
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
| require "crypto/md5" | |
| hash = "0" * 32 | |
| zeroes = Array.new(32, 1) | |
| ROWS = 8 | |
| almost = 0 | |
| hashes = Array.new(ROWS, "") | |
| hashes[0] = hash |
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
| # http://norvig.com/ipython/xkcd1313.ipynb | |
| # http://nbviewer.jupyter.org/url/norvig.com/ipython/xkcd1313.ipynb | |
| # | |
| # http://norvig.com/ipython/xkcd1313-part2.ipynb | |
| # http://nbviewer.jupyter.org/url/norvig.com/ipython/xkcd1313-part2.ipynb | |
| # | |
| # Only implemented the 'covers' optimisation in part 2 | |
| # no branch and bound. | |
| # no repetition characters or pairs |
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
| require 'set' | |
| def heuristic(start, goal) | |
| { | |
| start: 5, # Not given in the diagram but probably not important. | |
| a: 4, | |
| b: 2, | |
| c: 4, | |
| d: 4.5, | |
| e: 2, |
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
| if ARGV.empty? | |
| puts "usage: #{$PROGRAM_NAME} offset [file] (or stdin)" | |
| exit 1 | |
| end | |
| offset = ARGV.shift.to_i | |
| ARGF.each_line { |l| | |
| unless l.include?('-->') | |
| puts l |
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
| require 'json' | |
| require 'set' | |
| # Create a personal access token at https://github.com/settings/tokens | |
| # It needs only one scope: read:org ("Read org and team membership"). | |
| TOKEN_FILE = 'secrets/token.txt'.freeze | |
| SLEEP_TIME = 2 | |
| global_name = 'track-maintainers'.freeze |
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
| #!/usr/bin/env ruby | |
| if ARGV.empty? | |
| puts "usage: #{$PROGRAM_NAME} dir" | |
| Kernel.exit(1) | |
| end | |
| track = File.basename(File.dirname(File.realpath(ARGV[0]))) | |
| def glob(*components, except: []) |
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
| class ParseError < StandardError; end | |
| def object(s, i) | |
| o = {} | |
| state = :key | |
| key = nil | |
| j = i + 1 | |
| while (c = s[j]) | |
| case state |
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
| require 'json' | |
| require 'time' | |
| # Create a personal access token at https://github.com/settings/tokens | |
| # It needs NO scopes. | |
| # In fact, you could just not use a token, but then you get rate-limited to 60 an hour instead of 5000 an hour. | |
| TOKEN_FILE = 'secrets/token.txt'.freeze | |
| SLEEP_TIME = 2 | |
| CACHE = 'cache'.freeze |
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 ops(nums, result, sign = 1) | |
| case nums.size | |
| when 0, 1 | |
| result == (nums[0] || 0) * sign ? [[nums[0]].compact] : [] | |
| else | |
| n1, n2 = nums.first(2) | |
| plus = ops(nums.drop(1), result - n1 * sign, 1).map { |r| [n1, :+] + r } | |
| minus = ops(nums.drop(1), result - n1 * sign, -1).map { |r| [n1, :-] + r } | |
| concat = ops([n1 * 10 + n2] + nums.drop(2), result, sign) | |
| plus + minus + concat |