UNPKG

@sschepis/resolang

Version:

ResoLang - Core quantum resonance computation library for browser and Node.js

22 lines (16 loc) 606 B
// assembly/runtime/instructions/phase/decohere.ts import { IInstructionHandler } from "../types"; import { RISAEngine } from "../../../runtime"; import { Argument } from "../../argument"; class DecohereInstruction implements IInstructionHandler { execute(engine: RISAEngine, args: Argument[]): bool { if (args.length < 1) { return false; // DECOHERE requires a prime. } const prime = engine.parsePrime(args[0]); engine.getPrimeEngine().setPhase(prime, Math.random() * 2 * Math.PI); return true; } } const decohere = new DecohereInstruction(); export default decohere;