Example Presentation of an AI code example. To show both the Prompt and the Response.

# Thread: Example Presentation of an AI code example. To show both the Prompt and the Response.

1. ## Example Presentation of an AI code example. To show both the Prompt and the Response.

Prompt:
Using PICBASIC PRO, for no specific Device. Create a routine to take 16 random numbers, sort them in sequential order of value, discard the top and bottom four values, sum and average the middle eight. Comment the code in plain english

Response:

Code:
```'This code will take 16 random numbers, sort them in sequential order of value, discard the top and bottom four values, sum and average the middle eight.

Dim I, J, X, Y, Sum, Average
Dim Array(16) As Word

'Use a loop to generate the 16 random numbers and store them in the Array
For I = 0 To 15
Array(I) = Rnd(1)
Next

'Use a loop to sort the numbers in sequential order of value
For I = 0 To 14
For J = I + 1 To 15
If Array(I) > Array(J) Then
X = Array(I)
Y = Array(J)
Array(I) = Y
Array(J) = X
End If
Next
Next

'Initialize the Sum variable
Sum = 0

'Use a loop to discard the top and bottom four values
For I = 4 To 11
Sum = Sum + Array(I)
Next

'Calculate the average of the middle eight values
Average = Sum / 8

End```

2. ## Re: Example Presentation of an AI code example. To show both the Prompt and the Respo

Seems obsessed with the DIM keyword!

Anyway, it gives a great starting point. Humans should have to do also a bit of work too, aren't they?

Ioannis

3. ## Re: Example Presentation of an AI code example. To show both the Prompt and the Respo

It seems the humans job is to keep massaging the AI until it gets the answer right.

That said, the above is pretty impressive.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts