Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

"blind" programming [challenge]

Name: Anonymous 2015-04-29 23:33

Here's a stupid idea.

You know things like "print this pattern:

*
***
*****
*******
*********


can be done wiht any dumb challenges like this..

try to solve it by writing the program into this thread - NO TESTING! Then try it out.

Name: Anonymous 2015-05-01 16:50

>>40
["%s%s" % ('*'*x, '\n') for x in xrange(1,10,2)] is a list comprehension (http://www.secnetix.de/olli/Python/list_comprehensions.hawk) which gives a list of ["*\n", "***\n" "*****\n" .. ] etc.

https://docs.python.org/2/library/functions.html#reduce
http://www.secnetix.de/olli/Python/lambda_functions.hawk

Name: Anonymous 2015-05-01 21:14

#!/bin/sh
STRING="*";
ITERATION=0;
while [ 5 -ge "$ITERATION"]; do
echo "$STRING";
STRING="$STRING**";
((ITERATION++));
done;


NO EXCEPTIONS

Name: Anonymous 2015-05-01 21:16

#!/bin/sh
STRING="*";
ITERATION=0;
while [ 5 -gt "$ITERATION" ]; do
echo "$STRING";
STRING="$STRING**";
((ITERATION++));
done;

Name: Anonymous 2015-05-02 18:51

//pyramid.c
#include "void.h"
//https://gist.github.com/FrozenVoid/87e6ad6212ac9ce496e0
#define pyrpr(w,l) sm s4 stars=(l<<1) + 1,spaces = (w - stars)>>1;\
if(stars <= w){\
while(spaces--)putchar(' ');\
while(stars--)putchar('*');\
putchar('\n');} em
#define pyr(w,l) ({for(s4 lev=l;lev<w;lev++)pyrpr(w,lev);})
STDSTART //default 80 max base stars
s4 basew=(argc>1?atol(argv[1]):80);
pyr(basew,0);
STDEND

Name: Anonymous 2015-05-02 22:57

Ruby pyramid
10.times { |n| puts " "*(10-n)+"*"*n if (n%2).odd? }

Name: Anonymous 2015-05-02 22:59

whoops, fixed!
10.times { |n| puts " "*((10-n)/2)+"*"*n if (n%2).odd? }

Name: Anonymous 2015-05-02 23:29

>>35-37
return (fclose(stdout) < 0);
Is this actually him or is it someone making fun of him?

Name: Anonymous 2015-05-03 4:08

>>46
//pyramid2.c
#include "void.h"
//https://gist.github.com/FrozenVoid/87e6ad6212ac9ce496e0
#define pyr(w) ({ c1 star[w],space[w];\
fill(star,'*');fill(space,' ');\
s4 stars=0,spaces=w>>1;\
for(s4 lev=0;stars<=w;\
stars=(lev<<1)+1,spaces=(w-stars)>>1,lev++)\
printf("%.*s%.*s\n",spaces,space,stars,star);})
STDSTART //default 80 max base stars
pyr((argc>1?atol(argv[1]):80));
STDEND

Name: Anonymous 2015-05-03 14:07

++++[>++++++++++>++<<-]>++>++<.>.<<+++[>.<-]>>.<<+++++[>.<-]>>.<<+++++++[>.<-]>>.<<+++++++++[>.<-]>>.

Name: Anonymous 2015-05-03 15:18

>>49
did you fuck write that without testing

Name: Anonymous 2015-05-03 18:49

51
Some people think in brainfuck.

Name: Anonymous 2015-05-03 20:28

>>49
.<

Name: Anonymous 2015-05-03 22:01

>>50

yay

Name: Anonymous 2016-10-24 14:16

#include <stdio.h>

void printstars(int n) {
while(n--) putchar('*');
putchar('\n');
}

int main(void) {
int lines, i=0, width;
printf("How many lines to print?"); scanf("%d", &lines);
while(i < lines) {
width = 1 + ((i+1) * 2);
printstars(width);
i++;
}
return 0;
}

Name: Anonymous 2016-10-24 14:48

//Compile Time Optimization
#pragma message "\n"\
" *\n"\
" *** \n"\
" ***** \n"\
" ******* \n"\
" ********* \n"\
" *********** \n"\
" ************* \n"\
int main(){}

Name: Anonymous 2016-10-24 15:26

Name: Anonymous 2016-10-24 21:05

main = putStrLn $ foldr (++"\n"++) "" $ map show $ take 5 $ iterate (\x -> "*"++x++"*") "*"

Name: Anonymous 2016-10-24 21:08

Fuck, I failed.

main = putStrLn $ foldr (\x y -> x++"\n"++y) "" $ take 5 $ iterate (\x -> "*" ++ x ++ "*") "*"

Name: Anonymous 2016-10-25 1:32

(use srfi-1)
(define (genstars x)
(append (make-list (/ 2 (- 9 x)) " ")
(make-list x "*"))

(define (prnstars)
(map (lambda (x)
(map (lambda (c)
(display c))
(genstars x))
(newline))
(iota 5 1 2)))

Name: Anonymous 2016-10-25 3:28

5.times do |i|
puts "#{' ' * (4 - i)}#{?* * ((i * 2) + 1)}"
end

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List