test
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 check_sudoku(grid): | |
| '''If grid is a valid sudoku board, so far filled-in correctly: returns True | |
| else if grid is a valid sudoku board but has been filled-in incorrectly: returns False | |
| else: returns None | |
| Note: returning True does not imply there is a solution for grid, see solve_sudoku. | |
| ''' | |
| def sanity_check(): | |
| '''If grid is of the sudoku board format: returns True | |
| else: returns None |
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
| #Note this requires the function solve_sudoku. | |
| def Sudoku(grid): | |
| def __init__(self): | |
| self.grid = grid | |
| self.solution = solve_sudoku(self.grid) | |
| self.hints = self.get_hints() | |
| def solvable(self): | |
| return bool(self.solution) |
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
| //This is a conversion from a Python file to JavaScript (from https://gist.github.com/3097993) | |
| //It's in progress (by which I mean: completely untest). | |
| function set(list){ | |
| /* | |
| * returns list with no repeated entries | |
| */ | |
| var set_list = []; | |
| for (var element in list){ | |
| if (!(element in set_list)){ |
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
| /* | |
| * Solve Every Sudoku Puzzle | |
| * | |
| * See http://norvig.com/sudoku.html | |
| * | |
| * Throughout this program we have: | |
| * r is a row, e.g. 'A' | |
| * c is a column, e.g. '3' | |
| * s is a square, e.g. 'A3' | |
| * d is a digit, e.g. '9' |
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 f(): | |
| a = 2 | |
| b = 1 | |
| def g(): | |
| #a = 3 | |
| b = 2 | |
| c = 1 | |
| print dict(globals(), **locals()) #prints a=1, but we want a=2 (from f) | |
| g() | |
| a = 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
| def f(): | |
| a=1 | |
| def g(): | |
| print a | |
| g() | |
| f() |
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
| file_list = ["10.1.1.111.1781.pdf", "10.1.1.111.5264.pdf", "10.1.1.39.1596.pdf", "10.1.1.41.8589.pdf", "10.1.1.42.5619.pdf"] | |
| apps_list = [ | |
| "/Applications/Adobe Reader 9/Adobe Reader.app/Contents/MacOS/AdobeReader", | |
| "/Applications/Adobe Reader.app/Contents/MacOS/AdobeReader", | |
| "/Applications/Preview.app/Contents/MacOS/Preview"] | |
| fuzz_output = "fuzz.pdf" | |
| FuzzFactor = 250 |
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 primes(): | |
| def __init__(self): | |
| self.primes_list = [2,3] | |
| self.generator = self.generator() | |
| def _append_if_no_prime_divides(self,q): | |
| is_prime = not any( q % p == 0 for p in self.primes_list) | |
| if is_prime: | |
| self.primes_list.append(q) | |
| return is_prime |
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
| import numpy as np | |
| from numpy.fft import fft, fftshift, ifft, fftfreq | |
| L = 10 | |
| n = 128 | |
| x2 = np.linspace(-L, L, n + 1) | |
| x = x2[1:] | |
| # k = (2 * np.pi / L) * np.concatenate((np.arange(0, n/2), np.arange(-n/2 + 1, 1))) |
OlderNewer