Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)

Triforce

By: GGMethos on Sep 20th, 2013  |  syntax: C++  |  size: 0.56 KB  |  hits: 30  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. >>36861886
  2. #include <cstdio>
  3.  
  4. const int SIZE = 30;
  5. const int WIDTH = SIZE*2;
  6. const int HEIGHT = SIZE;
  7. const int HLAF_HEIGHT = HEIGHT / 2;
  8. char screen[WIDTH*HEIGHT];
  9.  
  10. void Draw(int x, int y)
  11. {
  12. if (y >= HEIGHT || x >= WIDTH || x < 0) return;
  13. if (y == HLAF_HEIGHT && (x != HLAF_HEIGHT && x != (WIDTH-HLAF_HEIGHT))) return;
  14.  
  15. screen[y*WIDTH+x] = 'Z';
  16.  
  17. Draw(x-1, y+1);
  18. Draw(x, y+1);
  19. Draw(x+1, y+1);
  20. }
  21.  
  22. int main()
  23. {
  24. Draw(SIZE, 0);
  25. for (int y =0; y < SIZE; y++) {
  26. for (int x =0; x < WIDTH; x++) {
  27. std::putchar(screen[y*WIDTH+x]);
  28. }
  29. std::putchar('\n');
  30. }
  31. }