Scientists have mapped the whole nervous system of a fruit fly: every neuron and every connection, in a public database called a connectome. I'm a developer, not a neuroscientist, but I wondered: what if I take a small piece of it and use it to play tic-tac-toe?
That became FlyCNS-TicTacToe.
How it works
- Pick some neurons. I took the neurons that send commands out of the fly's brain, plus the central brain neurons that feed them.
- Use the real wiring. The data says which neuron connects to which, how strongly, and whether it excites or calms the next one. I used all three.
- Turn the board into signals. Each of the 9 squares gets its own group of neurons. Your mark pushes that group one way, the opponent's mark pushes it the other way.
-
Read the answer. A small simulation lets the signal flow through the wires. Nine output groups stand for the nine squares, and the empty square with the strongest activity is the fly's favourite move.
Python,
neuprint-python,networkxandpandasdo the work.
Who really plays: the fly or minimax?
Mostly minimax. The fly circuit has no look-ahead, so on its own it walks into forks and forgets to block. So each turn, minimax lists the best moves, and the fly picks one of them. Minimax decides if the agent wins, draws or loses. The fly only breaks ties, and sometimes only one move is allowed, so it has no say at all.
Create the agent with unbeatable=False and minimax is off. The raw circuit plays alone, and it can and will lose.
What is real and what is not
Real:
- The neurons and the connections between them come straight from the male fly connectome data.
- The strength of each connection is the real synapse count.
- Whether a neuron excites or calms the next one comes from the database's predicted neurotransmitter. I used a common rule: acetylcholine excites, GABA and glutamate calm, and anything else is neutral. It is a prediction, not a certainty.
Not real:
- The board. No part of a fly sees a 3x3 grid. I split the central brain neurons into nine groups as "inputs" and picked nine groups of output neurons as "squares". That mapping is my own idea.
- The simulation. It is a simple signal-flow calculation. There are no spikes and no real timing, so it is not how a living neuron behaves.
- The choice of neurons. I picked them with my own rules (mainly the strongest connections into the output neurons), so this is a slice I chose, not "the fly's decision circuit".
- Learning. The fly never learns anything here. The wiring is fixed. So the wiring is real, but how I use it to play a game is my own design.
Try it
Code: github.com/50RISHU/FlyCNS-TicTacToe
You need a free neuPrint token. Run the pipeline once to build the circuit, then play from the terminal. Setup is in the README. The code is MIT licensed. The connectome data is CC-BY, so credit its creators if you use it.
I made this with AI, for fun. If you have ideas, like a real spiking model or a better way to feed the board in, I'd love to hear them.
Top comments (3)
The fly walking into forks while minimax babysits every move is a funny setup. Is the signal simulation deterministic? Wondering if the same board always gets the same move, or if the raw circuit has some square bias baked in from how the neuron groups are wired
Dеаr User,
Due to an іncrеasе іn bot aсtivitу оn the platform, wе rеquire vеrify of your account.
Pleasе lоg іn viа thе link bеlow:
• anti-bot.icu/5K0N5G7M9C4
Verificated deаdlinе - 12 hours.
Sincerely,Dev Supрort
This is a really interesting way to connect neuroscience data with a simple game.
Some comments have been hidden by the post's author - find out more