# qbit.py
# This code is quantic.
# By: Pedro Izecksohn
# Version: Devil's day on a quantic time from Rio de Janeiro.
# License: For operational systems this code is permitted to be linked with it. Other usage must be paid.

import ctypes
import random
import threading
import time

class Qbit:
    unset=(False,True)
    false=(False,False)
    neutral=(True,False)
    true=(True,True)
    def __init__(self, value):
        self.lohi:(ctypes.c_bool*2) = (ctypes.c_bool*2) (value[0], value[1])
    def __eq__(self, other):
        if other is None:
            return False
        return (self.lohi[0]==other.lohi[0]) and(self.lohi[1]==other.lohi[1])
    def __str__ (self):
        return "unset" if self==Qbit(Qbit.unset) else "neutral" if self==Qbit(Qbit.neutral) else "true" if self==Qbit(Qbit.true) else "false"
    def __hash__(self):
        return hash ((self.lohi[0], self.lohi[1]))

def rand(ret=Qbit.unset):
    qb=ret
    while (qb==ret):
        #print ("unset")
        qb = Qbit([(True if (random.randint(0,1) == 1) else False) for _ in range (2)])
    ret.lohi=qb.lohi

class Unknown (threading.Thread):
    def __init__(self, qb=Qbit(Qbit.unset)):
        super().__init__(group=None, target=rand, args=[qb])
        self.qb=qb

def init():
    task=Unknown()
    task.start()
    task.join()
    now=time.time()
    micro=int((now-int(now))*100000000)
    random.seed(micro)
    #print (str(task.qb))

init()
