Data update
This commit is contained in:
parent
29a5eea0d4
commit
5c1bb7bfa9
2011 changed files with 35081 additions and 3229 deletions
27
Task/Draw-a-cuboid/Jq/draw-a-cuboid.jq
Normal file
27
Task/Draw-a-cuboid/Jq/draw-a-cuboid.jq
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
def cubLine($n; $dx; $dy; $cde):
|
||||
def s: if . == 0 then "" else . * " " end; # for jaq
|
||||
reduce range(1; 9*$dx) as $d ("\($n|s)\($cde[0:1])";
|
||||
. + $cde[1:2] )
|
||||
+ $cde[0:1]
|
||||
+ ("\($dy|s)\($cde[2:])");
|
||||
|
||||
def cuboid($dx; $dy; $dz):
|
||||
"cuboid \($dx) \($dy) \($dz):",
|
||||
# top
|
||||
cubLine($dy+1; $dx; 0; "+-"),
|
||||
# top and side
|
||||
(range(1; 1+$dy) as $i | cubLine($dy-$i+1; $dx; $i-1; "/ |")),
|
||||
cubLine(0; $dx; $dy; "+-|"),
|
||||
# front and side
|
||||
(range(1; 4*$dz -$dy-2) as $i | cubLine(0; $dx; $dy; "| |")),
|
||||
cubLine(0; $dx; $dy; "| +"),
|
||||
# front and bottom
|
||||
(range(1; 1+$dy) as $i | cubLine(0; $dx; $dy-$i; "| /")),
|
||||
# bottom
|
||||
cubLine(0; $dx; 0; "+-\n");
|
||||
|
||||
cuboid(2; 3; 4),
|
||||
"",
|
||||
cuboid(1; 1; 1),
|
||||
"",
|
||||
cuboid(6; 2; 1)
|
||||
Loading…
Add table
Add a link
Reference in a new issue