This file contains 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
#include <cmath> | |
#include <vector> | |
#include "windows.h" | |
#include "lodepng.h" | |
#include "SDL.h" | |
typedef std::vector<unsigned char> Image; |
This file contains 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
#include <cmath> | |
#include <functional> | |
#include <set> | |
#include "windows.h" | |
#include "lodepng.h" | |
#include "SDL.h" | |
const int MIN_RECT_SIZE = 2; |
This file contains 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 shutil | |
import os | |
games = [ | |
{"name": "th10", "offset": 0x25013, "data": [0xf6, 0x05, 0x5c, 0x4e, 0x47, 0x00, 0x02, 0x0f, 0x84, 0x52, 0x01, 0x00, 0x00]}, | |
{"name": "th11", "offset": 0x30679, "data": [0xf6, 0x05, 0xc0, 0x93, 0x4c, 0x00, 0x02, 0x0f, 0x84, 0xd5, 0x02, 0x00, 0x00]}, | |
{"name": "th12", "offset": 0x3619b, "data": [0xf6, 0x05, 0xd0, 0x49, 0x4d, 0x00, 0x02, 0x0f, 0x84, 0xe8, 0x01, 0x00, 0x00]}, | |
{"name": "th125", "offset": 0x3ace8, "data": [0xf6, 0x05, 0x10, 0xb2, 0x4d, 0x00, 0x02, 0x0f, 0x84, 0xf9, 0x00, 0x00, 0x00]}, | |
{"name": "th13", "offset": 0x42925, "data": [0xf6, 0x05, 0x14, 0x4c, 0x4e, 0x00, 0x02, 0x0f, 0x84, 0x2c, 0x01, 0x00, 0x00]}, | |
{"name": "th14", "offset": 0x4d2c4, "data": [0xf6, 0x05, 0x9c, 0x8a, 0x4d, 0x00, 0x02, 0x0f, 0x84, 0x00, 0x01, 0x00, 0x00]} |
This file contains 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
#include <iostream> | |
#include <vector> | |
#include <string> | |
#include <array> | |
#include <fstream> | |
using std::cout; | |
using std::endl; | |
typedef std::vector<std::array<char, 4>> Board; |
This file contains 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
#include <iostream> | |
#include <string> | |
#include <vector> | |
#include <fstream> | |
#include <tuple> | |
#include <algorithm> | |
#include <climits> | |
#include <map> | |
#include <set> |
This file contains 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
# [2015-01-23] Challenge #198 [Hard] Words with Enemies -- The Game! | |
# http://www.reddit.com/r/dailyprogrammer/comments/2tfs0b/20150123_challenge_198_hard_words_with_enemies/ | |
from functools import lru_cache | |
import random | |
import string | |
@lru_cache(maxsize=1) | |
def load_wordlist(filename="enable1.txt"): | |
return open(filename).read().splitlines() |
This file contains 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
#Ugly but working | |
dataz="""\ | |
_ _ _ _ _ _ _ _ _ | |
| || || || || || || || || | | |
|_||_||_||_||_||_||_||_||_| | |
| | | | | | | | | | |
| | | | | | | | | |
This file contains 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 itertools | |
from copy import deepcopy | |
def possible_combinations(values, n, total): | |
# generate all combinations of given values with given sum | |
return [combination for combination in itertools.combinations(values, n) if sum(combination) == total] | |
def make_aval(board, clues): | |
""" | |
Generates a set of all digits you can use in each cell, just like you do in sudoku board |
This file contains 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
prime_sieve =: 3 : 0 | |
sieve_size =. y | |
sieve =. sieve_size # 0 | |
indices =. i. sieve_size | |
sieve =. 1 (0 1) } sieve | |
result =. '' | |
while. sieve_size ~: +/ sieve do. NB. while it has at least one 0 | |
num =. {. (-. sieve) # indices NB. get first number not marked with 1 | |
result =. result, num | |
divisible =. 0 = num | indices |
This file contains 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
s44 =: 4 4 $ 0 0 0 0 0 0 2 1 3 0 0 4 0 0 0 0 | |
box =: (] #"1 ] # ([: i. 2 # ])) | |
indices =: 3 : 0 | |
yy =. {. y | |
a =. yy #"0 i. yy | |
b =. |: a | |
c =. a ,/"0 b | |
) |
OlderNewer