// 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)"); }
// // test 3: // test outputs static void test3() { MindClock clk = new MindClock(); Cell a = new Cell(clk); Queue<string> q = new Queue<string>(); OutputCell c = new OutputCell(q, "hello world", clk); a.connect_output(c); for(int i = 0; i < 11; i++) { a.upcharge(); } System.Console.WriteLine("a -> " + a + " (?1)"); System.Console.WriteLine("q -> " + q.Dequeue()); }