Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
I wrote a Flappy Bird game in TypeScript's type system (zackoverflow.dev)
7 points by zackoverflow on Oct 19, 2023 | hide | past | favorite | 1 comment


Hey HN, I got inspired by a recent hack someone did of creating flappy bird in MacOS Finder, so I tried to do the same with type-level Typescript.

If you don't know, Typescript's type annotations are Turing complete, allowing you to compute anything with some clever type trickery.

In order to render graphics from Typescript's types, I ended up creating a compiler that compiles Typescript's types into bytecode, and a custom VM that can execute that bytecode.

Each frame, the VM takes draw commands from type-level Typescript, and renders it using the configured graphics backend. It can run in the browser by compiling the VM to Wasm and using the web's Canvas API.




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

Search: