Posted: . At: 11:24 AM. This was 1 year ago. Post ID: 17759
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


Lovely Python script to generate a nice Triforce.


This nice Python script is a nice way to generate a triforce.

triforce.py
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/env python3
 
# A nice program to generate a lovely triforce.
 
tri = "▲"
big_tri = []
for i in range(1,21,2):
   big_tri.append(" "*int((19-i)/2) + tri*i + " "*int((19-i)/2))
for t1 in big_tri:
    print(" "*10 + t1 + " "*10)
for t2 in big_tri:
    print(t2 + " " + t2)

Below is the output this script will give you. This does look very good indeed.

┌──(john㉿DESKTOP-PF01IEE)-[/mnt/c/Users/Intel i5/Documents]
└─$ ./triforce.py 
                   ▲                   
                  ▲▲▲                  
                 ▲▲▲▲▲                 
                ▲▲▲▲▲▲▲                
               ▲▲▲▲▲▲▲▲▲               
              ▲▲▲▲▲▲▲▲▲▲▲              
             ▲▲▲▲▲▲▲▲▲▲▲▲▲             
            ▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲            
           ▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲           
          ▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲          
         ▲                   ▲         
        ▲▲▲                 ▲▲▲        
       ▲▲▲▲▲               ▲▲▲▲▲       
      ▲▲▲▲▲▲▲             ▲▲▲▲▲▲▲      
     ▲▲▲▲▲▲▲▲▲           ▲▲▲▲▲▲▲▲▲     
    ▲▲▲▲▲▲▲▲▲▲▲         ▲▲▲▲▲▲▲▲▲▲▲    
   ▲▲▲▲▲▲▲▲▲▲▲▲▲       ▲▲▲▲▲▲▲▲▲▲▲▲▲   
  ▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲     ▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲  
 ▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲   ▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲ 
▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲ ▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲

To create a triforce using OpenGL, this program will suffice. This works perfectly on Linux.

triforceglut.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <GL/glut.h>
 
void display() {
    glClear(GL_COLOR_BUFFER_BIT);
 
    // Draw the top triangle
    glBegin(GL_TRIANGLES);
    glColor3f(1.0, 1.0, 0.0);
    glVertex2f(-0.5, 0.0);
    glVertex2f(0.5, 0.0);
    glVertex2f(0.0, 0.5);
    glEnd();
 
    // Draw the bottom-left triangle
    glBegin(GL_TRIANGLES);
    glColor3f(1.0, 1.0, 0.0);
    glVertex2f(-0.75, -0.5);
    glVertex2f(-0.25, -0.5);
    glVertex2f(-0.5, 0.0);
    glEnd();
 
    // Draw the bottom-right triangle
    glBegin(GL_TRIANGLES);
    glColor3f(1.0, 1.0, 0.0);
    glVertex2f(0.25, -0.5);
    glVertex2f(0.75, -0.5);
    glVertex2f(0.5, 0.0);
    glEnd();
 
    glFlush();
}
 
int main(int argc, char** argv) {
    glutInit(&argc, argv);
    glutCreateWindow("Triforce");
    glutDisplayFunc(display);
    glutMainLoop();
    return 0;
}

Compile this program this way.

┗━━━━━━━━━━┓ john@localhost ~/Documents
           ┗━━━━━━━━━━━━━╾ ╍▷ gcc gluttriforce.c -o triforce -lGL -lGLU -lglut

This is very cool indeed.

Making a triforce on 4chan does not work anymore as the invisible characters are filtered, but you may still use other characters. ُThis could be very interesting. to play with. There are some Unicode characters that stack vertically instead of horizontally. That is very strange indeed.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.