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/queue-definition/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 / queue-definition / oracle.py` 26 lines ยท 588 bytes Raw Blame History 1 # Independent reference for "Queue/Definition" (Python 3, standard library only). 2 # expected.txt is this program's stdout; omc never produced it. 3 from collections import deque 4 q = deque() 5 def empty(): 6 print("empty:", "no" if q else "yes") 7 def push(v): 8 q.append(v) 9 print("push", v) 10 def pop(): 11 if not q: 12 print("pop from an empty queue: error") 13 return False 14 print("pop", q.popleft()) 15 return True 16 empty() 17 for i in range(1, 7): 18 push(11 * i) 19 for _ in range(4): 20 pop() 21 for i in range(7, 12): 22 push(-11 * i) 23 empty() 24 while pop(): 25 pass 26 empty()