# Asking ChatGPT to write an algorithm

## There is a lot of chatter now about the virtues of OpenAI’s new chat bot version, ChatGPT. It has a lot of practical uses. It can chat and it can write a biblical verse explaining how to remove a peanut butter sandwich from a VCR. But can it write some code? Let’s find out.

# Questions

`what is the best way to create an example of the Travelling Salesman problem?`

Imagine you want to go visit 10 cities as quickly as possible. But there are 100 different routes that you could take to get to each one, ranging in distances. How do you work out the shortest route to take? This is where the *Travelling Salesman Problem* comes in. There are many algorithms that can attempt a solution.

For now, this was my first question to ChatGPT. It’s answer was satisfactory. It wasn’t quite as good as the text-book explanation. But for an understandable and natural language explanation, it was outstanding. The answer was simple, to the point and understandable.

But it missed out some details like about how none of the mathematical solutions solve the problem. The issue is that an algorithm for the *Travelling Salesman*…