Is it possible to write a program in no more than a tweet's length? A website called 140byt.es says it is and has an implementation of Tetris to prove it.
Of course such attempts at compressing programs into tiny spaces go against the ethos of clear maintainable code, but this is day-off stuff and purely for fun.
One that caught my attention in particular was an implementation of Tetris - ok, it only has two types of block - hence its title "Binary Tetris" - and there's no rotate, but it works. The blocks fall down the screen and you steer them into place. You can try it out by playing the demo.
Of course the fun for the reader is to work out how it works. To do this you need to know that the function doesn't include the display routine or the user interaction. You also need to know some tricks of the trade. In particular, if you are wondering what the Date object is doing in there, it's a cheap way to get random numbers.
If you are stumped then a clue is that the board and falling blocks are represented as bit patterns and the whole logic is implemented as bit manipulation. The good news is that this tiny program is explained in great detail. If only all programs were documented to this degree!
The Raspberry Pi isn't just a low cost reasonably powerful CPU, it also has video processing abilities and an easy-connect, low-cost video camera which has just been upgraded to 8 Megapixels for the s [ ... ]
A course in creative computing that uses p5.js to capture natural phenomena in the physical world started on May 3rd. Taught by Dan Shiffman, Processing Foundation's co-founder, with guest lectur [ ... ]