write a program that generates picrel for any given height
Can Any Forums code a triforce?
Other urls found in this thread:
#lang racket
(require 2htdp/image)
(let sierpinski ([n 8])
(if (zero? n)
(triangle 2 'solid 'red)
(let ([t (sierpinski (- n 1))])
(freeze (above t (beside t t))))))
import triforce
height = int(input())
triforce.print(height)
>Not
from triforce import Triforce
def main():
triforce = Triforce(int(input()))
triforce.print()
if __name__ == "__main__":
main()
You will never have a job
does every part have to be 19 triangles wide and ten rows high?
▲
▲ ▲
>t. some faggot who just flipped to the advanced section of the python book and thought he was a python master
Simple is better midwit.
After all these fucking years this still gets me every time.
>t. NEET
>he thinks pajeet tier """job security""" tactics make him employable
>he doesn't know that making 10/10 readable code is what actually makes him employable
>he couldn't even make 10/10 readable code anyway
>t. code monkey stackoverflowlet
const ASCII = await downloadTriforce();
console.log(ASCII);
waiting for the obligatory hardcoded solution
any given height means any given height user.
Yeah I can.
No, I'm busy drinking Busch Light and listening to music.
#include
#include
int main(int argc, char** argv)
{
int tri_height = 9;//atoi(argv[1]);
int big_tri_height = 3;// atoi(argv[2]);
int half_width = tri_height;
int total_hwidth = half_width * big_tri_height;
if (!(tri_height & 1))
tri_height++;
for (int i = 0; i < tri_height * big_tri_height; i++) {
int tri_count = (i % tri_height) * 2 + 1;
int pyramids = i / tri_height + 1;
std::string fulloffset(half_width * (big_tri_height - pyramids), ' ');
printf("%s", fulloffset.c_str());
for (int j = 0; j < pyramids; j++) {
int m = half_width - (tri_count/2 + 1);
std::string buffer(m, ' ');
std::string tris(tri_count, 'A');
printf("%s", buffer.c_str());
printf("%s", tris.c_str());
printf("%s", buffer.c_str());
printf(" ");
}
printf("\n");
}
return 0;
}
Dont know how to wide characters
>this is your brain on college
kek, nice
A
AAA
AAAAA
A A
AAA AAA
AAAAA AAAAA
A A A
AAA AAA AAA
AAAAA AAAAA AAAAA
A A A A
AAA AAA AAA AAA
AAAAA AAAAA AAAAA AAAAA
A A A A A
AAA AAA AAA AAA AAA
AAAAA AAAAA AAAAA AAAAA AAAAA
A A A A A A
AAA AAA AAA AAA AAA AAA
AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA
A A A A A A A
AAA AAA AAA AAA AAA AAA AAA
AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA
A A A A A A A A
AAA AAA AAA AAA AAA AAA AAA AAA
AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA
A A A A A A A A A
AAA AAA AAA AAA AAA AAA AAA AAA AAA
AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA
A A A A A A A A A A
AAA AAA AAA AAA AAA AAA AAA AAA AAA AAA
AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA
someone run this? curious
In J this is just
tri =: [: (i.@# >: |) ] >@#
i think this does it
t = lambda s,i: [i+" "*(s-x)+"▲"*(x*2-1)+" "*(s-x) for x in range(s)][1:]
n = int(input())
print("\n".join(t(n," "*(n-1))))
print("\n".join([i[0]+i[1] for i in zip(t(n,""),t(n,"\b"))]))
holy shit you can't be this autistic user
ah fuck
triforce =: (# |.inv"1 ] ,. (0 1 + $) $ 0:) , ] ,. 0 ,. ]
(' ' , u: 9650) {~ triforce tri 3
▲
▲▲▲
▲▲▲▲▲
▲ ▲
▲▲▲ ▲▲▲
▲▲▲▲▲ ▲▲▲▲▲
What did I do???
I thought I was retarded for not knowing how to make a program that draws a circle
Are you actually this retarded
It boggles my mind that multiple people are taking you seriously
Lisp chads can't stop winning
kek
epic
bumping so I can submit my answer later
just do it already.
been trying for the last hour or so
rather than printing 3 triangles I thought I was supposed to create a matrix, draw 1 large triangle, 1 upside down triangle, then where they overlap flip the bits in the matrix, then print the matrix
I feel so disheartened now... still didn't finish the solution btw. I quit lol.
>no rust anons shitting up the thread
kekw, i may port to java, im really bored
>pls do homework i am about to fail programming class and i won't get to continue faking my way through life plsss
Fuck off, kid.
A
AAA
AAAAA
AAAAAAA
AAAAAAAAA
AAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAA
A
A
AAA
AAA
AAAAA
AAAAA
AAAAAAA
AAAAAAA
AAAAAAAAA
AAAAAAAAA
AAAAAAAAAAA
AAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAAAA
AAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAA
A
A
A
AAA
AAA
AAA
AAAAA
AAAAA
AAAAA
AAAAAAA
AAAAAAA
AAAAAAA
AAAAAAAAA
AAAAAAAAA
AAAAAAAAA
AAAAAAAAAAA
AAAAAAAAAAA
AAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAAAA
AAAAAAAAAAAAAAA
AAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAA
mood
public static void main(String[] args) {
int tri_height = 9; //atoi(argv[1]);
int big_tri_height = 2; // atoi(argv[2]);
int half_width = tri_height;
if (!((tri_height & 1) == 1)) {
tri_height++;
}
for (int i = 0; i < tri_height * big_tri_height; i++) {
int tri_count = (i % tri_height) * 2 + 1;
int pyramids = i / tri_height + 1;
//std::string fulloffset(half_width * (big_tri_height - pyramids), ' ');
String fulloffset = "";
for (int ba = 0; ba < half_width; ba++) {
fulloffset += " ";
}
if (pyramids == 1) {
System.out.print(fulloffset);
}
for (int j = 0; j < pyramids; j++) {
int m = half_width - (tri_count / 2 + 1);
//std::string buffer(m, ' '); //buffer with n chars
String buffer = "";
for (int ba = 0; ba < m; ba++) {
buffer += " ";
}
//std::string tris(tri_count, 'A'); //buffer with n chars
String tris = "";
for (int ba = 0; ba < tri_count; ba++) {
tris += "A";
}
System.out.print(buffer + tris + buffer + " ");
}
System.out.println(""); // \n
}
}
a java solution based on 's
41% chance they won't
kek
▲
▲▲
I don't have a Lisp interpreter handy but it's going to draw something like this.
>all those people getting filtered by Unicode triangle symbol
lol
▲
▲ ▲
▲
▲ ▲
like this?
▲
▲ ▲
▲ ▲
▲
▲
▲ ▲
>t. guy who didn't even try
Fuck you.
▲ ▲ ▲
▲ ▲ ▲
▲ ▲ ▲
▲ ▲ ▲ ▲▲
First program ever in ADA, pls don't bully
I literally don't know what the fuck I'm doing
triangle.ads
procedure Triangle (Height, Times, Pad : Integer);
triangle.adb
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
procedure Triangle (Height, Times, Pad : Integer) is
Width : Integer := 1;
Empty : Integer;
begin
Empty := (Height / (2 - 1)) - 1;
for I in 1 .. Height loop
-- Pad each line with 'Pad' spaces
for P in 1 .. Pad loop
Put (" ");
end loop;
for T in 1 .. Times loop
-- Preceding empty space
for J in 1 .. Empty loop
Put (" ");
end loop;
-- Triangle body
for K in 1 .. Width loop
Put ("▲");
end loop;
-- Trailing space (necessary to print >1 triangles)
-- +1 to pad the next triangle a bit so it doesn't look weird
for L in 1 .. Empty + 1 loop
Put (" ");
end loop;
end loop;
-- Jump to the next line and update the width and empty space
Put_Line ("");
Width := Width + 2;
Empty := Empty - 1;
end loop;
end Triangle;
triforce.adb
with Triangle;
procedure Triforce is
Height : Integer := 6;
begin
Triangle(Height, 1, Height);
Triangle(Height, 2, 0);
end Triforce;
Ez, HTML wins again.
i.4cdn.org
▲
▲ ▲
are ya jelly newfags?
▲
▲ ▲
lol
lmao
delta = '\u0394'
height = int(input('enter height:'))
width = 2*height -1
mid_max = height-1
for i in range(height):
t = 2*i + 1
outer = (width-t)//2
inner = 0 if t
▲
▲ ▲
did i do it right?
▲
▲
▲
▲
▲▲
yolo
▲
▲ ▲
▲
▲▲
When did the spaces stop working?
▲
▲ ▲
spaces never worked new friend
I don't get it, why every Anons writes sierpinski triangle made of As instead of triforce made of ▲s?
▲
most anons have a basedboard 60% or lower, don't have a numpad to type character codes on
It's literally as simple as copy pasting some characters available online
Watch me, a phoneposter do it easily
▲
▲ ▲
∆
∆∆
newfag
the white character is banned you retard.
how did you not figure that out from the posts above?
▲
▲ ▲
alt-255 alt-255 alt-30
alt-30 alt-255 alt-30
255 is banned
on other boards/chans you also need some character above or else it won't work
I'm from 2009
▲
▲▲
wdym, I did do it correctly you fags
No.
use std::env;
fn main() {
let mut args = env::args();
// Skips the first argument, which is just the executable name.
args.next();
let triangle_height = args
.next()
.expect("must specify the triangle height")
.parse::()
.unwrap();
let total_height_in_triangles = args
.next()
.expect("must specify the total height")
.parse::()
.unwrap();
let bottom_triangle_number = 1 + 2 * (triangle_height - 1);
let total_width =
bottom_triangle_number * total_height_in_triangles + total_height_in_triangles;
for i in 1..=total_height_in_triangles {
let mut triangle_count = 1;
for _ in 0..triangle_height {
if i == 1 {
let half_width = (total_width - triangle_count) / 2;
println!("{}{}", " ".repeat(half_width), "▲".repeat(triangle_count));
} else {
let initial_skip =
(total_width - triangle_count - ((bottom_triangle_number + 1) * (i - 1)) - 1)
/ 2;
let half_width = (bottom_triangle_number * 2 - triangle_count * 2 + 2) / 2;
print!("{}{}", " ".repeat(initial_skip), "▲".repeat(triangle_count));
for _ in 1..i {
print!("{}{}", " ".repeat(half_width), "▲".repeat(triangle_count));
}
println!();
}
triangle_count += 2;
}
}
}
Wasted a few hours on this shit
You 'shopped it
Outputs:
$ ./a.out 5 3
▲
▲▲▲
▲▲▲▲▲
▲▲▲▲▲▲▲
▲▲▲▲▲▲▲▲▲
▲ ▲
▲▲▲ ▲▲▲
▲▲▲▲▲ ▲▲▲▲▲
▲▲▲▲▲▲▲ ▲▲▲▲▲▲▲
▲▲▲▲▲▲▲▲▲ ▲▲▲▲▲▲▲▲▲
▲ ▲ ▲
▲▲▲ ▲▲▲ ▲▲▲
▲▲▲▲▲ ▲▲▲▲▲ ▲▲▲▲▲
▲▲▲▲▲▲▲ ▲▲▲▲▲▲▲ ▲▲▲▲▲▲▲
▲▲▲▲▲▲▲▲▲ ▲▲▲▲▲▲▲▲▲ ▲▲▲▲▲▲▲▲▲
$ ./a.out 10 2
▲
▲▲▲
▲▲▲▲▲
▲▲▲▲▲▲▲
▲▲▲▲▲▲▲▲▲
▲▲▲▲▲▲▲▲▲▲▲
▲▲▲▲▲▲▲▲▲▲▲▲▲
▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲
▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲
▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲
▲ ▲
▲▲▲ ▲▲▲
▲▲▲▲▲ ▲▲▲▲▲
▲▲▲▲▲▲▲ ▲▲▲▲▲▲▲
▲▲▲▲▲▲▲▲▲ ▲▲▲▲▲▲▲▲▲
▲▲▲▲▲▲▲▲▲▲▲ ▲▲▲▲▲▲▲▲▲▲▲
▲▲▲▲▲▲▲▲▲▲▲▲▲ ▲▲▲▲▲▲▲▲▲▲▲▲▲
▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲ ▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲
▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲ ▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲
▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲ ▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲
Anyone made a fractal triforce?
t. didn't read thread
Barely anyone made any kind of triforce in this thread
No, i won't do that, it's a waste of time. Fuck you OP
yup, see I also made a 3d fractal triforce
>Put ("▲");
OHNONONONONO
+++++>>>->->->++++++[>+++++>+++++>++--..
it's a mess and it's too long to fit in a Any Forums post but it works.
assemble with nasm -f elf triforce.asm and link with ld -o triforce triforce.o
nice one, gj, user!
Rate my Python solution, it werks
def print_triforce(N):
img = []
for i in range(N//2+1):
img.append(['_'] * N)
a = b = N//2
for i in range(N//2+1):
for j in range(a, b+1):
img[i][j] = 'X'
a -= 1
b += 1
a = N//2
b = a
for i in range(N//4+1):
for j in range(a, b+1):
img[-1-i][j] = '_'
a -= 1
b += 1
for i in img:
print(''.join(i))
print_triforce(51)
Works for multiple numbers of sub-triangles, and different sub-triangle heights.
#include
#include
using namespace std;
string TRIFORCE_CHAR = "▲";
int posMod(int a, int b) {
int out = a%b;
return out + (out < 0) * b;
}
int floorDiv(int a, int b) {
int out = a/b;
if (a < 0) out = (a - b + 1) / b;
return out;
}
int main() {
int sideLen, totalSubTriangles;
cin >> sideLen >> totalSubTriangles;
int baseWidth = sideLen * 2 - 1;
const int SCREEN_H = sideLen * totalSubTriangles;
const int SCREEN_W = (baseWidth + 1) * totalSubTriangles;
for (int y=SCREEN_H-1; y>=0; y--) {
string line = "";
for (int x=0; x= 0 && oy >= 0
&& (ox + oy < totalSubTriangles);
int ty = posMod(y, sideLen);
int tx = posMod(x - y, baseWidth + 1);
if (printedTri && tx >= 0 && tx + 2*ty < baseWidth) c = TRIFORCE_CHAR;
line += c;
}
cout
It's not a sierpinski triangle, lol
∆
∆∆
based
What lang is that
how did i go rust sisters
use std::env;
fn main() {
let triforce_height = env::args()
.nth(1)
.expect("No triforce height given")
.parse()
.expect("Failed to parse triforce height");
let triangle_height = env::args()
.nth(2)
.expect("No triangle height given")
.parse()
.expect("Failed to parse triangle height");
let triangle_width = (2 * triangle_height) - 1;
let mut triforce = Vec::new();
for i in 0..triforce_height {
for j in 0..triangle_height {
let row = " ".repeat(i * triangle_height)
+ &format!(
"{:^1$} ",
"▲".repeat(triangle_width - (j * 2)),
triangle_width,
)
.repeat(triforce_height - i);
triforce.insert(0, row);
}
}
println!("{}", triforce.join("\n"));
}
But Mathematica is a Lisp
Wolfram Language, there is not enough WL users on Any Forums for a general, but we talk about it in /emg/ sometimes :)
I did this in my intro to cs class basically but I can't do it now. Wtf happened to me.
My amateur Haskell method
import Control.Monad
import Data.List
import System.Environment
triangle :: Int -> [String]
triangle n = reverse $ trianglePadded n 0
where
trianglePadded :: Int -> Int -> [String]
trianglePadded n pad
| n [String] -> [String]
combine [] _ = []
combine _ [] = []
combine (x : xs) (y : ys) = (x " " y) : combine xs ys
heightToBase :: Int -> Int
heightToBase = flip (-) 1 . (*) 2 . flip div 2
triforce :: Int -> [String]
triforce =
liftM2
(++)
( liftM2
combine
( flip map [1 ..]
. (const . flip replicate ' ' . flip div 2 . heightToBase)
)
(triangle . heightToBase)
)
(liftM2 combine triangle triangle . heightToBase)
main :: IO ()
main = getArgs >>= (putStrLn . intercalate "\n" . triforce . read . head)
Alright user, if you insist
#include
#include
using namespace std;
string TRIFORCE_CHAR = "▲";
int posMod(int a, int b) {
int out = a%b;
return out + (out < 0) * b;
}
int floorDiv(int a, int b) {
int out = a/b;
if (a < 0) out = (a - b + 1) / b;
return out;
}
int main() {
int sideLen, totalSubTriangles;
cin >> sideLen >> totalSubTriangles;
int baseWidth = sideLen * 2 - 1;
const int SCREEN_H = sideLen * totalSubTriangles;
const int SCREEN_W = (baseWidth + 1) * totalSubTriangles;
for (int y=SCREEN_H-1; y>=0; y--) {
string line = "";
for (int x=0; x= 0 && oy >= 0
&& (ox + oy < totalSubTriangles);
int ty = posMod(y, sideLen);
int tx = posMod(x - y, baseWidth + 1);
if (printedTri && (tx + 2*ty == baseWidth - 1 || tx == 0 || (ty == 0 && tx < baseWidth))) c = TRIFORCE_CHAR;
line += c;
}
cout
true
Thanks user
kek
based
chad
▲
▲▲
> (*) 2 . flip div 2
wow I'm stupid
public class Triforce {
public static void main(String[] args) {
triforce(6);
}
public static void triforce(int size) {
// double the size because of future calculations
size = size*2;
for (int i=0;i 0; ii=ii-2) {
System.out.print(" ");
}
// this prints the upper arrows: it grows with i, so it is 1,3,5...
for (int ii = 0; ii
i+=2
now i see that you need to have it repeating 2 times..... i mean it is not hard... but i guess i need to change some stuff
good morning sir!
this was fun... works for triangles of size 0 to infinity
thanks user
i need a job
#!/bin/python
TRIANGLE_CHAR = "▲"
TRIFORCE_HEIGHT = 3
def print_triangle(size):
for level in range(TRIFORCE_HEIGHT):
for x in range(size):
print(" " * (size * (TRIFORCE_HEIGHT - level - 1)),
(" " * (int(size - x)) +
TRIANGLE_CHAR * (2*x + 1) +
" " * (int(size - x)-1)) * (level+1))
# tests
print_triangle(10)
TRIANGLE_HEIGHT = 5 # yes i change consts
print_triangle(4)
sorry change TRIANGLE_HEIGHT to TRIFORCE_HEIGHT if you want to run this anons
this is harder (for a noob) than it seems. working on it lol
img[i][j] = 'X'
IndexError: list index out of range
Are you using python3?
3.9 anaconda, sorry user, I just copied & pasted it. I don't really understand your code
mine took about an hour to do, step one is get it to draw a single triangle and then you can worry about the bottom two
#include
constexpr auto kRowHeight = 18.0;
constexpr auto kToothSpacing = 9.0;
constexpr auto kToothWidth = 13.0;
constexpr auto kToothHeight = 13.0;
constexpr auto kRows = 10;
constexpr auto kToothDepth = kToothHeight * kToothSpacing / kToothWidth;
constexpr auto kImageWidth = (4.0 * kRows - 2.0) * kToothSpacing + kToothWidth;
constexpr auto kImageHeight = kRowHeight * kRows * 2.0;
void DrawSawtooth(Cairo::RefPtr cr, size_t teeth_count) {
cr->move_to(0.0, 0.0);
for (size_t i = 1; i < teeth_count; ++i) {
cr->line_to(kToothSpacing * (i - 0.5), kToothDepth);
cr->line_to(kToothSpacing * i, 0.0);
}
cr->line_to(kToothSpacing * (teeth_count - 1) + kToothWidth / 2.0, kToothHeight);
cr->line_to(-kToothWidth / 2.0, kToothHeight);
cr->fill();
}
void DrawTriangle(Cairo::RefPtr cr) {
cr->translate(0, kRowHeight - kToothHeight);
DrawSawtooth(cr, 1);
for (size_t i = 1; i < kRows; ++i) {
cr->translate(-kToothSpacing, kRowHeight);
DrawSawtooth(cr, 2 * i + 1);
}
}
int main() {
auto img = Cairo::ImageSurface::create(Cairo::Format::FORMAT_RGB24, kImageWidth, kImageHeight);
auto cr = Cairo::Context::create(img);
cr->set_source_rgb(0.188, 0.039, 0.141);
cr->paint();
cr->set_source_rgb(1.0, 1.0, 1.0);
cr->translate(kToothWidth / 2.0 + (kRows * 2 - 1) * kToothSpacing, 0.0);
DrawTriangle(cr);
cr->set_identity_matrix();
cr->translate(kToothWidth / 2.0 + (kRows * 3 - 1) * kToothSpacing, kRows * kRowHeight);
DrawTriangle(cr);
cr->set_identity_matrix();
cr->translate(kToothWidth / 2.0 + (kRows - 1) * kToothSpacing, kRows * kRowHeight);
DrawTriangle(cr);
img->write_to_png("cum.png");
}
Bash script for desktop threads
#!/bin/bash
echo -n "Enter height: "
read h #Height of each triangle
t=1 #Number of items per line
l=$((h*2)) #Total height
makeTriangle () {
for ((i=0; i
Ruby is pretty fun to fuck around in
def generate_triforce(triforce_height, overall_height)
tri = '▲'
sp = ' '
overall_height.times do |i|
adjust_space = sp*(triforce_height)*(overall_height - i)
triforce_height.times do |j|
space = sp*((triforce_height-j)-1)
tris = tri*((j*2)+1)
str = adjust_space + ((space + tris + space + sp)*(i+1)) + adjust_space
puts(str)
end
end
end
generate_triforce(5,4)
fucking legend
'''
def get_line(height, width, i):
w = (i+1)*2 - 1
wS = int((width - w)/2)
return (" " * wS + "▲" * w + " " * wS)
height = 20
width = height * 2 - 1
for j in range(height):
print(" " * height + get_line(height, width, j))
for j in range(height):
print(get_line(height, width, j) + get_line(height, width, j))
'''
How the fuck do your format on 4chins
> pic related
>>
wrong but nice try
**bold**
if True:
print("op is faggot")
[flip] flipped [/flip]
%triforce
print("test")
ah okay got it thank you for nothing faggs
def get_line(height, width, i):
w = (i+1)*2 - 1
wS = int((width - w)/2)
return (" " * wS + "▲" * w + " " * wS)
height = 20
width = height * 2 - 1
for j in range(height):
print(" " * height + get_line(height, width, j))
for j in range(height):
print(get_line(height, width, j) + get_line(height, width, j))
Segfaults on my machine
Right side isn't aligned
read the fucking sticky
import sys
args = list(sys.argv)
args.remove(args[0])
def maketri(uwu,triangles):
cstr = str("")
size = int(uwu*2)-1
chars = 1
ctriangles = 1
while ctriangles < triangles+1:
ospaces = int(size/2)
scloop = 0
nspaces = int(ospaces)
while scloop < ospaces+1:
cloop = 0
chars = size-(nspaces*2)
for i in range(0,(ospaces+1)*(triangles-ctriangles),+1):
cstr += str(" ")
for i in range(0,nspaces,+1):
cstr += str(" ")
while cloop < ctriangles:
for i in range(0,chars,+1):
cstr += str("A")
for i in range(0,nspaces,+1):
cstr += str(" ")
cstr += " "
cloop += 1
nspaces -= 1
chars += 2
cstr += "\n"
scloop += 1
ctriangles += 1
print(cstr)
def main(args):
size = int(args[0])
triangles = int(args[1])
maketri(size,triangles)
if __name__ == "__main__":
main(args)
10 PRINT " /\"
20 print "/\/\"
30 print "newfags cant triforce"
> autism
please make fun of me and degrade my lack of talent
void tfgen(int height) {
wchar_t t[2];
t[0] = 0x25B2;
t[1] = '\0';
int og_height = height;
int diff = height;
int half = 0;
while (height) {
for (int i = height; i-1; --i)
printf(" ");
printf("%ls", t);
for (int i = diff - height; i; --i) {
if (height half*2)) {
printf(" ");
} else {
printf("%ls", t);
}
}
if (height
Fucking kneel.
#include
#include
#include
#include
std::vector recursive_stack;
int triangular_num(int n)
{
return (pow(n, 2) + n) / 2;
}
// current level, minx, miny, maxx, maxy
void tri_recursion(int levels, int x1, int y1, int x2, int y2)
{
if (levels == 0) {
recursive_stack.at(triangular_num(y2-1) + x2-1) = true;
return;
}
// top, minx = minx, maxx = max /2, miny = miny, maxy = maxy/2
tri_recursion(levels - 1, x1,y1, (x2+x1) / 2, (y2+y1)/2);
// left, minx = minx, maxx = maxx/2, miny = maxy/2, maxy = maxy
tri_recursion(levels - 1, x1,(y1+y2)/2,(x2+x1)/2,y2);
// right, minx = maxx/2, maxx = maxx, miny = maxy/2, maxy = maxy
tri_recursion(levels - 1, (x2+x1)/2, (y1 + y2) / 2,x2,y2);
return;
}
int recursive_version(int argc, char** argv)
{
int tri_height = 5;// atoi(argv[1]);
int recursion_levels = 3;// atoi(argv[2]);
if (!(tri_height & 1))
tri_height++;
int solid_triangle_height = pow(2, recursion_levels);
int total_height = tri_height * solid_triangle_height;
// number of small solid triangles in entire pyramid
recursive_stack.resize(triangular_num(solid_triangle_height));
tri_recursion(recursion_levels, 1,1,solid_triangle_height, solid_triangle_height);
int half_width = tri_height;
int total_hwidth = half_width * solid_triangle_height;
std::string empty_buffer(half_width*2, ' ');
for (int i = 0; i < total_height; i++) {
int tri_count = (i % tri_height) * 2 + 1; // width in pyramid of solid triangles
int pyramids = i / tri_height + 1; // this gets what meta level we are on of pyramid
int stack_index = triangular_num(pyramids-1); // index into recursive stack,
std::string fulloffset(half_width * (solid_triangle_height - pyramids), ' ');
int m = half_width - (tri_count / 2 + 1);
...
last part
std::string buffer(m, ' ');
std::string tris(tri_count, 'A');
printf("%s", fulloffset.c_str());
for (int j = 0; j < pyramids; j++) {
if (recursive_stack[stack_index + j]) {
printf("%s%s%s ", buffer.c_str(), tris.c_str(), buffer.c_str());
}
else {
printf("%s", empty_buffer.c_str());
}
}
printf("\n");
}
return 0;
}
▲
▲▲▲
▲▲▲▲▲
▲▲▲▲▲▲▲
▲▲▲▲▲▲▲▲▲
▲▲▲▲▲▲▲▲▲▲▲
▲▲▲▲▲▲▲▲▲▲▲▲▲
▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲
▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲
▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲
▲ ▲
▲▲▲ ▲▲▲
▲▲▲▲▲ ▲▲▲▲▲
▲▲▲▲▲▲▲ ▲▲▲▲▲▲▲
▲▲▲▲▲▲▲▲▲ ▲▲▲▲▲▲▲▲▲
▲▲▲▲▲▲▲▲▲▲▲ ▲▲▲▲▲▲▲▲▲▲▲
▲▲▲▲▲▲▲▲▲▲▲▲▲ ▲▲▲▲▲▲▲▲▲▲▲▲▲
▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲ ▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲
▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲ ▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲
▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲ ▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲
autism speaks
in Haskell this is just
module Triforce where
import Data.List
main = getLine >>=
flatten . triforce . read
where
tri = ["*****"," *** "," * "]
triforce n = map res $ reverse [1..n]
where res x = map unwords $ transpose $ replicate x tri
flatten xs = mapM (\(i,m) -> mapM (\s -> print $ concat (replicate (3*i) " ") ++ s ++ "\n") m) zipper
where zipper = zip [0..(length xs - 1)] xs
I kneel
▲
▲ ▲
▲
▲▲
B0 13 CD 10 B3 03 BE A0 A0 8E DE B9 8B 0C 32 28 88 AC C2 FE 4E 75 F5 CD 16 87 C3 CD 10 C3
import java.util.ArrayList;
public class gay {
public static void main(String[] args) {
tf(5, 4);
}
public static void tf(int size, int numberOfLines){
int whereToStart = numberOfLines*size;
ArrayList ar;
for(int i=1;i
this is a fixed version of and yes, it is a "good morning, sir!" version.
I may be a streetsshitter but I can make it scale.
hi xah
▲
▲▲
I thought nbsps would work.
you have to enter a number 1-whatever as an argument for how many columns each triangle is (./triforce 3)
..▲
▲ ▲
This doesn't even have a main function lol
can Any Forums code this in HolyC too?
code it in x86 assembly.
see
if on a 64 bit system link with -m elf_i386
Starting with a minus gives... interesting results.
Very nice. Brainfuck is nice. I wonder if it is turing complete in the case of a finite tape (bf on Linux allocates 300,000 chars as memory by default, for instance).
:)
#include
#include
#include
void print_usage() {
printf("usage: triforce \n");
}
int main(int argc, char **argv) {
long triangle_height;
if (argc != 2) {
print_usage();
return 1;
}
triangle_height = strtol(argv[1], NULL, 10);
if (errno != 0) {
printf("Couldn't convert %s to a usable triangle height\n", argv[1]);
print_usage();
return 1;
}
for (long i = 1; i
no problem user here you go
#include
using namespace std;
void triforce(int h)
{
int var=1;
for (int i=0;i
Better than my solution for sure
▲
▲ ▲
>the gif is a fucking image
really nigga?
>there is a python library that focuses on memes
>newfags can't triforce
v.2 codegolfed even more
t,n=lambda s,i:[i+" "*(s-x)+"▲"*(x*2-1)+" "*(s-x-1)for x in range(1,s)],int(input())
print(*t(n+1," "*n)+[i*2 for i in t(n+1,"")],sep="\n")
a
Acute observation. GIF is indeed an image format.
[eqn]\;\blacktriangle\\
\blacktriangle\blacktriangle[/eqn]
#include "stdio.h"
#include "stdlib.h"
void render (char c, int l){
for (int i=0; i
>[eqn]\;\blacktriangle\\
>\blacktriangle\blacktriangle[/eqn]
what the fuck was this supposed to be?
>GIF is indeed an image format
I thought gif is a video format since it can store video element
...