Creating a basic linear regression model in PICO-8 environment from scratch.



PICO-8 is a fantasy console for making, sharing and playing tiny games and other computer programs. It feels like a regular console, but runs on Windows, Mac and Linux. It’s an incredibly charming little environment with some very serious limitations carefully chosen to be fun to work with and to encourage small but expressive designs.

I’ve played many games on the PICO-8 but have not spent a lot of time exploring the code editor. In order to get myself coding in a language other than Python (in this case, Lua) I thought attempting to build a machine learning model in such a limited environment could be a fun thing to explore, so I did!

The program I chose to build was a basic linear regression model. In this case, due to some serious limitations, takes a single table of “X values” and a corresponding table of “y values” to calculate its “line of best fit”. From there, it takes a specified “new X value” to make a prediction of its “y value”.

Technology Used_

PICO-8 Fantasy console specs:

• Display - 128x128 16 colours
• Cartridge Size - 32k
• Sound - 4 channel chip blerps
• Code - Lua
• Sprites - 256 8x8 sprites
• Map - 128x32 cels


Below are some graphics generated while completing this project.


I’ve collected a few resources for further reading:

PICO-8 Fantasy Console.

© Copyright 2020 Tom Gilmore. All Rights Reserved.