Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ex:
- alt (altitude) = 12
- base = 5
- output:
- xxxxx
- xxxx
- xxxx
- xxxx
- xxx
- xxx
- xxx
- xx
- xx
- xx
- x
- x
- The first column and the first row are defined and set by alt and base, respectively.
- That leaves the matter of the ‘inner triangle.’
- Inner triangle:
- w – the width of the inner triangle is base-2
- | |
- --xxx --
- | xxx | n - the height of each box is l/w
- | xxx --
- | xx
- L| xx
- | xx
- | x
- | x
- | x
- --[space] – box0 – the number of spaces at the end is l%w
- The length of the inner triangle (L) is alt-2
- In this case, alt is larger, so n = l/w
- box0 = l%w
- the width of each box is w (reassigned to nn) – 1 for each box until nn = 0
- the function drawline takes the first value and prints it the second value’s times. The third value is a Boolean value for whether or not a new line is printed at the end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement