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:
Anonymous2012-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.
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:
Anonymous2012-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!
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;
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:
Anonymous2012-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");
}
}
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.
>>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:
Anonymous2012-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.
Update: I submitted an half-assed assignment with somewhat pretty trees. I doubt it will get much over 70%, but my average should stay over 90% so whatever.
I had four assignments and a midterm this week; I'm glad it's done!