1
0
Fork
You've already forked SmallestPingPong
0
Smallest ping pong game will be ever made
  • C 96.9%
  • Makefile 3.1%
Find a file
2026年03月02日 18:38:27 +02:00
.gitignore Initial commit 2026年03月02日 18:38:27 +02:00
LICENSE Initial commit 2026年03月02日 18:38:27 +02:00
Makefile Initial commit 2026年03月02日 18:38:27 +02:00
pong.c Initial commit 2026年03月02日 18:38:27 +02:00
readme.md Initial commit 2026年03月02日 18:38:27 +02:00

Smallest ping pong game ever made

It is the smallest code base will be ever made, becose its size is zero!

Wait ... what?!

Traditional way to measure the size of the code base is by counting lines of code. It's simple: find | xargs wc -l, and pretty intuitive.

However, not every line is code, there is closing brackets, comments and just blank lines for better readability.

Another technique is to count semicolomns. I found this approach in wren language. It also not perfect: python, for example, has no semicolomns.

But for C and C-like languages its pretty good idea, one semicolomn means one instruction. There are still macro, if statements and other, but in general i believe its better than just straightforward lines of code.

So, yeah, this is ping pong game which takes exactly 0 semicolomns.

How?

I was inspired by this blog poste.

The idea is to have all code inside function argument array length. This is strange edge of C standard, but yea, it works.

Also no structures allowed, becouse they require semicolon. All the data passed with arguments. Good luck writting a big project using this approach.

I had some problems with loop: built-in loops are not allowed inside expressions. The obvious solution is recursion, but for some reason function can not call itself from argument without declaration, and declaration requires semicolon. The solution came from setjmp and longjmp using separate function for loop condition check.

For more detailed topic exploration read blog post.

Building and running

You will need raylib, make and gcc or clang. Other compilers i tried: tcc, antcc, cproc either ignoring all the code, or just give errors.

Run make and then ./pong to start. Controls in arrow keys and W/D.