Skip to content

Instantly share code, notes, and snippets.

import hashlib
from functools import reduce
inputs = """\
4987a884
dc917386
54c4938a
dcf3388d
22e1e08f
02e29593
@jix
jix / decodegen.py
Last active October 2, 2021 23:06 — forked from olofk/decodegen.py
from sympy.logic import SOPform
from sympy import symbols
from functools import partial, reduce
from itertools import product, combinations
import networkx as nx
import z3
HEADER = """module serv_auto_decode
(
input wire i_clk,
@jix
jix / README.md
Last active August 29, 2015 14:02 — forked from mbostock/.block

Wilson’s algorithm uses loop-erased random walks to generate a uniform spanning tree — an unbiased sample of all possible spanning trees. Most other maze generation algorithms, such as Prim’s, random traversal and randomized depth-first traversal, do not have this beautiful property.

The algorithm initializes the maze with an arbitrary starting cell. Then, a new cell is added to the maze, initiating a random walk (shown in magenta). The random walk continues until it reconnects with the existing maze (shown in white). However, if the random walk intersects itself, the resulting loop is erased before the random walk continues.

Initially, the algorithm can be frustratingly slow to watch, as the early random walks are unlikely to reconnect with the small existing maze. However, as the maze grows, the random walks become m