Because Building A Relay Computer Isn’t Hard Enough

For this year’s Hackaday Prize, we’re doing something special. We’re introducing achievements for Prize projects. Think of them as merit badges. If your Hackaday Prize project has multiple parts that come together into one unified, awesome whole, you get the Voltron achievement. If you’ve built a musical instrument that unexpectedly blows everyone’s minds, you get the Diva Plavalaguna Achievement. A select few entries will earn the Pickle Rick achievement. What’s this? It’s a jaw-dropping build that makes you shake your head in the totality of engineering perfection.

Here’s a project that nails this achievement. It’s a homebrew computer, made out of relays, that runs a custom instruction set. It’s built on Brainf*ck. It is, by far, the most absurd and amazing homebrew computer you’ve ever seen.

Several modules on a shelf, for scale.

First, the hardware. This CPU is built out of about 800 Soviet reed relays, RES64, RES55, and RES-43 relays, if you want some part numbers. These relays are mounted on logic cards connected to a backplane. Each backplane consists of thirty-two of these cards, and it takes two backplanes to build up a 16-bit full adder. The 16-bit instruction pointer and 16-bit address pointer each fit on half a backplane.

Moving up one level, the instruction set for this computer is based on Brainf*ck, with a few additions. The ‘+’ instruction adds to the current value, the ‘>’ instruction still increases the current memory address, but there are a few new instructions that make this CPU not an interminable world of suffering. There’s now a ‘write current data value to register’ commands, and logical XOR instructions.

Have relay-based computers been done before? Yes, and so have Brainf*ck ISAs. The combination is rarely seen, and we’ve never seen one that performs this well. Below, you can see a video of this computer counting at 500 operations per second (or 500 Hz from a frequency counter). This is really unimaginable with any other relay computer we’ve seen, and it’s all thanks to those really tiny Soviet tubes. If you want a Hackaday Prize project that’s jaw-dropping, here you go.

Continue reading “Because Building A Relay Computer Isn’t Hard Enough”

Hackaday Links: May 29, 2016

Hackaday has a store‽ Yes, it’s true, and we have a Memorial Day sale going on right now. Get a cool robot had t-shirt, a cool clock, or a GoodFET. Spend money. Consume.

Learn COBOL. Seriously, you should learn COBOL. It’s a fact of nature that every computer-minded person will eventually hear that COBOL developers make bank, and you’ll have job security for the rest of your life. Now look at the Hello World for COBOL. Yes, there’s a reason COBOL devs make bank, and they’re still vastly underpaid. [Folkert] figured a way around this problem: he built a Brainfuck to COBOL compiler. Mainframe programming for the rest of us.

[fbustamante] got his hands on an old GP2X Wiz, one of those ARM-based portable media player/emulator things from a few years ago. This is a complete computer, and like the Pandora, it’ll do everything one of those Raspberry Pi laptops can do. The Wiz doesn’t have a keyboard, so [fbustamante] created his own. He etched his own PC, repurposed a keyboard controller from a USB keyboard, and stole the keycaps from an old Sharp digital organizer.

Speaking of portable consoles, [Element18592] built this incredible Nintendo 64 portable. He’s done an XBox 360 laptop and stuffed a Pi into an old brick Game Boy. This N64 mod is great, uses a 3D printed enclosure, and has truly amazing vinyl graphics.

To the surprise of many, [Photonicinduction] is not dead. The drunk brit with a penchant for high voltage electrics and a very, very confused power company is back making videos again. His latest video is a puzzle. It’s a plastic block with a light bulb socket, a UK power outlet, and a switch. Plug in a light bulb, flip the switch, and it turns on. Plug a blender into the outlet, and that turns on too. No wires, so how is he doing it?

Introduced at CES last January, Monoprice – yes, the same place you get HDMI and Ethernet cables from – has released their $200 3D printer. This one is on our radar and there will be a review, but right away the specs are fantastic for a $200 printer. The build area is 120mm³, it has a heated bed, and appears to be not completely locked down like the DaVinci printers were a few years ago.

Genetic Algorithm Programmer Gets Functions

[Kory] has been writing genetic algorithms for a few months now. This in itself isn’t anything unique or exceptional, except for what he’s getting these genetic algorithms to do. [Kory] has been using genetic algorithms to write programs in Brainfuck. Yes, it’s a computer programming a computer. Be thankful Skynet is 18 years late.

