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


Closed Thread
Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Apr 2003
    Location
    Cambridge - UK
    Posts
    1,044

    Default 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
    Lester - Forum Administrator
    -----------------------------------
    www.crownhill.co.uk

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,025

    Default 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. #3
    Join Date
    Aug 2011
    Posts
    445

    Default 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.

Similar Threads

  1. Challenge & Response
    By retepsnikrep in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 31st December 2020, 12:30
  2. No program response, including config instructions
    By MillicentBear in forum mel PIC BASIC
    Replies: 10
    Last Post: - 2nd March 2017, 17:44
  3. DS1994 memory response problem
    By chika in forum Off Topic
    Replies: 7
    Last Post: - 28th March 2007, 23:35
  4. ad pot fastest response!
    By Alaskanphoenix in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 26th July 2006, 23:21
  5. No Modem response
    By jimboho in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 11th November 2004, 06:58

Posting Permissions

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