Five-in-a-row game, with deep-learning AI

This board is to show, discuss and archive useful combinator- and logic-creations.
Smart triggering, counters and sensors, useful circuitry, switching as an art :), computers.
Please provide if possible always a blueprint of your creation.
deep_remi
Burner Inserter
Burner Inserter
Posts: 17
Joined: Wed Mar 23, 2022 9:17 pm
Contact:

Re: Five-in-a-row game, with deep-learning AI

Post by deep_remi »

Yes, sorry, the saved game was lost in a server hard-drive failure 2 years ago, and I do not have a backup. You should be able to create one from the blueprint (make sure to zoom out first, because Factorio does not handle such a huge blueprint very well).
mmmPI
Smart Inserter
Smart Inserter
Posts: 4854
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Five-in-a-row game, with deep-learning AI

Post by mmmPI »

It is possible to recreate the map from the blueprint BUT that require loading a pre 2.0 version of the game where there are still "rocket control unit" in the game, or else the signal is missing and the blueprint has some holes in it and also to unchart quite a lot of area before attempting to paste the blueprint, it's not that big that it's impossible to import, but it's big enough that it's a pain to paste a second or a thid time over the first one if parts were missing.

The experience of loosing against a blueprint that only has 64 neurons hasn't changed :o
Check out my latest mod ! It's noisy !
deep_remi
Burner Inserter
Burner Inserter
Posts: 17
Joined: Wed Mar 23, 2022 9:17 pm
Contact:

Re: Five-in-a-row game, with deep-learning AI

Post by deep_remi »

Did you manage to make it work? If you have a saved game for the new version, then I could host it on my web site. I removed Factorio from my computer, and promised to myself to never install it again, because I was wasting too much time.
Tertius
Smart Inserter
Smart Inserter
Posts: 1517
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Five-in-a-row game, with deep-learning AI

Post by Tertius »

The original blueprint contains satellite and rocket-control-unit items and is incomplete if you import it in 2.0.

I decoded the blueprint, replaced the items with tungsten-carbide and tungsten-plate and recreated a blueprint. It imports without errors and can be placed on a map in map editor mode, however I don't know how to play and how to see if it works correctly.

If to be used without space age, you probably need to replace the items with something non-space age related, probably with one of the new virtual signals. But since for a virtual signal the signal type is to replaced as well, I didn't do this since I just used text search&treplace. With jq it should be quite easy to replace both if you're able to create a corresponding jq filter, but since I'm about to leave for my new year's party I'm unable to finish this :mrgreen:
Attachments
bp.txt
(5.76 MiB) Downloaded 11 times
deep_remi
Burner Inserter
Burner Inserter
Posts: 17
Joined: Wed Mar 23, 2022 9:17 pm
Contact:

Re: Five-in-a-row game, with deep-learning AI

Post by deep_remi »

Thanks for your effort.

You can play by dropping stone bricks into steel chests, as shown in the YouTube video.

IIRC, some letter signals from the end of the alphabet may still be free to use. I will try to make a new version for Factorio 2.0 during the week end, after all.

Have a nice new year party!
Tertius
Smart Inserter
Smart Inserter
Posts: 1517
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Five-in-a-row game, with deep-learning AI

Post by Tertius »

I employed Chatgpt to get me a better signal replacement with a jq filter, and here are the results. I used shape-horizontal and shape-vertical as signal replacements for satellite and rocket-control-unit.

Save file for vanilla Factorio 2.0 with the imported blueprint, ingame game can be started:
gomoku 4.zip
(18.78 MiB) Downloaded 9 times
(It acts differently than in the video and it's quite dumb, however it adheres to the rules, so I guess it's working correctly in general)

Resources:

Original blueprint for 1.1 (not suitable for Factorio 2.0)
gomoku_blueprint.txt
(5.09 MiB) Downloaded 11 times
Fixed blueprint for 2.0 (vanilla 2.0 without Space Age and mods)
gomoku_blueprint-fixed.txt
(5.76 MiB) Downloaded 8 times
Blueprint tools (bash shellscripts, remove *.sh.txt and chmod +x, requires coreutils and openssl)
bpdecode.sh.txt
(242 Bytes) Downloaded 11 times
bpencode.sh.txt
(177 Bytes) Downloaded 12 times
jq filter
gomoku-jq-filter.txt
(318 Bytes) Downloaded 8 times
jq call to fix decoded blueprint
fix-bp.sh.txt
(143 Bytes) Downloaded 10 times
mmmPI
Smart Inserter
Smart Inserter
Posts: 4854
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Five-in-a-row game, with deep-learning AI

Post by mmmPI »

deep_remi wrote: Wed Dec 31, 2025 1:36 pm Did you manage to make it work? If you have a saved game for the new version, then I could host it on my web site. I removed Factorio from my computer, and promised to myself to never install it again, because I was wasting too much time.
Unfortunatly, i only have a working save game for the 1.1 version
gomoku for factorio 1.1.zip
(12.84 MiB) Downloaded 9 times
does behave like in the video !

Factorio does takes a lot of time, but when considering the other things i do with said time, it doesn't feel like a waste to me :)
Tertius wrote: Wed Dec 31, 2025 4:16 pm The original blueprint contains satellite and rocket-control-unit items and is incomplete if you import it in 2.0.

