Pong Numbers using proper binary

Pontus Alexander
Meth Meth Method
Published in
1 min readAug 20, 2016

After I released the Pong episode of Meth Meth Method one of my clever friends, Felix Bruns, made a patch showing how we can simplify the numbers-string-array using binary.

When we express the number 0 as a string of on-off values like 111101101101111 we see a resemblance with typical binary notation. Doing a binary-to-decimal conversion of the number above gives us 31599 which in hexadecimal is 7B6F.

Knowing how we can iterate over each bit in the binary number we can make the number drawing algorithm shorter as demonstrated in the diff below.

https://github.com/meth-meth-method/pong/commit/1ac51f325d60b52d8489e9fd3343b0fe8330581f

--

--

Pontus Alexander
Meth Meth Method

I’m a software engineer, living in Stockholm. I write about random things that interest me.