Recurse Center, week 10

2024-03-08

A weekly log of my activity at the Recurse Center, a 12-week programming retreat.

Tags: rc

<< previousnext >>

Monday, March 4th

Following up on Impossible Stuff Day, I managed to call C from assembly, and vice versa! Enjoyed this visualisation of how ELF files are laid out. Leaving it there for now and returning to my other projects.

Chatted and paired with Amy, we used my L-system implementation to draw Sierspinski triangles and Koch curves. For the most part, it was as simple as copying the rules from Wikipedia, which is nice! I haven't tried coming up with my own L-systems yet.

A black sierspinski triangle (contains other triangles recursively nested inside it).
Sierspinski triangle!
A red koch curve on a white background. Basically a loopy piece of spaghetti that's vertically symmetric.
Koch curve!

Wrote a bunch more unit tests for the BitTorrent client. I've ALMOST finished writing unit tests, might actually finish this cursed project before the end of batch!

Enjoyed this article about the degeneration of social networks.

Tuesday, March 5th

Fun chat and pairing session with Hannah! We looked at the Book of Shaders, Chapter 9 (Patterns), which is about how to repeat patterns in a grid. This might be the final chapter I do while at RC, because I want to make time for music programming and other things. Anyway, here's our tic-tac-toe.

Tic-tac-toe grid. The background of each tile is a gradient from green to red. The tiles in the left column are white x's, the tiles in the other columns are white o's.
Tic-tac-toe!

And the code:

#ifdef GL_ES
precision mediump float;
#endif

#define PI 3.14159265359
uniform vec2 u_resolution;

float circle(in vec2 _st, in float _radius){
    vec2 l = _st-vec2(0.5);
    return 1.-smoothstep(_radius-(_radius*0.01),
                         _radius+(_radius*0.01),
                         dot(l,l)*4.0);
}

float doughnut(vec2 st, float radius, float w) {
    float c1 = circle(st, radius);
    return c1*(1.-circle(st,radius-w));
}

vec2 tile(vec2 st, float n) {
    return fract(st*n);
}

float rect(vec2 st, vec2 pos, vec2 dims) {
    vec2 result = step(vec2(0.), st-pos) * step(vec2(0.), pos+dims-st);
    return result.x*result.y;
}

mat2 rotate2d(float _angle){
    return mat2(cos(_angle),-sin(_angle),
                sin(_angle),cos(_angle));
}

float cross(vec2 st, float w, float l) {
    st -= vec2(0.5);
    st = rotate2d( PI/4. ) * st;
    st += vec2(0.5);
    return 1.-
        (1.-rect(st, vec2(.5-l/2.,.5-w/2.), vec2(l,w)))
        * (1.-rect(st, vec2(.5-w/2.,.5-l/2.), vec2(w,l)));

}

void main() {
    vec2 st = gl_FragCoord.xy/u_resolution;
    vec3 color;

    vec2 coords = floor(3.*st);
    st = tile(st, 3.);

    float pct;
    if (coords.x > 0.01) {
        pct = doughnut(st, .3, .1);
    } else {
        pct = cross(st,0.1,.5);
    }
    color = (1.-pct)*vec3(st,0.0) + pct*vec3(circle(st,0.5));
    gl_FragColor = vec4(color,1.0);
}

FINISHED writing unit tests for the BitTorrent client! After I fix the 2 bugs I'm aware of, I'm hoping that everything will Just Work.

Enjoyed this blog post by Hillel Wayne about why most languages don't have first-class support for graphs, and this interview from the Corecursive podcast with an array programming enthusiast.

Wednesday, March 6th

Spent most of the day testing the BitTorrent client and squashing bugs. Now running 2 copies of the client, they're sending chunks of data to each other, but the chunks seem to be getting silently dropped somewhere. Need to figure out why!

Paired with Jake on more assembly-C stuff. We managed to pass an argument from C to my assembly implementation of FizzBuzz! An unexpected benefit of doing all this is that C compiler output seems less mysterious now.

Thursday, March 7th

Took it easy today and spent a few hours messing with my Emacs configuration. A summary of changes:

  1. Start in fullscreen mode with vertically split windows.
  2. Follow symbolic links by default.
  3. Fuzzy completion when typing Emacs commands, this is AMAZING.
  4. transpose-frame package for changing window layout
  5. That pairs well with the built-in command, window-swap-states, for swapping buffers between windows.
  6. Fixed syntax highlighting in my Lisp REPL.
  7. Played around with company code completion config.
  8. Explored dired and other packages for viewing/manipulating the file system.

Some day I'll get around to sharing my config file.

Friday, March 8th

A day off.


<< previousnext >>

I'd be happy to hear from you at galligankevinp@gmail.com.