.

Last edited on
all of the code you have given us is pretty meaningless to your objective and perhaps you should concentrate your thoughts on draw_triangle/diamond as that is where the actual task is.

extend those shapes into a grid, then decide which cells are '*' and which are 'SPACE' .
you know how many rows you need, and each row adds 2 *'s to it. so you can work out the overall width.

eg;
2 rows = 1 + 2 = 3 stars wide max
3 rows = 1 + 2 + 2 = 5 stars wide max
4 rows = 1 + 2 + 2 +2 =7 stars wide max

armed with that, you can draw each row of stars "centred" in the row.

take the 3 rows example. we know the block is 5 stars wide max (1+2+2), and also know that the first row only has 1 star, and therefore 4 spaces (5-1=4), so 2 spaces 1 star 2 spaces.

repeat this process through the rows.

Post some code and we'll take a look.



Topic archived. No new replies allowed.