Computers will write code if the Programmers program them to do that. Computers are not going to do that "By themselves". It's always an algorithm in the Code.
Perhaps but my computer chess game , learned my moves , through my repetition , of the move . Eventually It anticipated my move .