I decoded the blueprint, replaced the items with tungsten-carbide and tungsten-plate and recreated a blueprint. It imports without errors and can be placed on a map in map editor mode, however I don't know how to play and how to see if it works correctly.
I was about to say thank you and ask for how you did it, because i would suggest "not" using space age item , to make the lightest possible 2.0 version, and i see you gave the ressources you used later, but when attempting to play with your version in 2.0 i noticed it didn't behave like the video, i think something went wrong in the update because really the AI isn't like you say :
Tertius wrote: Thu Jan 01, 2026 4:02 pm (It acts differently than in the video and it's quite dumb, however it adheres to the rules, so I guess it's working correctly in general)
The AI choices are deterministic, there is no randomness or pseudo one based on any time or anything like that, so if it doesn't behave like in the video, to me, it means something went wrong, but there are like 150K entities so it's not easy to figure out what. And i don't know how to use the debug screens on the right side or if they are useful in that situation.

The AI is VERY GOOD, you may need to do a little research about the gomoku narabe rules, especially the starting positions, because i think you have to do the first move on behalf of the AI, i don't remember for sure if that's because otherwise the AI would always do the same first move, or if that's because the game when played has different starting positions depending on handicap or things like this but if you try to start like in the video, placing the stone brick in the same chest in the same order, i don't think you can beat the AI in the version "1.1"
Check out my latest mod ! It's noisy !
deep_remi
Burner Inserter
Burner Inserter
Posts: 17
Joined: Wed Mar 23, 2022 9:17 pm
Contact:

Re: Five-in-a-row game, with deep-learning AI

Post by deep_remi »

If you can run both versions side by side, then it should not be very difficult to find out where the difference is. Besides missing signals, Factorio 2.0 may have also changed the behavior of combinators in such a way that it does not work well any more.
Tertius
Smart Inserter
Smart Inserter
Posts: 1517
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Five-in-a-row game, with deep-learning AI

Post by Tertius »

I did it! I forgot about the inserter updates. There are no more filter and stack-filter-inserters in 2.0, and the stack inserter was renamed to bulk inserter. I used the cargo landing pad and the display panel as replacement signals.

This save and this blueprint definitely work with vanilla Factorio 2.0 and should also work with Space Age (I still replace the satellite, since Space Age doesn't have a satellite, while non-Space Age does have it).

The AI is quite smart this time. Cool.

The save for Factorio 2.0:
gomoku 5.zip
(25.78 MiB) Downloaded 8 times
Blueprint, exported from the Factorio 2.0 save:
gomoku_blueprint Factorio 2.0.txt
(4.19 MiB) Downloaded 7 times



The converted 1.1 blueprint:
gomoku_blueprint-fixed.txt
(5.77 MiB) Downloaded 5 times

The updated conversion:
There seems some Factorio internal auto-conversion that detects if a blueprint is from version 1.1 and exchanges stack-inserter/bulk-inserter, since if I explicitly replace stack-inserter with bulk-inserter, Factorio complains about an unknown stack-inseter, while if I skip this conversion, Factorio does this on its own.
gomoku-jq-filter.txt
(550 Bytes) Downloaded 7 times
mmmPI
Smart Inserter
Smart Inserter
Posts: 4854
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Five-in-a-row game, with deep-learning AI

Post by mmmPI »

deep_remi wrote: Fri Jan 02, 2026 12:57 pm If you can run both versions side by side, then it should not be very difficult to find out where the difference is. Besides missing signals, Factorio 2.0 may have also changed the behavior of combinators in such a way that it does not work well any more.
I didn't think combinator behavior could have changed in a way that would not preserve blueprint compatibility, but it's a large one that stretch some limits, i couldn't run 2 versions side by side, and am glad Tertius found the missing details. There may be further change in combinators in 2.1, the next 'large version change' , that may add ways to reduce the footprint, i'm not too sure but will be looking for it, I would prefer to try and play with 2.0 => 2.1 conversion/optimization "in-game" if there's a possibility to do so rather than using decoded blueprint, but last time i tried i didn't succeed, just learned a lot :)

Tertius wrote: Fri Jan 02, 2026 3:29 pm I did it! I forgot about the inserter updates. There are no more filter and stack-filter-inserters in 2.0, and the stack inserter was renamed to bulk inserter. I used the cargo landing pad and the display panel as replacement signals.
Nice ! Tested the new 2.0 "light version" ( which would have been even lighter without 3 copies of the blueprint in inventory :twisted: ) As far as i can tell it works like in the video , which is great !

Tertius wrote: Fri Jan 02, 2026 3:29 pm The AI is quite smart this time. Cool.
Well it still need human supervision for the code to actually works heehehe.

Joke aside, the gomoku AI embedded in combinators can actually be beaten with the starting position of the video, it's quite smart but not perfect, having initiative gives quite the advantage and you can reload the game if you missed something, but this being necessary to win is a testimony to how smart it is i believe, because when re-documenting on the rules from the wiki page there's a mention about the ratio of win/loss, those are sort of known for "players of equal level", depending on starting position and clearly the AI has better level than me. When i said i don't think you can beat the AI is because some starting positions can force a win/loose, those are avoided in tournaments, i wasn't sure you "could" beat the AI starting like in the video and even if , it feels like an achievement to win, rather than something you have 50+% chance of doing, more like 0.1% x) so i post my picture :
long-game.jpg
long-game.jpg (394.51 KiB) Viewed 59 times
Tertius wrote: Fri Jan 02, 2026 3:29 pm The updated conversion:
There seems some Factorio internal auto-conversion that detects if a blueprint is from version 1.1 and exchanges stack-inserter/bulk-inserter, since if I explicitly replace stack-inserter with bulk-inserter, Factorio complains about an unknown stack-inseter, while if I skip this conversion, Factorio does this on its own.
Thanks a lot for this, good insight and useful script to share, can be used for other blueprints too ! Suddenly i don't have enough times to play the game anymore i have a lot of things to try x)
Check out my latest mod ! It's noisy !
Post Reply

Return to “Combinator Creations”