Skip to content
← Back to Community
Self-writing code
Profile icon
mcko7304

What if a computer could write its own code?

Answered by amasad [earned 5 cycles]
View Answer
Voters
Profile icon
omarhegazy5
Profile icon
stem10
Profile icon
Vandesm14
Profile icon
mcko7304
Profile icon
Kiroxxvxx
Profile icon
Abdirahman31
Profile icon
amasad
Profile icon
the_tootoo_guy
Comments
hotnewtop
Profile icon
amasad

Funny story, back in college I studied computer engineering instead of computer science at first because I thought software is a "solved problem". I thought that we'd be able to automate writing software, something like a wizard would take a user through creating the software they needed.

In hindsight that was silly, because if you think about it software is the last thing to be automated. Software is the language of automation. So if we automate software we'd be automating automation itself. This is the basis for what's called intelligence explosion. If an AI can change its own code then the first thing it will do is make itself more intelligent and so on.

Now I think that this kind of stuff is too far away. I've learned some philosophy along the way and realized we don't have a conceptual basis for intelligence, let alone consciousness. How are we going to create something we didn't start to understand?

Profile icon
mcko7304

@amasad
You have two computers with more or less the same code. CPU A and CPU B. CPU A is on, and CPU B is off. CPU A writes code to CPU B, and then turns CPU B on. CPU A turns itself off, and CPU B copies the new code to CPU A. CPU B turns CPU A on, they both run diagnostics, and CPU B turns off.
:)

Profile icon
amasad

@mcko7304 you could probably write a simulation of that on repl.it!

Profile icon
xenox

wouldn't this be the start of ai taking over??

Profile icon
Babbel

@xenox i don't think so. the developer will ever be able to decide what the ai can or can't do. i believe it's impossible to develop "real" intelligence. so if you don't allow your ai to do certain things, it can't do them. i mean, why should an ai extinguish humanity? you have to give it a purpose of life. i hope it's understandable. i don't know how to explain it better

Profile icon
IbraheemRodrigues

There’s already a bunch of research into neutral networks that can edit and design themselves. I remember seeing a Google talk about how they were using a master network to design slave networks which themselves were then trained, and they yeilded far more efficient and accurate results. I would not be surprised if large algorithms such as the infamous YouTube algorithm already uses these techniques. Many speculate there will soon be a day when all programming will be done by AI, we will merely need to supply a description.

Profile icon
the_tootoo_guy

Well maybe the god's of a.i will allow us

Profile icon
OmniShift

We bow to our near-omnipotent intelligent robot overlords

Profile icon
DanielTerner

This is a very interesting topic of discussion. I think over time this will become a reality and the computer will be able to write its own code. Nowadays there are a lot of applications that can write like a human. But still, people choose proven writing services. I recommend Edu birdie which is one of the best and I advise you to read their review.
I think soon digital technology will get to the point where people will be less needed in different fields.

Profile icon
[deleted]

You could do this in Python 3.8.1:

with open("self_code.py", "wt") as sc: sc.write("def main():\n\t") sc.write("print(\"Hello, World!\")\n\t") sc.write("pass\n\n") pass from self_code import main main()
Profile icon
optimistguy

if it is an AI

Profile icon
FARHEENPALAGIRI

There's this Indian movie called Enthiran that is pretty much this. The first robot built an army of other robots just like it and tried to take over the world.

Profile icon
cv88

Computers can write their own code! Very easily, in fact. Except, the ownership of the code, I think, will only pass to them if the complexity of the possibilities is not appreciated by the original author. My proposed solution to this is to use some kind of randomness function, and then the computer could truly write its own code. Of course, I don't think it would do anything very useful.

Profile icon
mcko7304

You have two computers with more or less the same code. CPU A and CPU B. CPU A is on, and CPU B is off. CPU A writes code to CPU B, and then turns CPU B on. CPU A turns itself off, and CPU B copies the new code to CPU A. CPU B turns CPU A on, they both run diagnostics, and CPU B turns off.

:)