A Code-Golf challenge

A forum for topics that don't fit elsewhere. Introduce yourselves to other members of the forums, discuss how your name evolves when written out in the Game of Life, or just tell us how you found it. Forum rules still apply.
Post Reply
Hunting
Posts: 4401
Joined: September 11th, 2017, 2:54 am

A Code-Golf challenge

Post 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
+++++++[->++++++<],[<.>-]
Last edited by Hunting on January 20th, 2020, 12:58 pm, edited 3 times in total.
User avatar
testitemqlstudop
Posts: 1365
Joined: July 21st, 2016, 11:45 am
Location: in catagolue
Contact:

Re: A Code-Golf challenge

Post 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<<'*');}
Hunting
Posts: 4401
Joined: September 11th, 2017, 2:54 am

Re: A Code-Golf challenge

Post 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('*'));}
Last edited by Hunting on November 7th, 2019, 12:02 am, edited 1 time in total.
Naszvadi
Posts: 1477
Joined: May 7th, 2016, 8:53 am
Contact:

Re: A Code-Golf challenge

Post by Naszvadi »

My 2cents:
Enjoy it!

And for the post opener, an "Alert! Spoilers!" remark would be nice!
User avatar
Moosey
Posts: 4315
Joined: January 27th, 2019, 5:54 pm
Contact:

Code-Golf challenges

Post 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
κ is measurable iff there is a nontrivial elementary embedding j:V→M (M transitive) with critical point κ
User avatar
toroidalet
Posts: 1514
Joined: August 7th, 2016, 1:48 pm
Location: My computer
Contact:

Re: A Code-Golf challenge

Post by toroidalet »

Shorter solution in b****fuck for the original challenge:

Code: Select all

+++++++[->++++++<],[<.>-] or
++++++[->+++++++<],[<.>-]
Any sufficiently advanced software is indistinguishable from malice.
Post Reply