Well... I'll just leave this here. (CGP Grey is awesome)
http://www.youtube.com/watch?v=7Pq-S557XQU
tldr: People are creating programs that are "learning". One of the biggest things they have setup right now is that it sees the initial, it sees the result, it tries to figure out how to get to that result state from the initial state. It's pretty fascinating research honestly.
I love R&D.
This is the same argument that farm workers made in the 19th century. Machines would render them jobless and when people would have no jobs who would buy all that produce? It's the same argument Americans make today about the rise of China. Chinese are stealing our jobs and when we have no jobs how are we going to buy stuff?
It doesn't work like that. Increases in efficiency result in lower prices. People now have more money to spend on other stuff so that leads to spending in other areas which propels demand for jobs there. Instead of agriculture you move into manufacturing. Instead of manufacturing you go into service sector jobs. That's the path every country has taken to achieve prosperity (It might change in the future though because some countries are skipping manufacturing and going straight into services)
Those who can't adapt to these changes suffer but humanity as a whole moves forward. This universe we live in is pretty big. If we develop machines that automate our lives on this planet then invariably that means we can start exploiting resources in space. It doesn't stop.