Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-rosetta/blob/main/tasks/wireworld/oracle.py # omega-rosetta aien-dev/omega-rosetta Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-rosetta / tasks / wireworld / oracle.py` 14 lines ยท 720 bytes Raw Blame History 1 # Independent reference for "Wireworld" (Python 3, standard library only). 2 # expected.txt is this program's stdout; omc never produced it. 3 rows = ["tH.........", ". . ", " ... ", ". . ", "Ht.. ......"] 4 def step(g): 5 def heads(r, c): 6 return sum(1 for dr in (-1, 0, 1) for dc in (-1, 0, 1) 7 if (dr or dc) and 0 <= r + dr < len(g) and 0 <= c + dc < len(g[0]) and g[r + dr][c + dc] == "H") 8 nxt = {"H": "t", "t": ".", " ": " "} 9 return ["".join(nxt.get(ch) or ("H" if heads(r, c) in (1, 2) else ".") for c, ch in enumerate(row)) 10 for r, row in enumerate(g)] 11 for gen in range(10): 12 print("generation", gen) 13 print("\n".join(rows)) 14 rows = step(rows)