Not logged in.

From instruction: Looking

Code: Paul looking twice by julian

Some of parts watching parts of others, other parts watching other parts. Twice is looking Paul is thinking twice.

(
var such;
SynthDef("dirac", { |side|
	var now = Impulse.ar(0); 
	FreeSelf.kr(now); 
	OffsetOut.ar(side, now * inf)
}).memStore;

such = (
	look: { |self, those| 2.do { feelLookedAt(those, self); wait(rand(1.0))  } },
	feelLookedAt: { |self, other| 
		var x = rrand(0.5, 1) * 1e-4; glimpse(self, other, x); glimpse(other, self, x/2) 
	},
	think: { |self, what| wait(1.0.rand); if(0.5.coin) { fork(what) } { value(what) } },
	glimpse: { |self, other, what|
			wait(rand(2.0)); 
			if(0.5.coin) { look(self, other) } {
				think(self, { 
					do(rand(1e3), { s.sendMsg(9, \dirac, -1, 1,1, \side, side(self));
					wait(what) }) })
			};
			
	}
);
fork { look(put(copy(such), \side, 0), put(copy(such), \side, 1)) };
)

[download]

Written in SuperCollider. Released under the GPLv2 license