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

Fibonacci Butt Sort

Name: Anonymous 2009-08-16 23:08

Let us discuss the various implementations of theFIBONACCI BUTT SORT.

Name: Anonymous 2009-08-17 19:55

>>40
DICK TOWER is superior

Name: Anonymous 2009-08-17 20:21

>>41
NO ITS NOT!

A Dick Tower has a growth complexity of N, whereas a Binary Dicks Tree has an average growth complexity of only log(N).

Name: Anonymous 2009-08-17 20:23

Hello, /prog/, How are you this fine, fine evening? I'll just leave this here...



import java.io.IOException;
import java.util.*;

class Tag
{
    private static Random generator = new Random(new Date().getTime());
    private static Tag[] tags = new Tag[]
    {
        new Tag("b"), new Tag("i"), new Tag("u"), new Tag("o"),
    };

    private String name;

    static Tag getRandomTag()
    {
        return tags[generator.nextInt(tags.length)];
    }

    private Tag(String name)
    {
        this.name = name;
    }

    public String getOpenForm()
    {
        return "[" + name + "]";
    }

    public String getClosedForm()
    {
        return "[/" + name + "]";
    }
}

public class Progifier
{
    public static void main(String[] args) throws IOException
    {
        Stack<Tag> tags = new Stack<Tag>();
        Random generator = new Random(new Date().getTime());

        while(System.in.available() > 0)
        {
            int b = System.in.read();

            if(generator.nextInt(10) == 0)
                System.out.print(tags.push(Tag.getRandomTag()).getOpenForm());

            System.out.write(b);

            if(generator.nextInt(50) == 0 && !tags.empty())
                System.out.print(tags.pop().getClosedForm());
        }

        while(!tags.empty())
            System.out.print(tags.pop().getClosedForm());
    }
}

Name: Anonymous 2009-08-17 20:29

>>43
Finally, something useful written in Java It's still too verbose

Name: Xarn 2009-08-17 20:29

>>42
If I enter 100 into my ENTERPRISE DICKS MACHINE I want 100 delicious dicks to come out, not 2.

Name: Anonymous 2009-08-17 20:32

>>43
Ne[i]w and imp[u]roved[o] [code]wit[o]h more[spoiler] tags![m]
[/m][/spoiler][/o][/code][/o][/u][/i]

diff
[m]
9a10
        new Tag("spoiler"), new Tag("m"), new Tag("code")
[/m]

Name: Anonymous 2009-08-17 21:15

Gentlemen, have you heard of the magical spirit conjuring technology called a METACIRCULAR BOOBULATOR ?

Name: Anonymous 2009-08-17 22:07

>>47
The Pleasure of being Metacircularly Boobulated inside.

Name: Anonymous 2009-08-18 0:11

>>48
i came

Name: Anonymous 2009-08-18 0:11

>>48
i came

Name: Anonymous 2009-08-18 4:34

Ne[i]w and imp[u]roved[o] [code]wit[o]h more[spoiler] tags![m]
[/m][/spoiler][/o][/code][/o][/u][/i]

Name: Anonymous 2009-08-18 4:51

GENTLEMEN

Name: Anonymous 2009-08-18 13:01

>>1
Is it Butt Sort or Buttsort?

Name: Anonymous 2009-08-18 13:04

BUTTSORT

Name: Anonymous 2009-08-18 15:31

FIBONACCI BUTT SORT

Name: Anonymous 2009-08-18 17:24

>>53
You're confusing it with a buttburst.

Name: Anonymous 2009-08-19 3:56

?>>56

Name: Anonymous 2009-08-19 4:32

>>56
You're confusing sage with age.

Name: Anonymous 2009-08-19 4:47

>>58
Fuck you, dipshit.

Name: Anonymous 2009-08-23 22:23

jjjj

Name: Anonymous 2009-08-24 12:12

Anybody have the source code for a buttsorter yet?

Name: Anonymous 2009-08-24 12:32

Name: /prog/ announcer 2009-08-24 12:46

>>61
Please read the threads before contributing, thank you.

Name: Anonymous 2009-08-24 14:24

>>63
Sorry about that, I finally found the "Read entire thread" link. I thought the old posts were gone or something.

Name: Haxus the Buttsorter 2009-08-24 14:37

Haxus the Buttsorter

Name: Anonymous 2009-08-24 18:30

>>65
i approve

Name: Anonymous 2009-08-25 3:48

Guize I have written an implementation in C with UNICODE support.
[m][b][i]#include <stdio.h>
#include <wchar.h>
#include <string.h>
#include <locale.h>
#include <errno.h>

FILE* fffffffibonacci_butt_sort(FILE *s, size_t n)
{
    size_t i = 0;
    wint_t tags[] = {L'u', L'o'};
    wint_t c = WEOF;
   
    for(i = 0; i < n; ++i)
    {
        if((c = fgetwc(s)) == L'[u][/u]n')
        {
            fputwc(L'[u][/u]n', stdout);
            return s;
        }
        else if(iswspace(c))
        {
            fputwc(c, stdout);
        }
        else if(c != WEOF)
        {
            wprintf(L"[%lc]%lc[/%lc]", tags[(i%2)], c, tags[(i%2)]);
        }
        else
        {
            return NULL;
        }
    }
    return s;
}

