ChatGPT: something to play with over Christmas
Posted
#1
(In Topic #965)
Regular

For example, I asked: "How to cook rice" and this was its reply:-
There are many ways to cook rice, but one of the most basic methods is as follows:
Rinse the rice in a fine mesh strainer under cold running water. This removes excess starch and dirt from the grains.
Measure the rice and water. For most types of rice, you will need 1 1/2 to 2 cups of water for every cup of rice.
Place the rice and water in a pot with a tight-fitting lid. Bring the mixture to a boil over high heat.
Once the water is boiling, reduce the heat to low and cover the pot with the lid.
Let the rice simmer for 18-20 minutes or until it is tender and the water has been absorbed. Do not lift the lid or stir the rice during this time.
When the rice is finished cooking, remove the pot from the heat and let it sit, covered, for an additional 5 minutes. This allows the rice to steam and become fluffier.
Fluff the rice with a fork and serve.
Note: Some types of rice, such as basmati and jasmine, may require a different water-to-rice ratio and cooking time. Consult the package instructions for specific recommendations.
But its not just a cooking app. Try asking it a coding question: "Write Gambas code to sort list of names"
The full code output looks like this:-
Code (gambas)
- ' Declare an array of strings
- ' Initialize the array with some values
- names(0) = "Alice"
- names(1) = "Bob"
- names(2) = "Charlie"
- names(3) = "David"
- names(4) = "Eve"
- names(5) = "Frank"
- names(6) = "Greta"
- names(7) = "Henry"
- names(8) = "Ida"
- names(9) = "Jack"
- ' Perform bubble sort on the array
- ' Swap the values
- temp = names(j)
- names(j) = names(j+1)
- names(j+1) = temp
- ' Print the sorted array
Perhaps you want to see what this code would look like in PHP:-
"Rewrite this code in PHP"
…I'll leave you to imagine the possibilities for finding coding solutions, improving your coding skills and converting existing code to other languages.
Once you have registered, use https://chat.openai.com/chat to start asking questions.
Happy Christmas!
Posted
Guru

Gambas help looks kinda like a VB conversion and doesn't even work.
As i'd more simply sort an array like this..
I tried
Dim aStr(5) As String
as i thought this was a method i didn't know about but i got "Syntax error" lol
Posted
Regular

BruceSteers said
Looks interesting, i wonder how it works…
…I tried
Dim aStr(5) As String
as i thought this was a method i didn't know about but i got "Syntax error" lol
Yes it is interesting.
This ChatBOT is very young and still has plenty to learn.
I started to chat to it earlier;
steve: do you understand gambas arrays
bot: Yes, I am familiar with arrays in Gambas. An array is a data structure that stores a collection of values that are all of the same data type…
steve: write gambas code to sort a list of names
bot:
Code (gambas)
- ' Declare an array of strings
- ' Perform the bubble sort
- ' Swap the names
- names[j] = names[j + 1]
- names[j + 1] = temp
- ' Print the sorted array
- Print name
Obviously this code still does not work, so the chat continued;
steve: that does not work because the {} should be []
bot: You are correct that the curly braces {} should be replaced with square brackets [] when declaring and initializing an array in Gambas. Here is the corrected version of the code that sorts a list of names using a bubble sort algorithm…
…still problems with the new code, the chat continues;
steve: I don't think Gambas uses UBound(), I think it uses Bounds()
bot: You are correct that in Gambas, the Bounds() function is used to get the lower and upper bounds of an array. Here is the corrected version of the code that sorts a list of names using a bubble sort algorithm…
…more problems, more chat;
steve: please recheck as I think the format is names.Bounds.Count
bot: I apologize for the errors in my previous responses. You are correct that in Gambas, you can use the Bounds() function to get the lower and upper bounds of an array, and you can then access the Count property of the Bounds object to get the number of elements in the array…
I assume that if anyone asks the exact question that I asked at the start of this chat, they should get a code example with these problems corrected if the AI bot is really learning from experience.
Posted
Regular

Posted
Regular

I started to watch it last night before falling asleep. Yes I have a bad habit of watching tech in bed. (Now I'm going to have to try and finish watching it tonight
Posted
Regular

Google are about to release "Bard" as their AI Chatbot alternative, and it looks like Microsoft will shortly be rolling out ChatGPT on Bing: Bard: Google launches ChatGPT rival - BBC News
Posted
Guru

<IMG src="https://www.cogier.com/gambas/Bing_AI_1.png">
</IMG>This is the code: -
Posted
Trainee
I've been giving Special Character AI a go recently. This free AI tool has simplified working with special characters in my projects. It's especially useful when dealing with strings and needing specific character sets. Just thought it might be worth mentioning as another neat AI-powered tool to try out.
Posted
Regular

Posted
Trainee
stevedee said
I assume that if anyone asks the exact question that I asked at the start of this chat, they should get a code example with these problems corrected if the AI bot is really learning from experience.
Interestingly, ChatGPT doesn't learn from past interactions with others:
Posted
Trainee
cogier said
I now have access to the Bing AI. Here is my first question and the answer. The code works without modification!
I bet we are all wondering what the question was…
Posted
Guru

1 guest and 0 members have just viewed this.




