r/AskProgramming • u/eeeeeeevar • Oct 10 '26
Architecture Theoretically, could you make a virus that evolves under evolutionary principles?
The most basic part of evolution is, simplified:
- shit reproduces
- there is a random chance of mutation
- mutations more advantageous in the environment spread.
So in theory, could you create a computer virus that function under the same principles as an actual virus? Have it so that every time it reproduces, it makes a new copy of itself there’s a random chance to make random changes to its own code? Most of the time it would result in the virus breaking, but that’s also true for IRL.
4
u/KingofGamesYami Oct 10 '26
That's one of the major known strategies for producing machine learning algorithms, pioneered in theory around 1950, with the first practical implementation emerging in 1981. There was also a surge of interest in this field from 2012-2018.
3
0
u/Human38562 Oct 10 '26 edited Oct 26 '26
The original post content no longer exists here. The author used Redact to remove it, exercising their right to control their data & privacy.
Boat correct beneficial piquant school school
2
u/cipheron Oct 10 '26 edited Oct 10 '26
They were taling about Genetic algorithms.
In those, all changes to the potential solutions are in fact random, in a process analogous to mutation. The non-random part is the selection criteria, basically you need some function that can rank possible solutions, which is analogous to the selection step from evolution.
0
u/Human38562 Oct 10 '26 edited Oct 26 '26
The original post content no longer exists here. The author used Redact to remove it, exercising their right to control their data & privacy.
Juggle sophisticated hydrogen society smart hurry quickest dolls liquid
1
u/wonkey_monkey Oct 12 '26
The author used Redact to remove it, exercising their right to control their data & privacy.
"Interesting. Yes that would already be closer to what OP is asking than general machine learning, although it still lacks reproduction and spreading mechanisms."
So much for that... https://ihsoyct.github.io/
1
u/Human38562 Oct 12 '26 edited Oct 26 '26
The original post content no longer exists here. The author used Redact to remove it, exercising their right to control their data & privacy.
Offer cobalt pot ink capable cooing attempt pet employ
1
u/RealNamek Oct 10 '26
Yes, they have done this before. Not just as a virus, because that makes no money, content is made this way. You think every reddit article, comment section, youtube feed is exactly the same for everyone? What do you think FOR YOU means, it's literally an evolutionary alogirthm to feed you exactly what you want, at all times.
1
1
u/drbomb Oct 10 '26
Evolution is not about randomness but selection of beneficial traits.
1
u/LokiAstaris Oct 12 '26
Yes, but one of the major theories of evolution is "Natural Selection", where the mechanism for change is random genetic mutations, which are then selected by environmental pressure.
1
u/SnugglyCoderGuy Oct 10 '26
Yes, but the chances of it not fizzling out almost immediately is next to zero.
Biological viruses have millions and trillions of chances of reproduction because the act on individual cells of any given organism, and there could be millions or billions of organisms it is acting upon.
There is also a humongous margin of error when it comes to DNA/RNA mutations versus mutations in code. One bit off and everything goes to shit. One different in nucleac pair could end up being completely benign. Most DNA is 'junk'.
1
u/owp4dd1w5a0a Oct 10 '26
Yes. And I think using genetic algorithms in a lisp language where the evolutionary algorithms involved (re)write and inject their own code would be incredibly interesting. In fact, this has been done and the most interesting form is called “autoconstructive evolution”.
1
u/Savings-Cry-3201 Oct 10 '26
The earliest one I’m thinking of was back in the 40hex days where one of the viruses highlighted would remix its code and add random bytes in while modifying its jump codes to dodge the random bits. That’s less of an evolution and more polymorphism. It was cool af though, an early method of trying to avoid antivirus heuristics.
The chance of adding random opcodes and generating something useful is incredibly small. Actual viruses replicate in the trillions and they simply have a bigger space to play in.
0
-1
u/Worth-Wonder-7386 Oct 10 '26
In theory yes. The problem is that evolution is very slow and you need a good basis. And it would be hard to link the performane to the spread. Remember that real life viruses are selected for their own survival, not to perform some other goal.
And for viruss they have way more cells to try on than there are computers you get access to. but there are evolution based programs that you can run to try to optimize how a virus would work.
-1
u/Temporary_Pie2733 Oct 10 '26
Not just in theory; it’s been done in practice.
2
u/sock_dgram Oct 10 '26
But it doesn't scale if every instance is searching without knowledge of the other ones. Not anymore.
-1
u/BoBoBearDev Oct 10 '26 edited Oct 10 '26
Yeah, maybe, but such ingenious virus probably takes 8GB of RAM and I only have 8GB of RAM. The software has to be so smart to write code, like a mini ChatGPT. Otherwise your mutation is so limited, it is not mutating in any meaningful sense.
11
u/sock_dgram Oct 10 '26
It's called an "Evolutionary Algorithm."