int main()
{
    if(!setlocale(LC_CTYPE, NULL))
    {
        fwprintf(stderr, L"Warning: Locale not specified.[o][/o]n");
    }

    const size_t BUFFA_SIZE = 4096;
    wint_t c = WEOF;

    fputws(L"[b][i]", stdout);

    while((c = fgetwc(stdin)) != WEOF)
    {
        if(ungetwc(c, stdin) == WEOF)
        {
            fputws(L"Failed to ungetwc<span class="o">.[u][/u]n", stderr);
            break;
        }

        if(!fffffffibonacci_butt_sort(stdin, BUFFA_SIZE))
        {
            break;
        }
    }

    fputws(L"[/i][/b<span class="o">][u][/u]n", stdout);

    if(ferror(stdin))
    {
        perror(strerror(errno));
        fputws(L"Input error occured. Output probably corrupted."
                "Shit fucking sucks.[u][/u]n", stderr);
    }

    return 0;
}
[/i][/b][/m]


[code]#include <stdio.h>
#include <wchar.h>
#include <string.h>
#include <locale.h>
#include <errno.h>

FILE* fffffffibonacci_butt_sort(FILE *s, size_t n)
{
    size_t i = 0;
    wint_t tags[] = {L'u', L'o'};
    wint_t c = WEOF;
   
    for(i = 0; i < n; ++i)
    {
        if((c = fgetwc(s)) == L'\n')
        {
            fputwc(L'\n', stdout);
            return s;
        }
        else if(iswspace(c))
        {
            fputwc(c, stdout);
        }
        else if(c != WEOF)
        {
            wprintf(L"[%lc]%lc[/%lc]", tags[(i%2)], c, tags[(i%2)]);
        }
        else
        {
            return NULL;
        }
    }
    return s;
}

int main()
{
    if(!setlocale(LC_CTYPE, NULL))
    {
        fwprintf(stderr, L"Warning: Locale not specified.\n");
    }

    const size_t BUFFA_SIZE = 4096;
    wint_t c = WEOF;

    fputws(L"[b][i]", stdout);

    while((c = fgetwc(stdin)) != WEOF)
    {
        if(ungetwc(c, stdin) == WEOF)
        {
            fputws(L"Failed to ungetwc.\n", stderr);
            break;
        }

        if(!fffffffibonacci_butt_sort(stdin, BUFFA_SIZE))
        {
            break;
        }
    }

    fputws(L"[/i][/b]\n", stdout);

    if(ferror(stdin))
    {
        perror(strerror(errno));
        fputws(L"Input error occured. Output probably corrupted."
                "Shit fucking sucks.\n", stderr);
    }

    return 0;
}[/code]

Here's an example for UTF-8 input:
[spoiler]Invalid or incomplete multibyte or wide character: Invalid or incomplete multibyte or wide character[/spoiler]

Name: Anonymous 2009-08-25 3:52

>>67
buttsort win

Name: Anonymous 2009-08-25 4:15

>>67
BBCode corruption? Lesse why did it fail.

FIBONACCI BUTT SORT

Name: Anonymous 2009-08-25 4:17

>>69
Looks like Shii-chan doesn't like Standard See in BBCode as in >>67 . :(

Name: Anonymous 2009-08-30 2:59

Bootstrapping my Directed Acyclic Buttsorter.

Here we go!

[b][i] import java.util.StringTokenizer; import javax.swing.JOptionPane; public class starter { public static void main(String args[]) { StringTokenizer st = new StringTokenizer(" "); String input = ""; String output = [u]"[b][i]";[/u] String next; int i = 1; input = JOptionPane.showInputDialog("Enter Text"); try { st = new StringTokenizer(input); } catch(Exception e) { } while(st.hasMoreTokens()) { i = i * -1; next = st.nextToken(); if(i > 0) { next = "" + next + ""; } else { next = [u]"[o]"[/u] + next + "[/o]"; } output = output + " " + next; } output = output + "[/i][/b]"; System.out.println(output); JOptionPane.showInputDialog( null, "Enjoy your buttsort", "Buttsorter", JOptionPane.PLAIN_MESSAGE, null, null, output); } }[/i][/b]

Name: Anonymous 2009-08-30 3:12

What would the Sussman think about FBS?

Name: Anonymous 2009-08-30 4:57

Sometimes I wonder if The Sussman is actually tsundere for /prog/ and whenever I read a weird thread, I imagine him reading it and wincing and wondering what the fuck is this.

Name: Anonymous 2009-08-30 6:27

I am 12 Sussmans old and what is this

Name: Anonymous 2009-08-30 6:42

>>74

[u][o][i]Back to /b/, please.[/i][/o][/u]

Name: Anonymous 2009-08-30 10:10



    FIBONACCI BUTT SORT

Name: Anonymous 2009-08-30 12:10

>>76
My FIBONACCI BUTT hurts :(

Name: Anonymous 2009-08-30 13:15

>>77
FIBONACCI BUTTHERTZ

Name: Anonymous 2009-08-30 13:50

>>78
The official SI unit for FIBONACCI BUTTSORT

Name: Anonymous 2009-08-30 14:44

>>79

The background level is 50Hz. This value must be subtracted from all readings to estimate the real one.

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