I'm writing a complicated Java program (for me, at least) and getting some bugs. I thought of something: why not have a program that can "guess" at the code you want if you step it through for test input and tell it what output you want at various stages? It could come up with likely code which would produce the answer you said and you would check to make sure. It would produce code as variations on simple looping and conditonal structures and if you wanted something more complicated (like for example if you wanted to use a library function) you would just write that line yourself and it would help fill in the blanks. Because looping and conditional structures are so predictable--if you had a human who looked at input and output with the information that they were built around loops and conditional structures, the human could probably figure out what was going on--I don't think it would be impractical to make a program that could do this. It could practically do it just by guessing--you could use evolutionary computing. Has someone already made this thing?