Beispiel #1
0
        // test 1:
        // Create two notes, load them, then decay them.
        static void test1()
        {
            MindClock clk = new MindClock();
            Cell a = new Cell(clk);
            Cell b = new Cell(clk);

            System.Console.WriteLine("Starting test...");

            a.connect_output(b);

            // load
            for(int i=0; i<99; i++) {
                a.upcharge();
            }
            System.Console.WriteLine("a -> " + a + " (?9)");
            System.Console.WriteLine("b -> " + b + " (?9)");

            // decay (there could be a thread somewhere
            // running this loop with a delay)
            for(int i=0; i<5; i++) {
                clk.cycle();
            }
            System.Console.WriteLine("a -> " + a + " (?4)");
            System.Console.WriteLine("b -> " + b + " (?4)");

            for(int i=0; i<99; i++) {
                clk.cycle();
            }
            System.Console.WriteLine("a -> " + a + " (?0)");
            System.Console.WriteLine("b -> " + b + " (?0)");
        }