by zzrg · 10y ago · 0 comments
0 1 10 11 100 101 110 111 1000 1001 1010 1011 1100 1101 1110 1111 10000...
(Granted, that is a transcendental number -- the Champernowne constant for base 2 -- but there's no real need to think of it that way.)
var simulateKeyPress = function(character) {
var evt = document.createEvent("KeyboardEvent");
evt.initKeyEvent ("keypress", true, true, window,
0, 0, 0, 0,
0, character.charCodeAt(0))
document.body.dispatchEvent(evt);
};
var num = 0;
var loop = function() {
console.log(num);
var binary = num.toString(2);
num++;
for(var i = 0, len = binary.length; i < len; i++) {
simulateKeyPress(binary[i] == '0' ? 'd' : 'f');
}
};
setInterval(loop, 100);Why?
3.141592653589793238462643383279502884197969399375105
Now, the interesting question, how accurate is my recollection after all these years? Ack, one digit off!
pi (base 9) = 3.12418812407442788645177761731035828516545353462652301126321450283864034354163303086781327...