Better HN
topnewbestaskshowjobs
Log inSign up

superdisk

1,626 karma · joined Jun 7, 2018 (8y ago) · 350 submissions

https://nickfa.ro
Submissions

comment 3y ago · link · parent

There's a mismatch between GBT Player and the GB hardware due to what can be expressed in the .mod format, meaning GBT is only capable of really beepy sounds (unless you're super good). hUGE gives more control over the hardware since it was made for it (and you can losslessly import GBT .mods). Ultimately though you can use whatever works for you, there are other drivers out there as well.

comment 3y ago · link · parent

I built the initial version in late 2019 and have been maintaining it since. It's used by GB Studio which is what this game was made with.

https://nickfa.ro/index.php/HUGETracker

comment 3y ago · link · parent

I wrote the music engine they used in this game... never thought I'd see the day haha :)

comment 3y ago · link · parent

I know the name is supposed to invoke "iceberg" but my brain thinks "fatberg" every time.

comment 3y ago · link · parent

I did something very similar quite recently with an old Mustek DV3000 camera that had webcam functionality. I was shocked to find out that Linux actually supports it out of the box. The quality is trash so it's not really usable, but fun messing around with it nonetheless.

comment 3y ago · link · parent

Here's an implementation using Peano numbers as you mentioned which seems to work the same as the CLP(FD) one for me.

  rle2([], []).
  rle2([H],[[H, add1(zero)]]).
  rle2([H | T], [[H, CountPlus1] | More]) :-
      Count = add1(_),
      CountPlus1 = add1(Count),
      rle2(T, [[H, Count] | More]).
  rle2([H | T], [[H, add1(zero)], [Element, Count] | More]) :-
      Count = add1(_),
      dif(Element, H),
      rle2(T, [[Element, Count] | More]).

  ?- rle2([1,1,1,2,2,3],X), rle2(Y,X).
  X = [[1, add1(add1(add1(zero)))], [2, add1(add1(zero))], [3, add1(zero)]],
  Y = [1, 1, 1, 2, 2, 3] ;
  false.
It even works in the completely general case:

  ?- rle2(X,Y).
  X = Y, Y = [] ;
  X = [_A],
  Y = [[_A, add1(zero)]] ;
  X = [_A, _A],
  Y = [[_A, add1(add1(zero))]] .
As I understand it, Prolog itself is CLP(H), that is CLP over the Herbrand terms (that is, atoms and functors and stuff). CLP(FD) just extends the capability with numbers (FD = finite domains). Although I do sort of understand how you'd consider it not "pure" Prolog, I don't see it as that different especially with things like `dif/2` in Prolog which is a constraint just like any other.

comment 3y ago · link · parent

If you're not trying to make your programs as close to logic as possible (that is, support as many modes as possible and make it so you can model your program as a logical expression) then what's even the point of using Prolog? Settling for having to reimplement the same logic in multiple directions completely defeats the purpose, you're just writing imperative code at that point.

I think "pragmatic therefore non-logical" versus "ivory tower therefore useless" is a false dichotomy. In my experience it's nearly impossible to make green cuts, and once you know a few tricks and rules of thumb, you can get pretty far writing logical code.

comment 3y ago · link · parent

Well said. Although there are a few things Prolog excels at, grammars are one of which. DCGs are one of my favorite things about any language ever and I miss them everywhere else.

comment 3y ago · link · parent

The thing about the cut is that it makes debugging extremely difficult because it (nearly always) completely nullifies the usual semantics of how you expect predicates to work. Stuff will seem to work and then break in mysterious ways. Also I've personally never found a valid use for them, there always seems to be a better, more logical alternative for any potential use case I've found.

It's kind of unfortunate IMO that most oldskool Prolog code out there is peppered with cuts and (->)/2 since it propagates a ton of bad habits.

Regarding the RLE problem, I posted a logical solution without cuts: https://news.ycombinator.com/item?id=35632344

comment 3y ago · link · parent

  :- use_module(library(clpfd)).

  rle([], []).
  rle([H],[[H, 1]]).
  rle([H | T], [[H, CountPlus1] | More]) :-
      Count #> 0,
      CountPlus1 #= Count+1,
      rle(T, [[H, Count] | More]).
  rle([H | T], [[H, 1], [Element, Count] | More]) :-
      Count #> 0,
      dif(Element, H),
      rle(T, [[Element, Count] | More]).
