Esempio n. 1
0
 public void ChangeStep(string _s)
 {
     if (_s == "Fix")
     {
         currentState = BellState.Fix;
         clean.SetActive(false);
         hammer.SetActive(false);
         fix.SetActive(true);
     }
     else if (_s == "Clean")
     {
         currentState = BellState.Clean;
         clean.SetActive(true);
         hammer.SetActive(false);
         fix.SetActive(false);
     }
     else if (_s == "Hammer")
     {
         heldObject   = "Hammer";
         currentState = BellState.Hammer;
         clean.SetActive(false);
         hammer.SetActive(true);
         fix.SetActive(false);
     }
 }
Esempio n. 2
0
        static void TestBellState()
        {
            var totalCounts = 1000;
            Dictionary <string, int> resutls = new Dictionary <string, int>()
            {
                { "00", 0 },
                { "01", 0 },
                { "10", 0 },
                { "11", 0 }
            };

            using (var qsim = new QuantumSimulator())
            {
                for (int i = 0; i < totalCounts; i++)
                {
                    (Result, Result)bell = BellState.Run(qsim).Result;
                    var key = $"{bell.Item1}{bell.Item2}"
                              .Replace("Zero", "0")
                              .Replace("One", "1");

                    resutls[key] = 1 + resutls[key];
                }

                foreach (var res in resutls)
                {
                    Console.WriteLine($"{res.Key}: {res.Value}");
                }
            }
        }