Skip to content

Instantly share code, notes, and snippets.

@jmhummel
jmhummel / genesis_public_key
Last active March 5, 2018 07:31
genesis_public_key
0494fc7e6e72b2cc80f06bb5a1afec91c72b82bcff527e66c021e90d4fc1be41342d9a8f22ba4973402131f90a08c723f221729ef56b09f25f2be9d475b1b3ae34;matty1983
@jmhummel
jmhummel / 2018-08-31-express.py
Created September 3, 2018 00:52
Riddler 2018-08-31 Express, "The New National Pastime: Competitive Coin Flipping"
import random
def enum(**enums):
return type('Enum', (), enums)
Coin = enum(HEADS='H', TAILS='T')
Team = enum(RED='Red', BLUE='Blue')
Goal = enum(RED=[Coin.HEADS, Coin.TAILS], BLUE=[Coin.HEADS, Coin.HEADS])
def flip():
@jmhummel
jmhummel / 2018-09-07-classic.py
Created September 7, 2018 23:27
Riddler 2018-09-07 Classic, "I’d Like To Use My Riddler Lifeline"
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
@jmhummel
jmhummel / 2018-09-28-classic.py
Last active September 30, 2018 04:39
2018-09-28-classic-code
#!/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-28-classic.md
Last active September 30, 2018 04:52
2018-09-28-classic-results

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 / LICENSE
Created September 30, 2018 08:43
This license applies to all public gists https://gist.github.com/jmhummel
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 / 2019-01-11-express.ipynb
Last active January 11, 2019 23:39
2019-01-11 Riddler (express)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jmhummel
jmhummel / 2019-03-03-express.ipynb
Last active March 4, 2019 04:09
2019-03-03 Riddler (express)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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-06-21-classic-matrix.py
Created June 24, 2019 03:11
2019-06-21 Riddler Classic
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)}