qc.reset(4);
var boxes = qint.new(2, 'boxes')
var noteA = qint.new(1, 'noteA')
var anc = qint.new(1,'anc')
qc.write(0);

// Umieść dwa pudełka w superpozycji kociak/tygrys
boxes.hadamard();

// Spełnij kryteria notki na pudełku A za pomocą logiki bitowej
// notkaA = A OR B
qc.not(0x1|0x2);
qc.cnot(0x4,0x1|0x2)
qc.not(0x1|0x2|0x4);

// Spełnij kryteria notki na pudełku B za pomocą logiki bitowej
// NOT A
qc.not(0x1);


// Ustaw kubit skreczowy w stanie |+
anc.not();
anc.hadamard();

// Spełnij ostatni warunek dzięki logice fazowej
// (A OR B) XNOR (NOT A)
qc.cnot(0x8,0x4);
qc.cnot(0x8,0x1);
qc.not(0x8);

// Przywróć kubit skreczowy do stanu |0
anc.hadamard();
anc.not();

// Cofnij wszystkie obliczenia logiki binarnej
qc.not(0x1);
qc.nop();
qc.not(0x1|0x2|0x4);
qc.cnot(0x4,0x1|0x2)
qc.not(0x1|0x2);

// Wykorzystaj mirror do skonwertowania odwróconej fazy
boxes.Grover();

// Odczytaj i zinterpretuj wyniki!
var result = boxes.read();
var catA = result & 1 ? 'kitten' : 'tiger';
var catB = result & 2 ? 'kitten' : 'tiger';
qc.print('Box A contains a ' + catA + '\n');
qc.print('Box B contains a ' + catB + '\n');
