Example #1
0
        static void Main(string[] args)
        {
            using (var qsim = new QuantumSimulator())
            {
                Console.WriteLine($"ConstantZero constant: [{IsConstantZeroConstant.Run(qsim).Result}]");
                Console.WriteLine($"ConstantOne constant: [{IsConstantOneConstant.Run(qsim).Result}]");
                Console.WriteLine($"Identity constant: [{IsIdentityConstant.Run(qsim).Result}]");
                Console.WriteLine($"Negation constant: [{IsNegationConstant.Run(qsim).Result}]");
            }

            Console.ReadKey();
        }
Example #2
0
        public async Task blackBox([Summary("The black box to pass in, 1 is constant zero, 2 is constant one, 3 is identity, 4 is negation.")] int input)
        {
            using var sim = new QuantumSimulator();

            //runs corresponding blackbox
            string result = input switch
            {
                1 => "constant zero " + (await IsConstantZeroConstant.Run(sim) ? "is" : "is not") + " constant",
                2 => "constant one " + (await IsConstantOneConstant.Run(sim) ? "is" : "is not") + " constant",
                3 => "identity " + (await IsIdentityConstant.Run(sim) ? "is" : "is not") + " constant",
                4 => "negation " + (await IsNegationConstant.Run(sim) ? "is" : "is not") + " constant",
                _ => "The black box to pass in, 1 is constant zero, 2 is constant one, 3 is identity, 4 is negation.",
            };

            await ReplyAsync(result);
        }