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

on the wasting of time

Name: Anonymous 2012-11-02 8:38

An assignment is due tomorrow for my theoretical computer science class.

I have stayed up all night to work on it.

Rather than doing productive work I am spending my time writing a program in pic to format pretty trees.

Name: Anonymous 2012-11-02 8:41

grades mean nothing (unless you're retarded and failing them or are trying to continue on academia), working on practical projects still helps improve your intrinsic skills so it's okay. Though staying up is not recommended for obvious reasons.

Name: Anonymous 2012-11-02 8:44

>>2

I've made 90% on every assignment and midterm so far in this course, so I'm not worried about that.

Still, it's stupid to spend hours formatting a figure that would maybe lose me one percentage point if omitted.

Name: Anonymous 2012-11-02 9:47

Now I have something sort of tree-shaped, but I realised I have a problem -- I need to label my nodes, and I have no idea how to do that with the current design.

The language doesn't seem to support anything like lists or arrays, so I'm not sure how to do it with my top-down recursive method.

Earlier I tried the subtree(subtree(a,b), subtree(c,d)) approach, but since the language uses string substitution that became escaping hell once it got more than a level deep.

It would be far easier to just write a program in some other language that takes a tree as input and spits out the pic code to draw it.

LISP seems like it would be ideal, but I've never written a LISP program more complex than calculating the Fibonacci sequence.  AWK would be good too, but I'd have to implement array-based trees.  It's sort of looking like I'll do it in C!

Name: Anonymous 2012-11-02 10:09

Have you tried symta?

Name: Anonymous 2012-11-02 10:24

>>5
Kill yourself

Name: Anonymous 2012-11-02 10:34

>>4

I think I'll use AWK.  If some guy can write a LISP interpreter in it[1] I can surely make a shitty tree-to-picture compiler.

I already have it mostly reading a text file into an array tree; once I have that debugged it should be piss-easy to get it to walk the tree printing Circle16: circle "23"; line from Circle8 to Circle16;

>>5

I don't want to install a development environment to draw my stupid tree.  The choices are AWK, Emacs Lisp, and C.

Name: Anonymous 2012-11-02 10:35

>>7

I forgot to cite my sources:

[1]: http://dis.4chan.org/read/prog/1351779534/35

Name: Anonymous 2012-11-02 10:42

>>7

Yay!


$ cat treegen.awk
{
    for(i=1; i<=NF; ++i){
        tree[(2^(NR-1)) + i - 1] = $i;
    }
}

END {
    for(i=1; i<(2^NR); ++i){
        printf("%d ", tree[i]);
    }
}
$ cat test.tree
         1
    2           3
 4    5     6     7
8 9 10 11 12 13 14 15
$ awk -f treegen.awk test.tree
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Name: Anonymous 2012-11-02 10:47

>>9

Now I need it to accept underscores as blank nodes.

The output should be piss-easy.


END {
    for(i=1; i<(2^NR); ++i){
        if(tree[i] != -1){
            printf("Node%d: circle left %d \"%d\"\n", i, idk_lol, i);
            printf("line from Node%d to Node%d;\n", i, i/2);
        }
    }
}

Name: Anonymous 2012-11-02 13:25

My face when it works!

The trees are still a bit lopsided, but that's just a matter of better centering the root node.


function printarrow(from, to){
    printf("Arrow from Tree%s_%d to Tree%s_%d;\n",
       treeid, from, treeid, to);
}

function printtree(tree, treeid, nlines){
#    print treeid;
#    for(i=1; i<(2^nlines); ++i){
#    printf("%d ", tree[i]);
#    }
    for(i=0; i<nlines; ++i){
    printf("move left %d * 0.4;\n", 2^(i-1));
    for(j=2^i; j<2^(i+1); ++j){
        printf("Tree%s_%d: circle radius 0.1 \"%d\";\n", treeid, j, tree[j]);
        printf("move right 0.4;\n");
        if(int(j/2) != 0){
        printf("{line from Tree%s_%d.n to Tree%s_%d.s;}\n", treeid, j, treeid, int(j/2));
        }
#        printf("%d->%d ", tree[j], tree[int(j/2)]);
    }
    printf("move down 1;\n");
    }
}

BEGIN {
   
    treeprinted = 0;
    nlines = 0;
    printf(".PS\n");
}

/^Name:/ {
    treeid=$2
}
   
/^T/ {
    ++nlines;
    for(i=2; i<=NF; ++i){
    tree[(2^(nlines-1)) + i - 2] = $i;
    }
}

/^Rel:/ {
    if(!treeprinted){
    printtree(tree, treeid, nlines);
    treeprinted = 1;
    }

    printarrow($2, $3);
}

END {
    if(!treeprinted){
    printtree(tree, treeid, nlines);
    }
    printf(".PE\n");
}

Name: Anonymous 2012-11-02 13:27

>>11
My face when it works!
I really hope you're using that ironically.  Otherwise some faggot /anus/rider will rip you a new one.

Name: Anonymous 2012-11-02 13:30

>>11
My face
what the fuck?
/polecat kebabs/

Name: 12 2012-11-02 13:35

>>13
You must be the faggot.  Pleased to meet you fuck you in the ass.

Name: fatpig 2012-11-02 13:47

You guys want to see this live talk

"The future of C++", staring Herb Sutter
19:45 UTC on http://channel9.msdn.com/

Name: Anonymous 2012-11-02 13:51

>>15
live talk
Strike 1.

C++
Strike 2.

msdn
Strike 3, get the fuck out.

Name: Anonymous 2012-11-02 13:53

>>15
Gross.

Name: fatpig 2012-11-02 13:57

>>16
stfu cock sucker

This is about ISO C++ and the upcoming C++14. Herb Sutter is THE modern C++ hero and he works at microsoft, so of course that's hosted on channel9, you retard. You thought stroustrup was still relevant? Either retire or finish your studies, depending of your age, but you sure are not in the industry.

Name: Anonymous 2012-11-02 13:59

>>18
There is so much wrong with your post I don't even know where to begin.

Name: Anonymous 2012-11-02 13:59

>>18
in the industry

Name: Anonymous 2012-11-02 14:03

>>18
This is about ISO C++ and the upcoming C++14. Herb Sutter is THE modern C++ hero and he works at microsoft, so of course that's hosted on channel9, you retard.
I just puked a little a lot in my mouth.

Name: Anonymous 2012-11-02 14:04

>>19
http://isocpp.org/
See section "UPCOMING EVENTS". While I may be wrong, they surely are not when advising this talk. You are free to ignore it and suck cocks for the rest of your life.

>>20
you know what I mean

Name: Anonymous 2012-11-02 14:06

>>22
You are free to ignore it and suck cocks for the rest of your life.
I'd rather do that than code in C++.

Name: fatpig 2012-11-02 14:07

>>21
Please, this guy has been the secretary of the ISO C++ standards committee for over 10 years.

Name: Anonymous 2012-11-02 14:13

>>24
You really don't get it, do you?

Name: fatpig 2012-11-02 14:15

>>25
Now I get it. You guys are using awk but not c++. what the fuck.

Name: Anonymous 2012-11-02 14:18

C++
learn a real language!

Name: fatpig 2012-11-02 14:22

>>27
>implying all of the modern languages are not inspired from C++
>implying I use C++ for day to day programming

Name: Anonymous 2012-11-02 14:25

>>28
/le back to g/

Name: Anonymous 2012-11-02 14:31

>>24,26,28
fuck off back to reddit kikeshit

Name: fatpig 2012-11-02 14:40

>>30
Sure, could you give me an url for that shit?

Name: Anonymous 2012-11-02 14:43

Name: Anonymous 2012-11-02 14:47

>>31
define "shit"

Name: Anonymous 2012-11-02 14:49

>>33
C++.

Name: Anonymous 2012-11-02 14:59

>>34
C++ is not a valid symbol

Name: Anonymous 2012-11-02 15:14

>>33
undefine shit
C

Name: fatpig 2012-11-02 15:53

>>33
reddit

Name: Anonymous 2012-11-02 17:38

>>37
jesus fuck, stop trying to fit in so hard and fuck off back to /g/

Name: fatpig 2012-11-02 18:49

>>38
jesus fuck, shut the fuck up and let the thread die, elite textboard virgin

Name: Anonymous 2012-11-02 19:36

>>39
Are you seriously using ``virgin'' as an insult? Looks like you're using 下げる as an insult too.

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