Page 1 of 1

A Code-Golf challenge

Posted: July 18th, 2019, 9:04 am
by Hunting
Input: Inputn Integer N
Output: Prints the character *(ASCII42) N times
Here are my current candidates:

Code: Select all

Python 2, 16 characters
print"*"*input()
Charcoal, 3 characters
×*N
or
FN*
Befunge, 18 characters
&>"*",v
 |:-1<<
 @
GolfScript, 5 characters
~"*"*
Mathematica, 19 characters by AlephAlpha
StringRepeat["*",n]
05AB1E, 6 characters
I"*"2Λ
Pyth, 4 characters
*Q"*
brainfuck, 25 characters by toroidalet
+++++++[->++++++<],[<.>-]

Re: A Code-Golf challenge

Posted: July 18th, 2019, 9:17 am
by testitemqlstudop
Brainfuck + number input (not ASCII input)

Code: Select all

++++++++++++++++++++++++++++++++++++++++++>,[<.>-]
C++ (lousy golfing, yeh yeh)

Code: Select all

#include <iostream>
int main(){int i;std::cin>>i;for(;i;i--,std::cout<<'*');}

Re: A Code-Golf challenge

Posted: July 18th, 2019, 10:11 am
by Hunting
testitemqlstudop wrote:Brainfuck + number input (not ASCII input)

Code: Select all

++++++++++++++++++++++++++++++++++++++++++>,[<.>-]
C++ (lousy golfing, yeh yeh)

Code: Select all

#include <iostream>
int main(){int i;std::cin>>i;for(;i;i--,std::cout<<'*');}
Brainfuck: Neat.
C++: Easily reduced

Code: Select all

#include <iostream>
main(){int i;std::cin>>i;for(;i;i--,putchar('*'));}

Re: A Code-Golf challenge

Posted: July 18th, 2019, 11:07 am
by Naszvadi
My 2cents:
Enjoy it!

And for the post opener, an "Alert! Spoilers!" remark would be nice!

Code-Golf challenges

Posted: November 6th, 2019, 6:11 pm
by Moosey
X-post bf tetrational growth w/respect to input:
,[>>++[[[>]+[<]>-]>[>]<<[->[-<++>]<<]]>[<+>-]<<<-]
To iterate, simply add [>>++ after the , and >>[<<+>>-]<<<<-] after everything:
Pentational:
,[>>++[>>++[[[>]+[<]>-]>[>]<<[->[-<++>]<<]]>[<+>-]<<<-]>>[<<+>>-]<<<<-]

Note: the RLEs here are probably more right than what I have here, point out any errors in what I have here.

Challenge: write a BF knuth-arrow evaluator

Re: A Code-Golf challenge

Posted: November 24th, 2019, 2:47 pm
by toroidalet
Shorter solution in b****fuck for the original challenge:

Code: Select all

+++++++[->++++++<],[<.>-] or
++++++[->+++++++<],[<.>-]