Yin and yang: Difference between revisions

1,336 bytes added ,  10 months ago
Add Draco
(Ying and Yang Dart Example)
(Add Draco)
Line 2,157:
 
</pre>
 
=={{header|Draco}}==
<syntaxhighlight lang="draco">proc circle(int x, c, y, r) bool:
r*r >= (x/2)*(x/2) + (y-c)*(y-c)
corp
 
proc pixel(int x, y, r) char:
if circle(x, y, -r/2, r/6) then '\#'
elif circle(x, y, r/2, r/6) then '.'
elif circle(x, y, -r/2, r/2) then '.'
elif circle(x, y, r/2, r/2) then '\#'
elif circle(x, y, 0, r) then
if x<0 then '.' else '\#' fi
else ' '
fi
corp
 
proc yinyang(int r) void:
int x, y;
for y from -r upto r do
for x from -2*r upto 2*r do
write(pixel(x, y, r))
od;
writeln()
od
corp
 
proc main() void:
yinyang(4);
yinyang(8)
corp</syntaxhighlight>
{{out}}
<pre> ...
.........##
......###....##
...........####
..........#######
....###########
..####...######
..#########
###
...
.............##
...................####
............###......######
..........#######......####
..............###......########
.......................########
.....................##########
..................###############
..........#####################
........#######################
........######...##############
....######.......##########
......######...############
....###################
..#############
###</pre>
 
=={{header|DWScript}}==
Line 2,279 ⟶ 2,337:
#
</pre>
 
 
=={{header|Fōrmulæ}}==
2,115

edits