¶ /prog/ Challenge Vol. A ¶ Code Golf ¶
1
Name:
Anonymous
2010-09-13 15:54
***************************************************
* - Implement aFibonacci Butt Sort. *
* http://dis.4chan.org/read/prog/1250478524/128 *
* - Don't forget the surroundingb and i tags! *
* -Spaces and newlines must be skipped. *
* - Do this inless bytes of code than the *
* previous poster. *
* - Any frequently-used language may be used.* *
***************************************************
*No one-character submissions in a self-made language that solves the problem in one byte.
2
Name:
Anonymous
2010-09-13 15:56
- Any frequently-used language may be used.
In other words, no Lisps are allowed.YHBT
3
Name:
egas
2010-09-13 15:59
egas
4
Name:
Anonymous
2010-09-13 15:59
>>2
In other words,
only lisps and MLs are allowed.
5
Name:
Anonymous
2010-09-13 16:01
Lisp-style: lisp
Scheme-style: lis?
6
Name:
Anonymous
2010-09-13 16:02
This should be easy to beat, but I'm lazy.
f [] = []
f s@(x:y) = '[':a:']':x:'[':'/':a:']':f y
where a = if odd $ length s then 'o' else 'u'
7
Name:
Anonymous
2010-09-13 16:04
>>6
Shit, forgot
[b] and
[i].
g x = "[b][i]" ++ f x ++ "[/i][/b]
8
Name:
Anonymous
2010-09-13 16:09
>>1 didn't read his
BBCode Spacing Monthly
9
Name:
Anonymous
2010-09-13 16:12
Spaces and newlines must be skipped.
Somebody needs to do whitespace.
10
Name:
Anonymous
2010-09-13 16:13
>>6
So is your language's evaluation.
11
Name:
Anonymous
2010-09-13 16:26
f l = b "b" . b "i" $ unwords $ zipWith ($) (cycle [b "u", b "o"]) (words l)
where b t x = concat ["[", t, "]", x, "[/", t, "]"]
f l = b "b" . b "i" $ unwords $ zipWith b (cycle ["u", "o"]) (words l)
where b t x = concat ["[", t, "]", x, "[/", t, "]"]
13
Name:
Anonymous
2010-09-13 16:41
In before Zarn 's Allegro submission.
14
Name:
Anonymous
2010-09-13 17:00
>>13
Very few of his submissions have actually used Allegro.
15
Name:
Anonymous
2010-09-13 17:33
Go fuck yourself, off.
16
Name:
Anonymous
2010-09-13 22:23
>>14
What has he submitted recently
into your ass ?
17
Name:
Anonymous
2010-09-14 0:48
function f(s){r="[b][i]",a=s.split("")
for(c in a){t=(c%2?"u":"o")
r+= "["+t+"]"+a[c]+"[/"+t+"]"}return r+"[/i][/b]";
}
18
Name:
Anonymous
2010-09-14 0:49
>>17
fuck, take out that extra space after
r+=
19
Name:
Anonymous
2010-09-14 5:37
ha-ha! readable python wins
def f(a):
b,c,i="[b][i]","ou",0
while i<len(a):b+="["+c[i%2]+"]"+a[i]+"[/"+c[i%2]+"]";i+=1
return b+"[/i][/b]"
Note: this is <TAB>, not 8 <SPACES>
20
Name:
Anonymous
2010-09-14 5:39
def f(a):
b,c,i="[b][i]","ou",0
while i<len(a):b+="[%s]%s[/%s]"%(c[i%2],a[i],c[i%2]);i+=1
return b+"[/i][/b]"
Fuck. It could be 1 byte shorter
21
Name:
Anonymous
2010-09-14 5:43
def f(a):
b,c,i="[b][i]","ou",0
while i<len(a):d=c[i%2];b+="[%s]%s[/%s]"%(d,a[i],d);i+=1
return b+"[/i][/b]"
double fuck. Yet another byte shorter.
22
Name:
Anonymous
2010-09-14 6:48
EXPERT RUBY
b=false
puts "[b][i]#{ARGV[0].gsub(/\w/){|m|t=b==true ?"o":"u";b=!b;"[#{t}]#{m}[/#{t}]"}}[/i][/b]"
23
Name:
PHP FAGGOT
2010-09-14 7:03
reporting in
function f($a){return "[b][i]".implode(array_map(function($a,$b){$_=$b%2==0?"u":"o";return "[$_]{$a}[/$_]";},str_split($a),range(1,strlen($a))))."[/i][/b]";}
24
Name:
Anonymous
2010-09-14 8:01
You people who skip spaces have no self-respect.
25
Name:
Anonymous
2010-09-14 9:16
>>22
M A S T E R R U B Y E X P E R T H E R E
First, kid, don't use booleans in initialization.
b=0
puts "[b][i]#{ARGV[0].gsub(/\w/){|m|t=b==1?"o":"u";b=1-b;"[#{t}]#{m}[/#{t}]"}}[/i][/b]"
Then don't use b==1. Use !!b.
b=0
puts "[b][i]#{ARGV[0].gsub(/\w/){|m|t=!!b ?"o":"u";b=!b;"[#{t}]#{m}[/#{t}]"}}[/i][/b]"
Then upgrade your ruby to 1.9 and return back to integers. Also space after puts is unnecessary.
b=0
puts"[b][i]#{ARGV[0].gsub(/\w/){|m|t="ou"[b];b=1-b;"[#{t}]#{m}[/#{t}]"}}[/i][/b]"
Then reread original problem. It doesn't require to /w/ can be upgraded to .
b=0
puts"[b][i]#{ARGV[0].gsub(/./){|m|t="ou"[b];b=1-b;"[#{t}]#{m}[/#{t}]"}}[/i][/b]"
26
Name:
Anonymous
2010-09-14 9:29
>>25
I am at the maximum level of ruby expertness to not be gay. You have crossed that threshold and are therefore a massive faggot. What is this "ou" business?
27
Name:
Anonymous
2010-09-14 10:51
64 bytes of GolfScript, doing the right thing on spaces and newlines.
http://gbelo.org/nooodl/golfsort.htm
Explanation included; code not posted here because non-matching square brackets mess up Shitchan. The space at the end of the first line is necessary.
28
Name:
Anonymous
2010-09-14 10:51
#include <ctype.h>
#include <stdio.h>
int a,b;int main(void){printf("[b][i]");while(a=getchar(),a>-1)if(isspace(a))putchar(a);else printf("[%c]%c[/%c]","uo"[b],a,"uo"[b]),b=!b;puts("[/i][/b]");}
29
Name:
Anonymous
2010-09-14 22:04
F B
R U
O T
S T
T E
E S
D
30
Name:
Anonymous
2010-09-14 22:31
data:text/html;base64,PGh0bWw+PGhlYWQ+PHN0eWxlPm97dGV4dC1kZWNvcmF0aW9uOm92ZXJsaW5lfTwvc3R5bGU+PHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiPmZ1bmN0aW9uICQoYil7cmV0dXJuIGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKGIpfXZhciBzPTA7ZnVuY3Rpb24gdyhiKXtyZXR1cm4ocz0hcyk/Ilt1XSIrYisiWy91XSI6IltvXSIrYisiWy9vXSJ9ZnVuY3Rpb24gYSgpe3M9MDt2YXIgYj0kKCJiIikudmFsdWUuc3BsaXQoIiIpO2ZvcihpPTA7aTxiLmxlbmd0aDtpKyspYltpXT0vXFMvLnRlc3QoYltpXSk/dyhiW2ldKTpiW2ldOyQoImJ1dHRzIikuaW5uZXJIVE1MPWIuam9pbigiIil9Ozwvc2NyaXB0PjwvaGVhZD48Ym9keT48Yj48aT48dT5GPC91PjxvPkk8L28+PHU+QjwvdT48bz5PPC9vPjx1Pk48L3U+PG8+QTwvbz48dT5DPC91PjxvPkM8L28+PHU+STwvdT4gPG8+Qjwvbz48dT5VPC91PjxvPlQ8L28+PHU+VDwvdT48bz5TPC9vPjx1Pk88L3U+PG8+Ujwvbz48dT5UPC91PjwvaT48L2I+PHAvPjx0ZXh0YXJlYSB2YWx1ZT0iRklCT05BQ0NJIEJVVFRTT1JUIiBpZD0iYiIgb25rZXl1cD0iYSgpIj48L3RleHRhcmVhPjxwLz48cHJlPltiXVtpXTxzcGFuIGlkPSJidXR0cyI+PC9zcGFuPlsvaV1bL2JdPC9wcmU+PC9ib2R5PjwvaHRtbD4=
31
Name:
Anonymous
2010-09-14 23:15
32
Name:
Anonymous
2010-09-15 2:01
>>31
h e y d o n ’ t l a u g h a t m e : (
33
Name:
Anonymous
2010-09-15 9:03
f=(++"[/b][/i]").("[b][i]"++).concat.zipWith($)(b<$>cycle"ou")
b t x='[':t:']':x:"[/"++t:"]"
34
Name:
Anonymous
2010-09-15 15:46
nothing to do with fibonacci
nothing to do with sorting
35
Name:
Anonymous
2010-09-15 15:47
>>34
Everything to do with butts.
36
Name:
Anonymous
2010-09-15 16:11
Here is an example of usage in a slightly customized dialect of Ruby that I am developing.
Ruby is frequently used for web design, so this satisfies the requirements.
puts "hello".fbs
37
Name:
Anonymous
2010-09-15 16:14
38
Name:
Anonymous
2010-09-15 17:04
fibonacciButtSort :: String -> String
fibonacciButtSort originalText = makeBold $ makeItalicized $ fibonacciButtSort' originalText True
where fibonacciButtSort' [] _ = []
fibonacciButtSort' (firstCharacter : remainingCharacters) True = makeUnderlined [firstCharacter] ++ fibonacciButtSort' remainingCharacters False
fibonacciButtSort' (firstCharacter : remainingCharacters) False = makeOverlined [firstCharacter] ++ fibonacciButtSort' remainingCharacters True
wrapInTags :: String -> String -> String
wrapInTags tag originalText = "[" ++ tag ++ "]" ++ originalText ++ "[/" ++ tag ++ "]"
makeBold :: String -> String
makeBold = wrapInTags "b"
makeItalicized :: String -> String
makeItalicized = wrapInTags "i"
makeOverlined :: String -> String
makeOverlined = wrapInTags "o"
makeUnderlined :: String -> String
makeUnderlined = wrapInTags "u"
What do I win?
39
Name:
Anonymous
2010-09-15 17:23
40
Name:
Anonymous
2010-09-15 18:53
++++++++++[->++++++++++<]>[->+>+>+>+>+>+>+<<<<<<<]<+++++++++
+[->+++++<]>[->>>>
>>- <<<<<<]>--------->-->+++++>+++++++++++>
+++++++++++++++++>--->------->>++++[-<++++++++>]<<<<<<<<.>>.
>>>>.<<<<<<.>.>>>>>.[<]<,[--------------------------------[>
]>[.>>>>.>>.<<<<<<<<++++++++++++++++++++++++++++++++.>>.>>>>
>.<.[->>>>>+<<<<<]<[->>>>>+<<<<<]>>>>>[-<<<<+>>>>]>[-<<<<<<+
>>>>>>]<<[<]<[-]]>>>>>>>>.[<]<,]>>.>>>>>.<<<<.>>>>>.<<<<<<.>
>>>>.<<<.>>>>.
Niggers!
41
Name:
Anonymous
2010-09-15 21:28
42
Name:
Anonymous
2010-09-15 22:03
43
Name:
Anonymous
2010-09-15 22:04
>>42
Yes, I would like some, thank you
44
Name:
Anonymous
2010-09-16 0:10
45
Name:
Anonymous
2010-09-16 0:24
>>42,44
man with non-traditional sexual orientation*
46
Name:
Anonymous
2010-09-16 2:55
>>45
Being a faggot is tradition in itself.
47
Name:
Anonymous
2010-09-17 23:24
>>38
Not enought
wrapInTagProvider s.
48
Name:
Anonymous
2010-09-27 2:02
data:text/html;base64,PHRleHRhcmVhIG9ua2V5dXA9J2phdmFzY3JpcHQ6cz0wO2I9dGhpcy
52YWx1ZS5zcGxpdCgiIik7Zm9yKGk9MDtpPGIubGVuZ3RoO2krKyliW2ldPS9cUy8udGVzdChiW2
ldKT8ocz0hcyk/Ilt1XSIrYltpXSsiWy91XSI6IltvXSIrYltpXSsiWy9vXSI6YltpXTt0aGlzLm
5leHRTaWJsaW5nLmNoaWxkcmVuWzBdLmlubmVySFRNTD1iLmpvaW4oIiIpJz5GSUJPTkFDQ0kgQl
VUVFNPUlQ8L3RleHRhcmVhPjxwcmU+W2JdW2ldPHNwYW4+PC9zcGFuPlsvaV1bL2JdPC9wcmU+