I like strange programming languages, and have been a fan of Forth for quite a number of years now. When I teach the programming languages course I force students to learn it just so I can have a reason to work with Forth.
After writing the Python Duck Coding IDE for my students who are learning Python, I thought it’d be fun to use the same infrastructure to create some small games that can be solved using Forth code.
Plus, I’ve been sick and unable to do much else, and I like to program strange things when I don’t have anything else to do.
Here’s the alpha version of the concept: https://forth-games.anvil.app
If you don’t know Forth, you’ll need to at a minimum look up basic syntax and how to use if/else statements to get any traction.
The idea is that you write Forth code in the editor. When you click the run icon in the toolbar, it runs the Forth code and then redraws the frame. Then your Forth code runs again, the frame updates, etc. Your code runs completely each frame, and continues to run each frame until you either stop it using the stop icon in the toolbar, or the code accomplishes the goal in the game.
Scroll down in the right hand pane to see the goal for the game and the game specific words available.
If you want to see it running but don’t care to learn any Forth, this code will solve the first (and only so far) game:
Forth Solution
wall@
if left else move then
If I take it farther then there will be more games that require increasingly more sophisticated use of Forth to solve. Not featured in the first game is the ability to have multiple copies of your Forth code running in parallel.