Skip to content

Commit

Permalink
don't download problems we already have
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrudnick committed Aug 7, 2016
1 parent 4c3ff09 commit bc6475d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 0 additions & 1 deletion calipers.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ def best_angle(polygons):
return best_tan

def main():
## points = [(0,0), (2, 2), (1,0), (1,72), (0,1)]
fn = sys.argv[1]
problem = parse(fn)
points = list_destination_points(problem)
Expand Down
11 changes: 8 additions & 3 deletions download_problems.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,15 @@ def list_all_problems(snapshot_hash):
return out

def download_save_problem(problem_id, spec_hash):
blob = raw_blob_lookup(spec_hash)

output_fn = "problems/problem_{:03d}".format(problem_id)
assert os.path.exists("problems/")
with open("problems/problem_{:03d}".format(problem_id), "w") as outfile:

if os.path.exists(output_fn):
print("already got that one.")
return

blob = raw_blob_lookup(spec_hash)
with open(output_fn, "w") as outfile:
print(blob, file=outfile, end="")

def main():
Expand Down

0 comments on commit bc6475d

Please sign in to comment.