This RISC-V CPU Games In Rust From Inside The Game

[Xander Naumenko] has created something truly impressive — a working RISC-V CPU completely contained in a Terraria world. And then for added fun, he wrote the game of pong, playable in real time, from within the game of Terraria. It’s all based on the in-game wiring system, combined with a bit of a hack that uses the faulty lamp mechanic to create a very odd AND gate. In Terraria, the existing logic gates have timing issues that make them a no-go for complicated projects like this one. The faulty lamp is intended to do randomized outputs, by stacking multiple inputs to get a weighted output when a clock signal is applied. The hack is to simply give this device a single input, turning it into a clocked IF gate. Two of them together in series makes a clocked AND gate, and two in parallel make a clocked OR gate.

Why would [Xander] embark on this legendary endeavor? Apparently after over eight thousand hours clocked in game, one gets a bored of killing slimes and building NPC houses. And playing with the game’s wiring system turned on a metaphorical lightbulb, that the system could be used to build interesting systems. A prototype CPU, with a completely custom instruction set came next, and was powerful enough to compute Fibonacci. But that obviously wasn’t enough. Come back after the break for the rest of the story and the impressive video demonstration.

Continue reading “This RISC-V CPU Games In Rust From Inside The Game”

This Retro Game Console Puts Vacuum Fluorescent Display To Good Use

Small in size, low-resolution, blocky segments, and a limited color palette — all characteristics of the typical vacuum fluorescent display, any of which would seem to disqualify them as the display of choice for a lot of applications. But this is Hackaday, and we don’t really pay much attention to what we’re supposed to do, but rather to what’s fun and cool to do. So when we see something like a VFD game console, we just have to sit up and take notice.

In a lot of ways, the design of [Simon Boak]’s Arduino-based VFD console is driven by his choice of display. The Noritake Itron GU20X8-301 VFD is a “tricolor” display with eight rows of 20 rectangular pixels. Each pixel is composed of six short linear segments, with alternating red and blue colors. Turning on either set of segments yields one of the two base colors, while turning on both yields a sorta-kinda whitish color, if you squint a bit.

[Simon] chose a two-piece design for his console, with a separate controller and display. The controller holds the Arduino Nano and all the controls, plus a piezo buzzer for fun. The display case connects to the controller with a ribbon cable and holds the VFD power supply and driver. To celebrate the retro look of the VFD, both cases are decked out with woodgrain side panels. [Simon] chose appropriately blocky games for the console, like Snake, Conway’s Game of Life, and the venerable snow demo. We’d imagine Pong would be a good choice too, as well as perhaps Tetris if the display were flipped on its side.

We really like the look of this console, and we appreciate putting an otherwise obsolete display to use in a creative way. If you want to learn a little more about these displays, check out this love letter to the VFD.

Continue reading “This Retro Game Console Puts Vacuum Fluorescent Display To Good Use”

The Game Of Life Moves Pretty Fast, If You Don’t Use Stop Motion You Might Miss It

Munged Ferris Bueller quotes aside, Conway’s Game of Life is the classic cellular automata that we all reach for. The usual approach is to just iterate over every cell in the grid, computing the next state into a new grid buffer. [K155LA3] set out to turn that on its head by implementing Game Of Life in the hardware of an FPGA.

[K155LA3]’s version uses Chisel, a new HDL from the Berkley and RISCV communities. Under the hood, Chisel is Scala with some custom libraries that know how to map Scala concepts onto hardware. In broad strokes, Verilog and VHDL are focused on expressing hardware and then added abstraction on top of that over the year. Chisel and other newer HDL languages focus on expressing high-level general-purpose elements that get mapped onto hardware. FPGAs already map complex circuits and hardware onto LUTs and other slices, so what’s another layer of abstraction?

The FPGA chosen for this project is a Digilent Arty A7 with a VGA Pmod to turn the RGB444 into analog signals to actually display. What’s impressive about [K155LA3]’s implementation is just how fast it is. Even running at 60 frames per second it’s almost as fast as the monitor can handle. Of course, most computers lying around you could simulate a 60 x4 8 grid at 60 fps. Next, instead of connecting the grid logic to the 60 Hz VGA clock, he connects it to the 100 MHz board external oscillator. Now each pixel in each frame displayed contains over a million generations.

Unfortunately, even this small grid of 60×48 takes up 90% of the LUTs on the Artix-7. In the future, we’d love to see an even larger FPGA hardware implementation capable of handling grids that could hold whole computers in them. And naturally, this isn’t the first FPGA version of the Game Of Life here at Hackaday.

A Computer In The Game Of Life

We often hear the term “Turing-complete” without giving much thought as to what the implications might be. Technically Microsoft PowerPoint, Portal 2, and Magic: the Gathering all are Turing-complete, what of it? Yet, each time someone embarks on an incredible quest of perseverance and creates a computer in one of these mediums, we stand back in awe.

[Nicolas Loizeau] is one such individual who has created a computer in Conway’s Game of Life. Unlike electricity, the Game of Life uses gliders as signals. Because two orthogonal gliders can cancel each other out or form a glider eater if they intersect with a good phase shift, the basic logic gates can be formed from these interactions. This means the space between gates is crucial as signals need to be in phase alignment. The basic building blocks are a period-60 gun, a 90-degree glider reflector, a glider duplicator, and a glider eater.

All the Python code that generates these structures is on GitHub as the sheer size of the machine couldn’t possibly be placed by hand. The Python includes scripts to assemble the basic programs as a bank of selectable glider generators. It’s all based on Golly, which is an excellent program for simulating Conway’s Game of Life, among other things. While this isn’t the first computer in the Game of Life as [Paul Rendell] published a design in 2000 and [Adam Goucher] published a Spartan universal computer constructor in 2009, we think this is a particularly beautiful one.

