Remix.run Logo
kittoes 2 days ago

Dying? Really?

https://github.com/ByteTerrace/Puck/blob/main/src/Puck.Maths...

Some of us aren't just slopping it up like @theo and all the other AI influencers are, as I developed nearly every single line of this by hand over the span of the past decade. Agents recently became capable of factchecking it and helped find bugs that my other unit testing never caught. Software engineering has never been more alive!

https://gist.github.com/Kittoes0124/6827d08e457c1c8b790422af...

This is a snippet I wrote years ago to help me study different formulations of the equation ((1 + √5) / 2). There was this thing I could "see" in there that would allow me index into these sequences, and whole families of others, in O(1) time. The problem is that I still don't know enough maths to derive the exact object that I want from the nonsense that I have.

https://github.com/ByteTerrace/Puck/blob/main/src/Puck.Maths...

This is the reformulation of that snippet into a proper object, distilled using Fable and Sol. Unlike BinaryIntegerFunctions, I didn't write a line of this and I'm quite happy with that. It's been a slog for so long... being able to let these agents toil away at all the off-by-one type noise is just nice. I get to focus on an actual product for once instead of manufacturing every single nut and bolt myself.

lenkite a day ago | parent [-]

I am just confused on how you know that all of what has been generated is valid. When you write the code generator yourself, you have that level of confidence.

kittoes 20 hours ago | parent [-]

It's mathematically provable in most cases because the engine is deterministic from the ground up and I refused to ever compromise on that one detail. For example, nearly all of the VM and maths code functions have been validated for ALL possible 32-bit inputs and extensively fuzz tested in the 64-bit range. Even the more complicated sections of the code like the emulators have batteries of third party tests that ensure a certain level of compliance. The fact that you can play commerical ROMs to completion, including esoteric titles that require third party peripheral/MBC code, is quite solid proof too!

A form of recursion is also doing a lot of heavy lifting because the emulators are their own separate deterministic engines that are dynamically plumbed into the primary loop. This not only allows us to embed diegetic devices (as in, you can literally pick up a glowing brick in the world, hold it to your face, and play it), but also validates that the primary loop is coded accurately because the outer loop runs at X Hz while humble bricks must run at ~59.7275 Hz. Pacing inaccuracies in the main loop cause us to fail the brick suites that we test against. This concept of having features reinforce one another is applied as often as possible.

The obsession with determinism goes so far that both the DirectX and Vulkan backends are validated against each other for pixel level differences. If they differ more than the expected maximum then code is refactored until the drift is back within acceptable range.