When we first saw [Kory]’s work, he had programmed a computer to write and run its own programs in Brainfuck. Although the name of the language [Kory] chose could use some work, it’s actually the ideal language for computer-generated programs. With only eight commands, each consisting of a single character, it greatly reduces the overhead of what any genetic algorithm must produce and what a fitness function must evaluate.

There was one shortcoming to [Kory]’s initial efforts: functions. It’s relatively easy to get a program to say Hello World, but to do something complex, you’re going to need something like a macro or a function. Brainfuck, it its most simple form, doesn’t support functions. This throws a wrench in [Kory]’s plan to have his computer programming computer grow smarter and get over local minima in its genetic algorithms.

The solution to this problem was the creation of a new dialect of Brainfuck [Kory] calls BrainPlus. This takes the best parts of Extended Brainfuck and adds a command that basically serves as a break statement.

With this, [Kory]’s self programming computer can develop more complex programs. Already it has created a program to generate the first few numbers of the Fibonacci sequence. It only goes up to 233 because 255 is the maximum value for a byte, and the program itself took seven hours to generate. It does, however, work. Other programs generated with the new Brainplus functions include reciting 99 bottles on the wall and a program that multiples two values.

Even though [Kory]’s computer is spending a long time to generate these programs, given enough time, there’s really not much this program can’t do. Brainfuck, and [Kory]’s Brainplus, are Turing complete, so that given infinite memory and time it can compute anything. With the new addition of functions, it can compute anything faster.

All the code for [Kyle]’s GA is available on Github.


My First Brainf*ck


There was a time – not too long ago – that a ‘my first computer’ required the use of machine code and an understanding of binary. While an introduction to computers is now just how to put a Raspberry Pi image on an SD card, a few people are keeping the dream of memorizing opcodes alive. One such person is [Johan von Konow], creator of My First Brainfuck, an ultra small, low-cost programmable computer.

My First Brainfuck is an Arduino shield designed to have all the features of a normal computer, but without all those messy mnemonics that make assembly programming so easy. This computer is programmed in Brainfuck, a purposely obtuse programming language that, while being incredibly esoteric and difficult to program in, can be very, very rewarding.

[Johan] has a short tutorial showing how his computer works and how the Brainfuck language operates. There are only eight commands in Brainfuck, perfect for such a minimal user interface, but with enough patience, nearly anything can be written in this difficult language.

Right now there are a few examples showing how to play a scale on the on-board buzzer, displaying a Larson scanner on the LEDs, and a few more programs will be published in the future.

Interpreting Brainf*#k on an AVR

We won’t call it useless, but we will ask why [Dan] wrote a brainfuck interpreter for the AVR

It’s not generating code for the AVR; think of it more as a bootloader. To run a brainfuck program, [Dan] uploads it to the EEPROM inside his ATMega32, after which the microcontroller takes over and starts performing whatever instruction the brainfuck program tells it to do. Because the whole thing runs off the EEPROM, the code size is limited to 1022 bytes. Enough for any brainfuck program written by a human, we think.

As for why [Dan] would want an AVR to build an interpreter for a language that is nearly unreadable by humans, we honestly have no idea other than the common, ‘because it’s there’ sentiment. There are some pretty cool projects out there that use brainfuck, including this genetic algorithm software developer. Right now, though, blinkey LEDs are enough to keep us happy, so you can see a video of brainfuck doing its thing on a LED bar display after the break.

Continue reading “Interpreting Brainf*#k on an AVR”

Genetic algorithms become programmers themselves


[Kory] has been experimenting with genetic algorithms. Normally we’d expect his experiments to deal with tuning the variables in a control system or something, but he’s doing something much cooler. [Kory] is using genetic algorithms to write computer programs, and in the process bringing us one step closer to the Singularity.

The first experiments with genetic algorithms generating applications did so in BASIC, C, and other human-readable languages. While these programs nearly worked, there were far too many limitations on what could be produced with a GA. A simpler language was needed, and after turning to assembly for a hot second, [Kory] ended up using brainfuck, an extremely minimal but still Turing-complete language.

The use of brainfuck for creating programs from a genetic algorithm may seem a bit strange, but there’s a method to [Kory]’s madness. It’s relatively simple to write an interpreter the GA’s fitness function can look into and come up with a score of which programs should breed and which should die. Also, the simplicity of brainfuck means a computer doesn’t have to learn much syntax and grammar at all.

Right now, [Kory]’s computer that can program itself only does so by creating simple ‘hello world’ programs. It should be possible, though, for this AI to create programs that take user input and generate an output, whatever that may be. Once [Kory] is able to have the computer generate its own fitness functions, though, the sky is the limit and the Singularity will be fast approaching.