Games to learn and train Coding

Over in the Clicker thread, the free game Bitburner has occupied a lot of thread pages and sparked the idea of a thread dedicated to coding games.

Bitburner doesnt really teach coding but it's great practice, and for me it was an introduction to Javascript. In it, you write code to automate the process of hacking a network of servers. Its completely free, no IAP, no DLC.

At work I guide our newer test hires through learning the fundamentals of Python so learning program is a topic that's near and dear to me. QA is one of those fields that can only be improved with tools and automation, not replaced any time soon, so learning to code for my folks is a great way to level up their careers quickly.

This would be a great place to promote fun games that exercise coding, or to talk deeply about those games from a strategy, optimization, etc perspective.

Off the top of my head, a heckton of Zachtronics games (TIS-100, Shenzhen I/O, Exapunks) are explicitly programming games. To a lesser extent, also Opus Magnum, Molek-Syntez, Infinifactory and SpaceChem, though those add a spatial element to the programming.

Big shout out to Human Resource Machine, which is a cutesy graphical take on a programming puzzle game. And The Signal State, which uses modular synths as a platform for programming puzzles.

None of them are any actually teach a useful language, but might be useful to inculcate a puzzle-solving programming mindset, focused on elegance and optimization.

There's plenty of other options for teaching kids basic coding skills (Rabbids Coding springs to mind, which is free), but you sound like you're looking for less elementary experiences for actual grown-ups.

This is just a space to talk about these games, the merits of each, getting good at them, etc, not really me looking for suggestions.

I'll talk a bit about Bitburner. It's one of those 'incremental' games, sometimes called idlers, where you set up an engine and watch it run. In the case of Bitburner, that engine is composed of calling functions like weaken() to lower a server's defenses, grow() to inflate its current bank account, and hack() to try and steal some percentage of that money.

You can start in the command terminal, like Linux or Dos, just connecting to the server and running those commands directly.
Pretty soon you want to automate that, install a script that might weaken(), grow(), then hack() in a looping sequence.
You'll graduate another level where you want to automate installing that script on every server you can connect to. And graduate again to creating a fleet of hacking servers to put more raw computing power into the process.

You can get by with very little elegance and learn some topics like effective looping, maybe writing a simple function to determine if a server has enough money yet to bother running hack(). But to get even better you'll be encouraged to further refine your code and revisit your core strategy. And you do this all using real Javascript. I don't have to stick to game help sites for help writing good code here. I can use all of the JS world's knowledge base to help. That's pretty great.

Two other games I'd like to mention which focus more on Visual Scripting. That is dragging and dropping functional nodes around to create a sequence of logic and events.

Autonauts
In an adorable game about harvesting resources, making things, and building a colony, you'll quickly stop chopping down trees yourself and instead build a robot, which you'll have watch as you chop down a tree so it learns how to do that. Now have a fleet of robots doing that, others organizing the resources that fall, planting new trees...
now have robots that build robots!
It gets crazy. You'll have dozens of robots running around while you monitor and troubleshoot. The 'coding' is really light but you'll have fun playing with sequences, designing better logic, improving script efficiency due to very limited space in robot's acorn brains. Its amazing.

Gladiabots
Design logical blueprints for a team of robots as they take on other teams (either ai scripts written by the game makers or other players) in competitions like last-bot-standing or territory control. I didn't get as deep into this one but the opportunity to play around with visual scripting felt a lot like using Blueprints in Unreal Engine; a system so robust that you can code a whole game* using just dragging and dropping nodes. We have QA members on my team 'writing' test automation using this same kind of scripting, so an introduction like Gladiabots seems great for later graduating to tinkering with Blueprints.

* naturally there are limitations to coding in Blueprints, but you can make some fun stuff, and with the support of C++ coders, other team members can create a ton of content, tests, puzzles, etc using just Blueprints.

If you want basic logic puzzles with programming akin to logo, I can't recommend lightbot and lightbot 2 enough. I believe they were flash games so I hope they have been ported to html 5 by now.

Is it this? https://lightbot.com/

If so then it's an app now.

Yeah, its an app now on Apple and Google.

Nice!
Re: Bitburner: As my activity in the Clicker thread probably shows this game has been keeping me entertained for the past few days.

One of the things I enjoy is that it gives you a few prompts but then mostly gets out of your way and you can explore and set your own goals.

I keep coding up little scripts to solve small problems, tweaking them, and then looping them together into larger scripts that chain together. Then I get to troubleshoot and discover edge cases I hadn't considered.

I'd be curious what kind of logic others have come up with or tried for optimizing hacks.

My current challenge is working out how to use the API for contracts. There's stuff there that makes me think they should be automated.

fangblackbone wrote:

If you want basic logic puzzles with programming akin to logo, I can't recommend lightbot and lightbot 2 enough. I believe they were flash games so I hope they have been ported to html 5 by now.

I just finished the first 20 levels, which we're free.

As promised, it dug up happy memories of telling my turtle where to go and when to draw. And contrary to my hazy memories of sitting in front of an Apple IIe, Lightbot doesn't waste any time before introducing sub-routines.

Very cool. I'll show my five-year-old nephew. He'll be too young for some of this, but he'll have fun telling me what to make the robot do.

Ok a Bitburner coding question now. I'm playing with my main script and creating a Class for servers, one for PCs in my fleet, and a list to contain each. I learned from yall that though you can import/export, scripts can't really share dynamic data that way so everything needs to basically be in a primary script that launches other scripts.

