June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View file

@ -0,0 +1,20 @@
function yinyang(n::Int=3)
radii = (i * n for i in (1, 3, 6))
ranges = collect(collect(-r:r) for r in radii)
squares = collect(collect((x, y) for x in rnge, y in rnge) for rnge in ranges)
circles = collect(collect((x, y) for (x,y) in sqrpoints if hypot(x, y) ≤ radius)
for (sqrpoints, radius) in zip(squares, radii))
m = Dict((x, y) => ' ' for (x, y) in squares[end])
for (x, y) in circles[end] m[(x, y)] = x > 0 ? '·' : '*' end
for (x, y) in circles[end-1]
m[(x, y + 3n)] = '*'
m[(x, y - 3n)] = '·'
end
for (x, y) in circles[end-2]
m[(x, y + 3n)] = '·'
m[(x, y - 3n)] = '*'
end
return join((join(m[(x, y)] for x in reverse(ranges[end])) for y in ranges[end]), '\n')
end
println(yinyang(4))

View file

@ -16,9 +16,10 @@ sub yin_yang ($rad, $cx, $cy, :$fill = 'white', :$stroke = 'black', :$angle = 90
say '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink">';
<svg height="400" width="400" xmlns="http://www.w3.org/2000/svg" version="1.1"
xmlns:xlink="http://www.w3.org/1999/xlink">';
yin_yang(40, 50, 50);
yin_yang(20, 120, 120);
yin_yang(100, 130, 130);
yin_yang(50, 300, 300);
say '</svg>';

View file

@ -1,5 +1,3 @@
sub cheat_harder ($scale) {
"<span style=\"font-size:$scale%;\">&#x262f;</span>";
}
sub cheat_harder ($scale) { "<span style=\"font-size:$scale%;\">&#x262f;</span>"; }
say '<div><br /><br />', cheat_harder(700), cheat_harder(350), '</div>';
say '<div>', cheat_harder(700), cheat_harder(350), '</div>';

View file

@ -1,4 +1,4 @@
/*REXX program creates and displays an ASCII art version of the Yin─Yang symbol.*/
/*REXX program creates & displays an ASCII art version of the Yin─Yang (taijitu) symbol.*/
parse arg s1 s2 . /*obtain optional arguments from the CL*/
if s1=='' | s1=="," then s1=17 /*Not defined? Then use the default. */
if s2=='' | s2=="," then s2=s1 % 2 /* " " " " " " */