The actual architecture has an 8-bit data bus, a 64-byte memory with two read ports, a ROM with 21 bits per line, and a one-hot encoded ALU supporting 8 different operations. Instructions have a 4-bit opcode which is decoding in a few different instructions. The clock is four loops, formed by the glider reflectors as the glider beams rotate. This gives the computer four stages: execution, writing, increment PC, and write PC to memory.

The Game of Life is an excellent example of Cellular Automaton (CA). There are several other types of CA’s and the history behind them is fascinating. We’ve covered this field before and delved into this beautiful fringe of computer science. Check out the video below to truly get a sense of the scale of the machine that [Nicolas] has devised.

Continue reading “A Computer In The Game Of Life”

The Game That Launched 1,000 Hackers

John Conway passed away this week. Even if you don’t know much about mathematics, you will probably know nearly everyone’s favorite cellular automata ruleset: Conway’s “Game of Life”. It’s so much a part of our cultural history, that proto-hacker Eric Scott Raymond suggested using the glider as the hacker emblem.

The idea that a very simple set of rules, applied equally and everywhere, could result in “life” was influential in my growth as a young hacker, and judging from the comments on our article about Conway, I’m not alone. But I won’t lie: I was a kid and thought that it could do much more than make pretty patterns on the screen. I was both right and wrong.

Although amazingly complex machines can be built in Conway’s Life, just check out this video for proof, in the end no grand unifying theory of cellular automata has emerged. As a research topic Conway’s chosen field of mathematics, cellular automata is a backwater. It didn’t really go anywhere. Or did it?

Implementing Conway’s Life in BASIC on a Tandy Color Computer was one of the first things that launched me on my geeky path. It ranks with MENACE: the matchbox-based machine learning algorithm from the 1960’s and an introduction to Markov Chains in the form of a random text generator in my young algorithmic life, all of which I incidentally read about in Martin Gardner’s column in “Scientific American”. Conway’s Life, along with some dumb horse-race game, also taught me about bad random-number generators: the screen would populate the same “randomly” every time on the old CoCo.

So maybe Conway didn’t want to be remembered just for his “Life” because it was a bit of a mathematical dead-end. But in terms of its impact on the world, an entire generation of hackers, and my own personal life, it was able to fill up significantly more than a screen full of pixels. Here’s to Conway, his “Life”, and everyone else who is inspiring the next. You’re not just gliders, you’re glider guns!

This article is part of the Hackaday.com newsletter, delivered every seven days for each of the last 200+ weeks. It also includes our favorite articles from the last seven days that you can see on the web version of the newsletter.

Want this type of article to hit your inbox every Friday morning? You should sign up!

[Game of Life example shown in this article is John Conway’s Game of Life – 1.0 written in Python by Nick Jarvis and Nick Wayne]

Beyond Conway: Cellular Automata From All Walks Of Life

There’s a time in every geek’s development when they learn of Conway’s Game of Life. This is usually followed by an afternoon spent on discovering that the standard rule set has been chosen because most of the others just don’t do interesting things, and that every idea you have has already been implemented. Often enough this episode is then remembered as ‘having learned about cellular automata’ (CA). While important, the Game of Life is not the only CA out there and it’s not even the first. The story starts decades before Life’s publication in 1970 in a place where a lot of science happened at that time: the year is 1943, the place is Los Alamos in New Mexico and the name is John von Neumann.

Recap: What is a CA?

A cyclic CA making some waves

The ‘cellular’ part in the name comes from the fact that CAs represent a grid of cells that can be in a number of defined states. The grid can have any number of dimensions, but with three dimensions the visual representation starts to get into the way, and above that most human brains stop working, so two-dimensional grids are the most common — with the occasional one-dimensional surprise. The cells’ states are in most cases discrete but a subset of continuous CAs exists. During the operation of a CA the future state of every cell in the grid is determined from each cells state according to a set of rules which in most cases take into account the states of neighboring cells.

Continue reading “Beyond Conway: Cellular Automata From All Walks Of Life”

A Clock Created With Conway’s Life

Conway’s life has to be the most enduring zero-player computer game in history. Four simple cellular automaton rules have been used to create amazing simulations since the 1970’s. The latest is an entire digital clock implemented in life. StackExchange user [dim] created this simulation in response to a challenge from [Joe Z]. We have to admit that we didn’t believe it at first, but you can run it yourself by importing [dim’s] gist to the online Javascript Conway’s Life Simulator. To say this is impressive would be an understatement. We don’t know exactly how long it took [dim] to build this clock, but the challenge has been around since August of 2016.

[Dim] does a pretty good job of describing exactly how the clock works. The timebase is at the top. Below it is clock distribution and counters. After that come counters, latches, and lookup tables. Data moves around the clock in the form of gliders. P30 (aka Queen Bee) gliders to be exact. It might make things simpler to think of the glider paths as circuit traces, and the gliders themselves as clock pulses.

We couldn’t get over all the little details in this design. If you zoom way in, you can see all the lookup table patterns have been annotated, much in the way a schematic would be. For [Dim’s] next feat, we hope he takes on [Joe Z’s] Tetris challenge!

Conway’s life is like honey for hackers. We’ve seen it running on our own Hackaday Badge. We’ve even seen clocks that run the game on their display. Someone needs to implement a clock that runs the game that runs this clock. Clockception, anyone?