import random, sys, time, collections import pyarrow.parquet as pq from annotate import LANE, annotate from corpus.convert import designs, rasterise, to_world c = collections.Counter() t = time.time() for f in sys.argv[1:]: rows = pq.read_table(f, columns=["string", "modded", "entity_counts"]).to_pylist() rows = [r for r in rows if not r["modded"] and ("assembling-machine" in r["entity_counts"] or "furnace" in r["entity_counts"])] random.Random(0).shuffle(rows) for row in rows[:150]: r = rasterise(next(designs(row["string"]))) if r is None: continue c["designs"] += 1 nodes, demand, supply, succ, pred = annotate(to_world(r)) for i, (k, *_ ) in enumerate(nodes): if k not in LANE: continue if not pred[i]: c[f"entry lanes, demand of {min(len(demand[i]), 2)}{'+' if len(demand[i]) >= 2 else ''} items"] += 1 if not succ[i]: c[f"exit lanes, supply of {min(len(supply[i]), 2)}{'+' if len(supply[i]) >= 2 else ''} items"] += 1 c["lanes"] += 1 c["lanes with any item"] += bool(supply[i] or demand[i]) print(f"{time.time() - t:.0f}s") for k, v in sorted(c.items()): print(f"{k:40s} {v}")