Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is from the same gentleman who (among other things) demonstrated that printf() is Turing complete and wrote a first person shooter in 13kB of Javascript.

https://github.com/HexHive/printbf

https://github.com/carlini/js13k2019-yet-another-doom-clone



> demonstrated that printf() is Turing complete and wrote a first person shooter in ...

Not gonna lie, I thought that sentence would end with the FPS being done in printf.


This guy wrote tic-tac-toe in a single call to printf for IOCCC 2020 competition:

https://github.com/carlini/printf-tac-toe


That is quite literally a work of art.


It’s very fun and impressive but it’s absolutely not a single call.


Maybe a generous interpretation of the comment and a realisation that common language isn't always 100% precise would be better than pointless arguments about semantics.

There is only a single printf written in the source code.


That I can agree with!


I don't think it's an unreasonable criticism, otherwise the challenge is trivial:

``` function printg(arg) { printf(arg); } ```


That, of course, isn't what they did.


They did put it in a while loop though, which, if my programming isn't completely out of date, is capable of calling the function more than once.


The development writeup for the Doom is interesting, with many details. https://nicholas.carlini.com/writing/2019/javascript-doom-cl...

There was one month time to complete the competition. But it seems you were allowed to reuse any existing other code.

Looks like this was quite fun to work on.

(I feel a bit sad that I would never be able to get one month of free time to work on this now, due to family and job...)


Wow that’s a fascinating read, thanks for linking it!!


> a first person shooter in 13kB of Javascript

I was somewhat disappointed to realize they used WebGL for rendering the graphics.


There was an earlier version of the underlying 3d engine that used only Canvas. WebGL use is justified like this:

> Once I actually got that working doing all of the math by hand in JavaScript I decided that using WebGL would probably be worth it, and actually probably wasn't cheating all that much. WebGL exposes access to the GPU-enabled rendering engine through JavaScript. While it does abstract away some of the rendering, it's less than I thought---it just supports the ability to do the necessary math efficiently---so I decided this wouldn't be cheating. And fortunately, it didn't take long to reproduce the initial renderer, but this time supporting much better (and more efficient) graphics.

From: https://nicholas.carlini.com/writing/2019/3d-renderer-javasc...


That makes sense: As far as I understand, OpenGL 2.0 and beyond don’t really provide much fixed-function/predefined logic anymore, e.g. I believe you need to provide your own vertex and pixel shaders.

You could argue that rasterization itself is being taken care by the implementation, though.


Why is this disappointing?


[flagged]


I'm not sure how this quote applies to harmless pursuits like making and solving absurd puzzles. It's not like regex chess is going to be a weapon of mass destruction.


It's a line from the movie Jurassic Park. Pretty sure they're just joking.


The whole comic aspect of Jeff Goldblum's character was a guy who took jokes literally. Huzzah!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: