Data update
This commit is contained in:
parent
29a5eea0d4
commit
5c1bb7bfa9
2011 changed files with 35081 additions and 3229 deletions
58
Task/Draw-a-cuboid/ALGOL-68/draw-a-cuboid.alg
Normal file
58
Task/Draw-a-cuboid/ALGOL-68/draw-a-cuboid.alg
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
BEGIN # draw some cuboids using ASCII art #
|
||||
|
||||
# draws a cuboid standing on one edge using ASCII art #
|
||||
PROC aa cuboid = ( INT h, w, l )VOID:
|
||||
BEGIN
|
||||
# top line #
|
||||
FOR i TO l DO print( ( " " ) ) OD;
|
||||
FOR i TO w + 1 DO print( ( "_" ) ) OD;
|
||||
print( ( newline ) );
|
||||
# rest of the top face and part of the visible side #
|
||||
INT face width := 0;
|
||||
INT edge pos := 0;
|
||||
FOR i TO l DO
|
||||
FOR j TO l - i DO print( ( " " ) ) OD;
|
||||
print( ( "/" ) );
|
||||
FOR j TO w DO print( ( IF i = l THEN "_" ELSE " " FI ) ) OD;
|
||||
print( ( "/" ) );
|
||||
edge pos +:= 1;
|
||||
IF edge pos <= h THEN
|
||||
# drsw the back edge #
|
||||
face width := 2 * ( edge pos - 1 );
|
||||
FOR j TO face width DO print( ( " " ) ) OD;
|
||||
print( ( "\" ) )
|
||||
ELSE
|
||||
# draw the bottom edge #
|
||||
FOR j TO face width + 1 DO print( ( " " ) ) OD;
|
||||
print( ( "/" ) )
|
||||
FI;
|
||||
print( ( newline ) )
|
||||
OD;
|
||||
# other vidible face #
|
||||
FOR i TO h DO
|
||||
FOR j TO i - 1 DO print( ( " " ) ) OD;
|
||||
print( ( "\" ) );
|
||||
FOR j TO w DO print( ( IF i = h THEN "_" ELSE " " FI ) ) OD;
|
||||
print( ( "\" ) );
|
||||
edge pos +:= 1;
|
||||
IF edge pos <= h THEN
|
||||
# drsw the back edge #
|
||||
FOR j TO face width + 1 DO print( ( " " ) ) OD;
|
||||
print( ( "\" ) )
|
||||
ELSE
|
||||
# draw the bottom edge #
|
||||
FOR j TO face width DO print( ( " " ) ) OD;
|
||||
face width -:= 2;
|
||||
print( ( "/" ) )
|
||||
FI;
|
||||
print( ( newline ) )
|
||||
OD
|
||||
|
||||
END # aa cuboid # ;
|
||||
|
||||
aa cuboid( 3, 2, 4 );
|
||||
aa cuboid( 4, 3, 2 );
|
||||
aa cuboid( 2, 4, 3 );
|
||||
aa cuboid( 2, 3, 4 )
|
||||
|
||||
END
|
||||
Loading…
Add table
Add a link
Reference in a new issue