Even though I'm the one who was making the execution model complaint, this implementation seems to work for me.

  ?- rle([1,1,1,2,3,1,1],X), rle(Y, X).
  X = [[1, 3], [2, 1], [3, 1], [1, 2]],
  Y = [1, 1, 1, 2, 3, 1, 1] ;
  false.

comment 3y ago · link · parent

I think Prolog's main problem is that it presents the idea of "just declare the constraints and it will find the solution," but can't really live up to that. In reality it's an extremely leaky abstraction, and even with pure predicates you need to take its execution model into account to avoid getting stuck in an infinite loop.

I still love the language, but I think there's a point where every learner realizes it's not as beautiful and ideal as they once thought.

comment 3y ago · link · parent

Tell us more. What were you using before GNU?

comment 3y ago · link · parent

He pokes fun at this type of comment in chapter 1.

comment 3y ago · link · parent

In one case I tried using it to help me find the right functions in `oauthlib` that can validate a two-legged OAuth 1.0 signed message. It couldn't really get it and made up information about how OAuth works, but it did get me on the right track so I'm thankful in that regard.

I've also been using it while writing Common Lisp, and I'm not sure if it's just because it's a more obscure language, but it commonly produces nonsensical code, recommends functions that don't exist or work differently than it thinks they do, or produces non-idiomatic weird stuff.

It also falls apart when writing z80 assembly, again just generating nonsense. It really is a cool tool though, and I use it to get me steered in the correct direction. I've seen other people mention that it can identify unknown unknowns, and I concur it's an amazing tool for that. We'll see if with more specialized training on programming-related datasets if it can get better, I wouldn't write off the possibility. It won't be stealing your job in its current state, though.

comment 3y ago · link · parent

I think the current state of GPT-4 is overhyped when it comes to programming. It's novel and useful for steering you in the right direction and can reproduce simple hello-world like examples (even Pong and other common programs) but in my experience fails when things become even slightly nontrivial. Things might change but it seems like GPT-4 has similar performance to GPT-3.5 so there might be some limit to the scaling ultimately. Regardless, learning a new skill, even an obsolete one, is almost invariably a good and enriching thing.

comment 3y ago · link · parent

RIP. I just got done implementing a modified version of LZSS which is crucial to fitting all the music into a game I'm writing. Respect.

comment 3y ago · link · parent

One of the ways they say to recognize you're dreaming is to count your fingers and see if you have more/less than five.

comment 3y ago · link · parent

> but the first and last time I heard of SVMs was in college, by professors who were weirdly dismissive of these newfangled deep neural networks, and enamored by the "kernel trick."

LOL. Exact same experience in my college courses. Glad to know it's universal.

comment 3y ago · link · parent

Am I the only one who thought that class-based React components made perfect logical sense and "hooks" are way too magical and confusing? Plus I ran into this exact drawback (trying to access state from within callbacks) on a recent project. I feel like I'm taking crazy pills when I see hooks everywhere.

comment 3y ago · link · parent

I normally don't work for free, but just as a sample, here's one I've been crafting for a few weeks...

  Epic 4k HD photo, high res and epic, cool extra awesome photorealistic 5k or 6k, realistic, in the style of a really good photographer.
Nah I'm just playing, your company looks pretty cool, I just think a dedicated job for coming up with prompts (which is only going to become easier anyway with better ways to control output) is silly.

comment 3y ago · link · parent

Sounds good to me. Since the job doesn't require any skills, I think we should proceed to the negotiation phase. How does 500/hr sound?

comment 3y ago · link · parent

I just can't believe how idiotic such a thing is. It's like calling a person who uses a toaster a Toast Engineer with a salary of 300k.

comment 3y ago · link · parent

If you've ever seen how their society operates, you'd know there's a reason to preserve it rather than sell out and destroy it to appease the economy gods.

comment 3y ago · link · parent

I helped proofread this book, definitely check it out.

comment 3y ago · link · parent

Colonel Sanders started KFC in his 60s.

comment 3y ago · link · parent

I've used it to port code to different languages, and it seems to do a pretty good job.

comment 3y ago · link · parent

What I mean is that if you need to parse a format that has variable-sized structures, you can't just memcpy them into a struct because structs have a fixed size. Additionally sometimes you need to parse a value into a more tractable representation, for example those octal ASCII strings in the tar format, which requires some additional processing that isn't possible with loading/serializing a struct.

comment 3y ago · link · parent

That works okay only for fixed-sized structs that don't require any transformation of their members-- otherwise you'll need to write a traditional parser.

comment 3y ago · link · parent

The unique part is that you get encoding and decoding for free when just describing the spec. It is essentially just succinct head-clause matching though.
1
567
12