A christmas tree

I made a pretty christmas tree.


||||||||||||||||||||$
|||||||||||||||||||$$$
||||||||||||||||||$$|$$
|||||||||||||||||$$|$|$$
||||||||||||||||$$|$|$|$$
|||||||||||||||$$|$|$|$|$$
||||||||||||||$$|$|$|$|$|$$
|||||||||||||$$|$|$|$|$|$|$$
||||||||||||$$|$|$|$|$|$|$|$$
|||||||||||$$|$|$|$|$|$|$|$|$$
||||||||||$$|$|$|$|$|$|$|$|$|$$
|||||||||$$|$|$|$|$|$|$|$|$|$|$$
||||||||$$|$|$|$|$|$|$|$|$|$|$|$$
|||||||$$|$|$|$|$|$|$|$|$|$|$|$|$$
||||||$$|$|$|$|$|$|$|$|$|$|$|$|$|$$
|||||$$|$|$|$|$|$|$|$|$|$|$|$|$|$|$$
||||$$|$|$|$|$|$|$|$|$|$|$|$|$|$|$|$$
|||$$|$|$|$|$|$|$|$|$|$|$|$|$|$|$|$|$$
||$$|$|$|$|$|$|$|$|$|$|$|$|$|$|$|$|$|$$
|$$|$|$|$|$|$|$|$|$|$|$|$|$|$|$|$|$|$|$$
|$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
||||||||||||||||||$|||$
||||||||||||||||||$|||$
||||||||||||||||||$|||$
||||||||||||||||||$|||$
||||||||||||||||||$|||$
||||||||||||||||||$|||$
||||||||||||||||||$|||$
||||||||||||||||||$|||$
||||||||||||||||||$|||$
||||||||||||||||||$|||$

Here's the source:
#include <stdio.h>
#include <stdbool.h>
#include <assert.h>
#define WIDTH 20
#define COLOR_BASE ""
#define RED COLOR_BASE ""
#define COLOR_RESET ""
#define CB "|"
#define CF "$"
// char **ornament_colors;
// ornament_colors[0]=(char *)"2";
// ornament_colors[1]=(char *)"1";
char *ornament_colors[2] = {
	"" /*";5;41"*/,
	"" /*";5;42"*/
};
int main() {
	bool just_did_colorful=false;
	int r=0;
	for(int a=0;a<WIDTH;a++) {
		just_did_colorful = false;
		for(int b=0;b<WIDTH-a;b++) {
			printf(CB);
		}
		if(a==0)
			printf(CF);
		else {
			printf(CF);
			int q=0;
			for(int c=0;c<(a*2)-1;c++) {
				q++;
				if(q%2==0) {
					printf(CB);
					just_did_colorful=false;
				}
				else {
					assert(just_did_colorful==false);
					r++;
					//printf("", ornament_colors[r%2]);
					printf(CF);
					just_did_colorful=true;
				}
			}
			printf(CF);
		}
		printf("\n");
	}
	printf(CB);
	for(int a=0;a<(WIDTH*2)-1;a++) {
		printf(CF);
	}
	printf("\n");
	for(int n=0;n<10;n++) {
		printf(CB);
		for(int a=0;a<WIDTH-3;a++) {
			printf(CB);
		}
		printf(CF CB CB CB CF);
		/* for(int a=0;a<25;a++) {
			printf("%d", a%10);
		} */
		printf("\n");
	}
	// printf("%d\n", WIDTH-2);
}
2 Likes

Weird, it broke in a topic.

still tho its cool!

Nice! How long did it take you?

What is it supposed to look like? It seems fine to me

Not that long, took about an hour for the original part (I made it a while back) + a few minutes to modify it so it’d work well in a forum post.

2 Likes

A christmas tree

Looks lovely now!

Ohhhh I didn’t see the edit history, my bad

Here’s the original version (it has color, though):

                    ^
                   /*\
                  /* *\
                 /* * *\
                /* * * *\
               /* * * * *\
              /* * * * * *\
             /* * * * * * *\
            /* * * * * * * *\
           /* * * * * * * * *\
          /* * * * * * * * * *\
         /* * * * * * * * * * *\
        /* * * * * * * * * * * *\
       /* * * * * * * * * * * * *\
      /* * * * * * * * * * * * * *\
     /* * * * * * * * * * * * * * *\
    /* * * * * * * * * * * * * * * *\
   /* * * * * * * * * * * * * * * * *\
  /* * * * * * * * * * * * * * * * * *\
 /* * * * * * * * * * * * * * * * * * *\
 =======================================
                  |   |
                  |   |
                  |   |
                  |   |
                  |   |
                  |   |
                  |   |
                  |   |
                  |   |
                  |   |

4 Likes

This topic was automatically closed after 7 days. New replies are no longer allowed.