Tetris In A Single Line Of Code

PC gaming in the modern era has become a GPU measuring contest, but back when computers had far fewer resources, every sprite had to be accounted for. To many, this was peak gaming. So let’s look to the greats of [Martin Hollis, David Moore, and Olly Betts], who had the genius (or insanity) to create Tetris in a single BBC BASIC line.

Created in 1992, one-line Tetris serves as a great use of the limited resources available. The entirety of the game fits within 257 bytes. With the age of BASIC, the original intent of the game for BBC BASIC was to be played on computers similar to Acorn’s BBC microcomputer or Archimedes.

One line Tetris has all the core features of the original game. Moving left, right, and rotating all function like the traditional game, most of the time. Being created in a single line, there were a few corners cut with bug fixing. Bugs such as crashing every 136 years of play due to large numbers or holding all keys causing the tetrominoes to freeze make it an interesting play experience. However, as long as our GPUs are long enough to play, we don’t mind.

If you want to experience the most densely coded gaming experience possible but don’t have one of the BBC BASIC computers of old, make sure to try this emulator with a copy of the game. Considering the amount done in a single line of BBC BASIC, the thought may come into mind on what could be done with MORE than a SINGLE line of code. For those with this thought, check out the capabilities of the coding language with modern hardware.

Thanks to [Keith Olson] for the tip!

Solar Light? Mains Light? Yes!

So you want a light that runs off solar power. But you don’t want it to go dark if your batteries discharge. The answer? A solar-mains hybrid lamp. You could use solar-charged batteries until they fall below a certain point and then switch to mains, but that’s not nearly cool enough. [Vijay Deshpande] shows how to make a lamp that draws only the power it needs from the mains.

The circuit uses DC operation and does not feed power back into the electric grid. It still works if the mains is down, assuming the solar power supply is still able to power the lamp. In addition, according to [Vijay], it will last up to 15 years with little maintenance.

The circuit was developed in response to an earlier project that utilized solar power to directly drive the light, when possible. If the light was off, the solar power went to waste. Also, if the mains power failed at night, no light.

The answer, of course, is to add a battery to the system and appropriate switching to drive the lights or charge the battery and only draw power from the mains when needed. Since the battery can take up the slack, it becomes easier to load balance. In periods of low sunlight, the battery provides the missing power until it can’t and then the mains supply takes over.

Comparators determine whether there is an under-voltage or over-voltage and use this information to decide whether the battery charges or if the main supply takes over. Some beefy MOSFETs take care of the switching duties. Overall, a good way to save and reuse solar cell output while still drawing from the grid when necessary.

Small solar lights don’t take much, but won’t draw from commercial power. Solar “generators” are all the rage right now, and you could probably adapt this idea for that use, too.