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

Pages: 1-4041-

¶ /prog/ Challenge Vol. A ¶ Code Golf ¶

Name: Anonymous 2010-09-13 15:54

***************************************************
* - Implement a
Fibonacci Butt Sort.              *
*   http://dis.4chan.org/read/prog/1250478524/128 *
* - Don't forget the surrounding
b and i tags!    *
* -
Spaces and newlines must be skipped.          *
* - Do this in
less 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.

Name: Anonymous 2010-09-13 15:56

- Any frequently-used language may be used.
In other words, no Lisps are allowed.YHBT

Name: egas 2010-09-13 15:59

egas

Name: Anonymous 2010-09-13 15:59

>>2
In other words, only lisps and MLs are allowed.

Name: Anonymous 2010-09-13 16:01

Lisp-style: lisp
Scheme-style: lis?

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'

Name: Anonymous 2010-09-13 16:04

>>6
Shit, forgot [b] and [i].

g x = "[b][i]" ++ f x ++ "[/i][/b]

Name: Anonymous 2010-09-13 16:09

>>1 didn't read his BBCode Spacing Monthly

Name: Anonymous 2010-09-13 16:12

Spaces and newlines must be skipped.
Somebody needs to do whitespace.

Name: Anonymous 2010-09-13 16:13

>>6
So is your language's evaluation.

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, "]"]

Name: second thoughts 2010-09-13 16:30

f l = b "b" . b "i" $ unwords $ zipWith b (cycle ["u", "o"]) (words l)
    where b t x = concat ["[", t, "]", x, "[/", t, "]"]

Name: Anonymous 2010-09-13 16:41

In before Zarn's Allegro submission.

Name: Anonymous 2010-09-13 17:00

>>13
Very few of his submissions have actually used Allegro.

Name: Anonymous 2010-09-13 17:33

Go fuck yourself, off.

Name: Anonymous 2010-09-13 22:23

>>14
What has he submitted recently into your ass?

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]";
}

Name: Anonymous 2010-09-14 0:49

>>17
fuck, take out that extra space after r+=

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>

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

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.

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]"

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]";}

Name: Anonymous 2010-09-14 8:01

You people who skip spaces have no self-respect.

Name: Anonymous 2010-09-14 9:16

>>22
MASTER RUBY EXPERT HERE

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]"

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?

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.

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]");}

Name: Anonymous 2010-09-14 22:04

F  B
 R  U
  O  T
   S  T
    T  E
     E  S
      D

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=

Name: Anonymous 2010-09-14 23:15

>>30
haha oh wow

Name: Anonymous 2010-09-15 2:01

>>31
hey dont laugh at me :(

Name: Anonymous 2010-09-15 9:03

f=(++"[/b][/i]").("[b][i]"++).concat.zipWith($)(b<$>cycle"ou")
b t x='[':t:']':x:"[/"++t:"]"

Name: Anonymous 2010-09-15 15:46

nothing to do with fibonacci
nothing to do with sorting

Name: Anonymous 2010-09-15 15:47

>>34
Everything to do with butts.

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

Name: Anonymous 2010-09-15 16:14

>>36
faggot

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?

Name: Anonymous 2010-09-15 17:23

>>38
A new high score!

Name: Anonymous 2010-09-15 18:53

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

Niggers!

Name: Anonymous 2010-09-15 21:28

>>40
African Americans*

Name: Anonymous 2010-09-15 22:03

>>41
faggot

Name: Anonymous 2010-09-15 22:04

>>42
Yes, I would like some, thank you

Name: Anonymous 2010-09-16 0:10

>>42
homosexual*

Name: Anonymous 2010-09-16 0:24

>>42,44
man with non-traditional sexual orientation*

Name: Anonymous 2010-09-16 2:55

>>45
Being a faggot is tradition in itself.

Name: Anonymous 2010-09-17 23:24

>>38
Not enought wrapInTagProviders.

Name: Anonymous 2010-09-27 2:02

data:text/html;base64,PHRleHRhcmVhIG9ua2V5dXA9J2phdmFzY3JpcHQ6cz0wO2I9dGhpcy
52YWx1ZS5zcGxpdCgiIik7Zm9yKGk9MDtpPGIubGVuZ3RoO2krKyliW2ldPS9cUy8udGVzdChiW2
ldKT8ocz0hcyk/Ilt1XSIrYltpXSsiWy91XSI6IltvXSIrYltpXSsiWy9vXSI6YltpXTt0aGlzLm
5leHRTaWJsaW5nLmNoaWxkcmVuWzBdLmlubmVySFRNTD1iLmpvaW4oIiIpJz5GSUJPTkFDQ0kgQl
VUVFNPUlQ8L3RleHRhcmVhPjxwcmU+W2JdW2ldPHNwYW4+PC9zcGFuPlsvaV1bL2JdPC9wcmU+

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