My problem is that unless I fully automate everything, I need to restart the script to make adjustments to my strategy, like switching from grow() to weaken(). I haven't been able to find any functions that allow for user input. Am I missing something clever, like simple text input to an active script?

polypusher wrote:

My problem is that unless I fully automate everything, I need to restart the script to make adjustments to my strategy, like switching from grow() to weaken(). I haven't been able to find any functions that allow for user input. Am I missing something clever, like simple text input to an active script?

Interesting. There's a prompt() function that offers a yes/no branch to a user but I'm pretty sure that would pause whatever is happening unless there's some trickiness with parallel paths that might let the system loop until it gets an interrupt. Where do you envision a manual switch in your workflow?

Edit! Actually you could do this with ports! Flip a port to select a new flow in a loop and you can do that from anywhere.

Not sure if this will pan out, but it looks like we can use ports to get data into a running script.

https://bitburner.readthedocs.io/en/...

Unless I'm missing something, interacting with ports appears to be limited to server-local, so you might need to 'run()' or 'exec()' another script to 'write()' to the port.

Just in case there are any new people, my favorite coding game is the web site www.codingame.com. It lets you code in about 20 different languages to solve varying difficulties of programming puzzles, and write AI bots in dozens of multi-player games. For each multiplayer game you start in the bottom rank and as you improve you move up into more difficult leagues.

The best part is that all the AI games and a lot of the puzzles animate your solution, so you see what your bot is doing in a little video and can use that to make corrections and see other player's bots. It's a really fun way to learn new languages, too, especially now that there is built-in language assist for a lot of them.

I swear they are not paying me, I legitimately love their site.

Friend me up!

Mixolyde wrote:

Just in case there are any new people, my favorite coding game is the web site www.codingame.com.

Is this meant to be a place to learn coding, or to develop languages you already know and add new ones?

I had a quick look and roughly the second thing it required you do was join a "clash", the requirements of which were completely impenetrable. Was not a good first impression.

I think it is more geared toward improving and expanding existing skills, not learning to code from scratch, although you could. There is a very helpful community and a lot of linked tutorial pages that are growing.

And I also hate the clash of code achievement being so early in the path and think it is a mistake. I ignore the clash mode and play all the other puzzle types.

I'll throw in a recommendation for Rogue Bit. It uses assembly rather than a higher level language, and it has a really clever mechanic where the environment is a program's memory space and your avatar is a bitmask. You change the program (and therefore the environment) by standing on different parts of the code and flipping the bits of the instructions. It must have been incredibly hard to design!

I also want to mention that a lot of these games, and especially the Zachtronics ones, are not necessarily the best ways to learn programming. The restrictions they introduce might make for interesting puzzles, but they force you to write code in a way that would get you fired in a professional setting.

Yeah I think mostly they're a way to get interested in coding. Of these, Bitburner is the only one I can think of where you write in a real world language, but the game itself doesn't move you through the steps of learning coding fundamentals, so you'd have to do a lot of independent searching to get there.

I get my entry level QA folks to try out this online class on Coursera from Rice university. In it you learn the fundamentals of programming by developing games like Blackjack, Memory, Guess the Number, and Asteroids. After the ~10-12 week course you know enough to make some interesting things. I took it 10 years ago and it changed the course of my career.

polypusher wrote:

Yeah I think mostly they're a way to get interested in coding. Of these, Bitburner is the only one I can think of where you write in a real world language, but the game itself doesn't move you through the steps of learning coding fundamentals, so you'd have to do a lot of independent searching to get there.

I get my entry level QA folks to try out this online class on Coursera from Rice university. In it you learn the fundamentals of programming by developing games like Blackjack, Memory, Guess the Number, and Asteroids. After the ~10-12 week course you know enough to make some interesting things. I took it 10 years ago and it changed the course of my career.

I can't tell if that is a free course or not. Does anyone know if this class is free. As someone who only wants to dabble, it would be a poor investment if I would be charged Rice tuition to take this online class.

That Coursera course has a free path. They hide it well. On the Enroll page there's a tiny 'Enroll for Free' link at the bottom. The main thing you don't get by doing that path is that you can't submit your projects for other students to grade.

If you do go the paid route, you're looking at a reasonable rate, not Rice tuition. Not sure what the exact rate is.

A few years ago I looked into this and it was only something like $50 for the certificate.
It may be as much as $300 like a lot of the Google certificates.

Thank you both. I will try to navigate the free path.

Zenva is having a spring sale where their all access pass is $5 for the first month:
https://academy.zenva.com/claim-mont...

They have a ton of courses involving coding interactivity and digital content creation.

I don't know how accessible it would be for someone without a background in this stuff, but Turing Complete (in early access on Steam) is absolutely brilliant. You build a working computer, starting by creating logic gates and moving on to more complex circuits, memory, registers and so on. Eventually you end up writing programs in machine code and assembler.

Since it's early access it's still a bit rough around the edges, but I'm having a lot of fun with it.

I want to try Turing Complete, it does look pretty cool, but I know I have bounced off some similar puzzle games. Or Nor Xor problem solving makes my head hurt

The Signal State comes to mind. Cool concept well executed, but the kind of puzzle isnt a space my brain wants to go into. I will probably try it anyway if only to support the dev.