Skip to content

Instantly share code, notes, and snippets.

@jthemphill
jthemphill / oneplayer.py3
Last active June 16, 2017 04:00
Attempt to solve JT's tea game for a single player
import collections
import copy
import heapq
from typing import (Any, Dict, Iterator, List, NewType, Set, Tuple, TypeVar)
SMALL_T: int = 2
BIG_T: int = 3
JEFF_SOLUTION = 32
GOAL = 50
import itertools
def solve(n, xs):
for t in make_trees(xs):
if eval_tree(t) == n:
return print_tree(t)
def make_trees(xs):
if len(xs) == 1:
yield ('unit', xs[0])