QB64 Phoenix Edition
Ideas for Simple A.I. Builds - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: Chatting and Socializing (https://qb64phoenix.com/forum/forumdisplay.php?fid=11)
+--- Forum: General Discussion (https://qb64phoenix.com/forum/forumdisplay.php?fid=2)
+--- Thread: Ideas for Simple A.I. Builds (/showthread.php?tid=2994)



Ideas for Simple A.I. Builds - Pete - 08-30-2024

So part of A.I. is getting a computer to exhibit critical thinking.

I guess we could start off with some rudimentary approaches, for example:

Code: (Select All)
Randomize Timer
Palette 7, 63
Color 0, 7: Cls
View Print 1 To 23
Dim As Integer red, green, blue, mred, mgreen, mblue, i, cnt, pass(3)
score = 100
Do
    cnt = cnt + 1
    red = Rnd * 10 - 4
    green = Rnd * 10 - 6
    blue = Rnd * 10 - 8
    i = Int(Rnd * 3) + 1
    Print i;
    If pass(i) Then action$ = "Pass" Else action$ = "Catch"
    Select Case i
        Case 1
            Color 4, 7: Print "RED "; red; action$
            If action$ = "Catch" Then
                score = score + red
                mred = mred + red
            End If
        Case 2
            Color 2, 7: Print "GREEN "; green; action$
            If action$ = "Catch" Then
                score = score + green
                mgreen = mgreen + green
            End If
        Case 3
            Color 1, 7: Print "BLUE "; blue; action$
            If action$ = "Catch" Then
                score = score + blue
                mblue = mblue + blue
            End If
    End Select
    Color 0, 7
    x = CsrLin
    Locate 25, 1: Print "Score = "; LTrim$(Str$(score)); "    ";
    Locate x, 1

    If cnt = 10 Then
        If mred < mblue And mred < mgreen Then If pass(2) + pass(3) <> 5 Then pass(1) = 1 ' Don't catch red apples.
    ElseIf mgreen < mred And mgreen < mblue Then If pass(1) + pass(3) <> 4 Then pass(2) = 2 ' Don't catch green apples.
    ElseIf mblue < mred And mblue < mgreen Then If pass(1) + pass(2) <> 3 Then pass(3) = 3 ' Don't catch blue apples.
        cnt = 0
    End If
    Sleep
    If InKey$ = Chr$(13) Then Run
Loop

The computer memorizes and evaluates values, and decides to only catch red apples, fairly soon.

Refinements would include ways to deduce this faster, and to widen the sampling if we gave it feedback using greater variance with its results vs the best possible outcome. I mean real A.I. means the computer would keep refining its calculation method until it reached the most efficient method.

Anyway, just having some fun and wondering if anyone else has made anything along A.I. lines they would like to share, or just discuss in this thread.

I'll be back a bit later today to catch up!

Pete


RE: Ideas for Simple A.I. Builds - Kernelpanic - 09-01-2024

@Pete it's nice, but it is just an adding back and forth, but in my opinion it's illogical. The AI is squeaking somehow. It would to be oiled.  Big Grin

PS: That is an AI-Program:

Code: (Select All)

'Humorvolles Beispiel fuer die KI - 1. Sept. 2024

Option _Explicit

Dim As Integer zahl1, zahl2, summe

Print
Input "Enter a number between 1 and 10: ", zahl1
Input "And another number            : ", zahl2

summe = zahl1 + zahl2

Print: Print
If zahl1 > 10 Or zahl2 > 10 Or Zahl1 < 1 Or Zahl2 < 1 Then
  Beep: Print "Idiot! Between 1 and 10! - Do you think I don't notice?"
Else
  Print Using "The sum is: ##"; summe
  Print "That is AI"
End If

End



RE: Ideas for Simple A.I. Builds - SMcNeill - 09-01-2024

If you're interested in AI and how it works, here's a dern good site -- and a crapload of AI tools which they create and maintain that are 100% free:

https://perchance.org/tutorial


It's too much to copy/paste, and I'm not even going to try.  FOLLOW THAT BLEEPING LINK!!!!

Here's the very basic intro of the start of things:

Quote:Perchance is all about lists. You simply create lists of different things and then reference the lists from one another. For example, we could create a list of animals, and a list of sentences, and then use the animals list within the sentences list like so:

animal
pig
cow
zebra

sentence
That [animal] is very sneaky.
I befriended a wild [animal] yesterday.


Quote:We could easily add another list to our previous example called "adjective" and then use [adjective] within our sentences to make them more random and complex:

...

adjective
  sneaky
  happy
  furry
 
sentence
  That [animal] is very [adjective].
I befriended a very [adjective] [animal] yesterday.
We could also create another list called "paragraph" like so:

paragraph
[sentence] [sentence] [sentence]

Quote:Perchance allows you to create "lists of lists" by indenting your items appropriately. This may seem unusual at first, but as you explore Perchance's more advanced features you'll see that it can sometimes be useful. Here's an example of a multi-level list called "animal":

animal
mammal
kangaroo
pig
human
reptile
lizard
crocodile
turtle
insect
spider
beetle
ant
The result of [animal] will be "mammal", "reptile" or "insect" with equal likelihood (since we haven't added any likelihood indicators on those items). The result of [animal.mammal] will be either "kangaroo", "pig" or "human", with equal likelihood.



And if those aren't sample enough of it talking about how they structure things and create their AI, then you're not really interested in learning about it and don't need to bother with it all.


It's all basically the same way ELIZA used to do with AI Chat, but hyped up with lists upon lists upon lists upon lists to the extreme.

You say:  I like green cars.

It basically breaks that down to [subject][action][adjective][noun].

It can now respond via a list on any of those items.
[subject]  = I...  What does it know about the fellow named "I"? 
response:  You also like cheese, don't you?

[action] = like...  What does it know about the action called "like"?
response:  I like fluffy dogs.

[adjective] = green....
response:  I like The Incredible Huck, he is also green.

[noun] = cars...
response:  I like fast cars!

It's all about those lists that it creates and stores, and how it cross-references and assigns various probabilities and such to it all.  FOLLOW THAT LINK, if you're interested in all that type junk!!  They basically start at the very basic concepts and expand upon it step by step, in a manner that YOU, as a programmer could even create your own AI, if you just had enough time to start making lists and cross-referencing them one to another to another... Wink


RE: Ideas for Simple A.I. Builds - JRace - 09-02-2024

Wow.  Bookmarked.

One could create one's own MadLib filler-outer.


   


RE: Ideas for Simple A.I. Builds - SpriggsySpriggs - 09-06-2024

Ooooh, it would be cool to use an AI like Gemini in a QB64 game. I'm not sure if it remembers between calls in the API, though. Hmmm... You could almost make a chess game with it. Use the board coordinates and then when it responds with its move, you can plot the piece on the board and play with the AI.


RE: Ideas for Simple A.I. Builds - Pete - 09-06-2024

Or you could just make an A.I. video...

Hey everybody, let's dance!


https://x.com/BasedMikeLee/status/1823581650653204750