fn printDefault(c: u8) void {
    std.debug.print("{c}", .{ c }); 
}

fn animate(buffer: *[]u8, rows: u32, cols: u32, comptime print_fn: fn(u8) void) void {
  for(0..rows) |dy| {
      for(0..cols) |dx| {
          const idx = dy * cols + dx;
          const pipe_tile = buffer.*[idx];
          std.debug.print("\x1B[{d};{d}H", .{ dy, dx });
          print_fn(pipe_tile);
      }
  }
  std.time.sleep(1000 * 1000 * 16);
}