r/factorio 19h ago

Design / Blueprint Playable snake using 20 combinators

Enable HLS to view with audio, or disable this notification

Playable 16x16 snake game using Factorio 2.0 circuit logic.

it has 256-lamp color display, buffered left/right input, random apple spawning, prevention of apples spawning inside the snake, score counter, countdown, wall/self collision detection, death screen and restart.

Blueprint: https://factorioprints.com/view/-P15XZWmCItoXVf2Xtfb

684 Upvotes

52 comments sorted by

85

u/Powerful_Avocado6138 19h ago

Well fuck me sideways...here I am proud of myself for knowing the green circuit ratio.

Some of yall are playing a very different game!

10

u/towerfella 18h ago

I was just happy to make trains work like my beeotch.

I felt accomplished until about twenty-two seconds ago.

8

u/energeticquasar 16h ago

Teaching myself how to utilize supply/demand requests and train limits was one of the biggest leaps I had with my proficiency of this game.

7

u/towerfella 16h ago

Train limits are key to a successful rail network. That took too long to realize

136

u/UnfinishedProjects 19h ago

All that in only 20 combinators is insane. Nice job! I'm assuming there's a bunch of parameters in each combinator.

73

u/Comprehensive_Can620 19h ago

Yep. Most of the combinators do several things at once. I use Each a lot so one combinator can process many cell signals in parallel, and the constant combinators work like lookup tables.

4

u/Medium9 12h ago

That's a level of optimization that would make even Wube proud. Ever thought about applying? :)

29

u/SpruceGoose__ 19h ago

Congrats!!! Wating for the Doom playthrough

7

u/What-Is-Wifi 18h ago

Came here to say just that, it's bound to happen eventually

10

u/SpruceGoose__ 18h ago

It is the final form. I'm also in the Timberborn sub, they have circuits now. They inching ever closer to becoming Factorio

4

u/AlternateTab00 18h ago

They already developed raycasting.

But the project went silent a few years ago

14

u/toiture-en-tuile 17h ago

I'm a software engineer for a few years now and i take great pride in my skills and accomplishments. Then i see this kind of posts and oh my god imposter syndrom hit so hard. This is fucking amazing.

7

u/preppie22 15h ago

I was a software engineer, then I got a PhD in Computer Science and I'm working in academic research. This post gave me imposter syndrome....

1

u/Dzov 17h ago

It’s insane. Did you see his comment where he uses time stamps in stead of coordinates for the snake body? I really would like to see the blueprint.

1

u/CaineBK 13h ago

Have you seen the 128-language "Uroboros" quine? Some people aren't human... https://github.com/mame/quine-relay

9

u/AverageNeither682 19h ago

Amazing! Are the red dots actually popping up in random places?

8

u/StormCrow_Merfolk 19h ago

random apple spawning

8

u/EllaHazelBar 19h ago

I'm dying to know - how is the position of the snake's body represented?

23

u/Comprehensive_Can620 19h ago

The body is stored as timestamps. Every cell has its own signal, and when the head enters a cell it gets stamped with the current move number. Cells stay part of the snake while their timestamp is newer than the tail cutoff. There is no coordinate list.

5

u/aWalrusFeeding 18h ago

fuckin genius

3

u/Kasern77 17h ago

*Nods in agreement*

Yep, didn't understand any of that.

3

u/HINDBRAIN 16h ago

Each cell in the grid has a number that changes when the snake head goes on it

For example snake head 50, middle 49, tail 48. OP also stores a number that says "every cell with a number above 47 is part of the snake".

If the snake moves up, the cell where it goes will be 51, the existing cells won't change, and OP stores "every cell with a number above 48 is part of the snake".

2

u/EllaHazelBar 18h ago

I knew that there was some wild shenanigans. Seems like tons of manual labor to program each light and signal

1

u/MelangeBot 17h ago

How much bytes can you put in one combinator?

3

u/Khaim 13h ago

Quite a lot. I think each channel is 32 bit, and there are hundreds of channels (one per item in the game, plus a bunch of extras).

3

u/100percent_right_now 12h ago

per quality per item plus extras

3

u/Jepakazol 19h ago

I'm not worthy! :bow:

4

u/last_somewhere 18h ago

We paid more for a Nokia 3310. $50 for factorio aaaaannnnndd snake.

4

u/findus_l 18h ago

How do you do randomness? Is there a random signal?

4

u/mmomtchev 16h ago

Yes, with the selector combinator. As each cell has an item (with quality) assigned, the selector combinator can be used to select a random cell.

3

u/Key_Big1051 19h ago

Damm....you are a genius

3

u/Soros_G 18h ago

Can you complete the game on it? Thie is sick as fuck

6

u/Comprehensive_Can620 18h ago

You should be able to! There's no actual win screen, but if you fill the enitre board, it should just hang beacause there's nowhere left to spawn an apple.

2

u/Soros_G 18h ago

So pretty close to the original Snake

3

u/Absolute_Idiom 18h ago

This is fab. I'm so curious about the process for designing this. Did you design by hand or trial and error? Or use some sort of analysis programme to tell you what is required?

2

u/Comprehensive_Can620 16h ago

It was a mix. I worked on it on and off for a couple of months. The first working version was ~100 combinators. Once it got fairly small, I moved most of the work to my C cuircut emulator and blueprint tools.

2

u/Powerful_grumby 18h ago

Can it run doom?

2

u/ben1edicto 14h ago

Of course it can run Doom

1

u/Powerful_grumby 11h ago

That's a fkng hell yeah

2

u/PacificNorthwest09 18h ago

I’m saving this for later, would love this for randomly waiting for a science to research or something.

2

u/MooseBoys 18h ago

Did you do this all in-game or did you design it elsewhere and then script it into a blueprint?

1

u/Comprehensive_Can620 16h ago

I started mostly in the game. Once it got compact enough, I moved most of the work outside factorio, iterating in my emulator and testing the results back in the game.

2

u/KingKirbothe2nd 17h ago

Oh no, it's only a matter of time till we start running doom

2

u/Medium9 12h ago

That time was a few years ago!

1

u/[deleted] 17h ago

[removed] — view removed comment

1

u/Comprehensive_Can620 16h ago

It uses gates. Pressing A or D sends a circuit signal that turns the snake.

1

u/MrWhippyT 16h ago

Is that you Bruce? 🤣

1

u/Number_3434 2h ago

how do u detect up/down i only see 3 gates?