Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
braille renderer, in javascript
logo = (x, y) => disc(x, y) && !cross(x, y); disc = (x, y) => x * x + y * y < 1; cross = (x, y) => within(0.25, x, -0.4) || within(0.1, y, -0.3); within = (e, a, b) => Math.abs(a - b) < e; render = (w, h, f) => { let f2 = (x, y) => f(x * 2 / w - 1, -y * 2 / h + 1); return range(h, y => range(w, x => { let bit = ([b, dx, dy]) => f2(x + dx, y + dy) ? b : 0; let offset = dots.map(bit).reduce((a, b) => a + b); let code = 0x2800 + (offset || 1 << 5); return String.fromCharCode(code); }).join('')).join('\n'); }; dots = [[0,0], [0,1], [0,2], [1,0], [1,1], [1,2], [0,3], [1,3]] .map(([x, y], i) => [1 << i, x / 3, y / 5]); range = (n, f) => Array.apply(null, Array(n)).map((x, i) => f(i)); putstr(render(43, 24, logo));
run
|
edit
|
history
|
help
0
Triangle
JS exam part 2 - MonthCrypto
10 bottles of juice
Константа круга
Javascript reverse string, one index
//Rhino 1.7.7.1print("Hello, world!")
js object to json string
Iterate the iteratable object from the iterator object
Java - Looping thru Strings
not worked!!