Skip to content

Instantly share code, notes, and snippets.

@jmhummel
jmhummel / 2020-05-22-classic.ipynb
Last active May 22, 2020
Riddle classic 2020-05-22
View 2020-05-22-classic.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View 2020-01-03-classic.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View 2019-06-21-classic-matrix.py
from heapq import heappush, heappop
import numpy as np
from collections import deque
STATES = [(0, 0, 0, 0), (0, 0, 0, 1), (0, 0, 1, 1), (0, 1, 0, 1), (0, 1, 1, 1), (1, 1, 1, 1)]
ACTIONS = STATES[1:]
STATE_MAP = {state: i for i, state in enumerate(STATES)}
ACTION_MAP = {action: i for i, action in enumerate(ACTIONS)}
View largest_unique_digits_sum.py
from timeit import Timer
a = [984, 981, 976, 950, 899, 890, 887, 885, 880, 800, 798, 790, 777, 767, 750, 701, 697, 688, 680, 678, 650, 599, 589,
567, 550, 501, 9, 8, 7, 6, 5, 4, 3, 2, 1]
b = [1090, 1080, 1074, 1065, 1057, 1056, 1047, 1041, 1041, 1038, 1025, 1013, 1008, 992, 991, 991, 991, 978, 977, 959,
945, 935, 925, 925, 923, 915, 908, 904, 901, 901, 900, 897, 894, 882, 880, 876, 866, 854, 849, 849, 833, 818, 818,
812, 811, 809, 798, 794, 793, 788, 772, 763, 747, 746, 743, 737, 736, 734, 732, 730, 728, 718, 714, 713, 706, 701,
699, 691, 690, 689, 681, 672, 663, 656, 654, 653, 652, 651, 646, 644, 640, 637, 637, 635, 634, 633, 630, 625, 621]
@jmhummel
jmhummel / 2019-03-03-express.ipynb
Last active Mar 4, 2019
2019-03-03 Riddler (express)
View 2019-03-03-express.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jmhummel
jmhummel / 2019-01-11-express.ipynb
Last active Jan 11, 2019
2019-01-11 Riddler (express)
View 2019-01-11-express.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jmhummel
jmhummel / LICENSE
Created Sep 30, 2018
This license applies to all public gists https://gist.github.com/jmhummel
View LICENSE
MIT License
Copyright (c) 2018 Jeremy Hummel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@jmhummel
jmhummel / 2018-09-28-classic.md
Last active Sep 30, 2018
2018-09-28-classic-results
View 2018-09-28-classic.md

Go here to see the python script!

Number of starting permutations

51480

Number of moves required:

{0: 1, 1: 65, 2: 1253, 3: 9653, 4: 27422, 5: 12946, 6: 140}

Stats:

@jmhummel
jmhummel / 2018-09-28-classic.py
Last active Sep 30, 2018
2018-09-28-classic-code
View 2018-09-28-classic.py
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
# See: https://gist.github.com/jmhummel/fe7604ab830567d5939b21d3e6c57dfa for results!
import ast
import random
import datetime
import multiprocessing
from multiprocessing import Pool
@jmhummel
jmhummel / 2018-09-07-classic.py
Created Sep 7, 2018
Riddler 2018-09-07 Classic, "I’d Like To Use My Riddler Lifeline"
View 2018-09-07-classic.py
import random
def open_pack(set_size=100):
return random.sample(xrange(set_size), 10)
def collect(set_size=100):
owned = set([])
packs_bought = 0
while len(owned) != set_size:
packs_bought += 1