Jump to content

Artificial Intelligence


JustinReno
 Share

Recommended Posts

I made this script a while ago, but never released because it was either too buggy or the general uselessness of it.

It has the simple ability for you to tell it random things and make it learn. Still, it has a far ways to go.

***Note***:

The INI structure is unique. You can add multiple inputs and outputs (If that makes sense.)

To add multiple inputs, separate them by a /. To add multiple responses, separate them by a |.

[brain]

Hello/Hi/Hey:Whats Up?|Hello|Hi

***Note***

Feedback is appreciated.

45 Lines of code.

Global $IniBrain = @ScriptDir & "\Artificial Intelligence Brain.ini"
Global $MultipleDefinitions
Global $GetInputFromBrain

$GUI = GUICreate("Artificial Intelligence by Justin Reno", 364, 314)
$Edit = GUICtrlCreateEdit("", 0, 0, 361, 257)
$Input = GUICtrlCreateInput("", 0, 264, 361, 21)
$Send = GUICtrlCreateButton("Send", 0, 288, 180, 25, 0x0001)
$AddNewThing = GUICtrlCreateButton("Add New Thing", 183, 288, 180, 0)
If Not FileExists($IniBrain) Then GUICtrlSetData($Edit, "Please click 'Add New Thing' to make me smarter. " & @CRLF & "I currently know nothing. :)")
GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case - 3
            Exit
        Case $Send
            If FileRead($IniBrain) <> "" Then
                $GetInputFromBrain = IniReadSection($IniBrain, "Brain")
                For $A = 1 To $GetInputFromBrain[0][0]              
                    If StringInStr($GetInputFromBrain[$A][0], "/") Then 
                        $GetIndividualInput = StringSplit($GetInputFromBrain[$A][0], "/")
                        For $B = 1 To $GetIndividualInput[0]
                            If GUICtrlRead($Input) = $GetIndividualInput[$B] Then
                                If StringInStr($GetInputFromBrain[$A][1], "|") Then
                                    $GetAll = StringSplit($GetInputFromBrain[$A][1], "|")
                                    $MultipleDefinitions = $GetAll[Random(1, $GetAll[0] + 1) ]
                                EndIf
                            EndIf
                            If Not GUICtrlRead($Input) = $GetIndividualInput[$B] Then GUICtrlSetData($Edit, "What?")
                        Next
                        If $MultipleDefinitions = "" Then GUICtrlSetData($Edit, $GetInputFromBrain[$A][1] & @CRLF)
                        If $MultipleDefinitions <> "" Then GUICtrlSetData($Edit, $MultipleDefinitions & @CRLF)
                    EndIf
                Next
            EndIf
            GUICtrlSetData($Input, "")
        Case $AddNewThing
            $GetResponse = InputBox("Artificial Intelligence", "Please type in the thing and a response. Example: Crap:Gross. Example 2: Crap:Gross|Eww|Haha. Example 3: Crap/Poop/Feces:Gross|Eww|Haha")
            If Not @error Then
                $GetBoth = StringSplit($GetResponse, ":")
                IniWrite($IniBrain, "Brain", $GetBoth[1], $GetBoth[2])
            EndIf
    EndSwitch
WEnd
Link to comment
Share on other sites

haha, nice. I was thinking of doing somting like this a while back, except I was going to implement it into a website type thing that was basically a chat room. Then I'd have it watch the conversations and pull appropite responses from that. Then see if I could get it to pas of as a human user. Then I remembered I don't have that kind of time...

[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Link to comment
Share on other sites

  • 7 months later...

I found out and tried an experimental Turing Test on the web, and I've talked to Eliza the Therapist before. There both cool! :P

MegaHAL is even COOLER!

A.I. has always been fascinating. I wonder though, about how one would go about it seeing as AutoIt is single threaded?

It would be neat to see a Port of MegaHAL or even ELIZA done in AutoIt.

01000001 01110101 01110100 01101111 01001001 01110100 00100000
An immortal object must be copied, so that we get a mortal copy of it, since we try not to destroy immortal objects.
Link to comment
Share on other sites

This is offtopic but How do I run MegaHAL?

Go to http://megahal.alioth.debian.org/download/old/ and get the win95.zip (66Kb) for windows, extract to a folder then run megahal.exe Its a Command Line Interface (CLI)

When MegaHAL is started it has no knowledge of language, and is unable to give a reply at all; the program needs to be trained using a source of text, so just start typing sentences into it... before long it will begin to reply on its own :P

Also on the MegaHAL site there are personality files you can put into it. You might even make your own based on those.

The MegaHAL Source is available on the site as well. I'm hoping someone will do an AutoIt port of it if at all possible :( I'd do it but I still have a lot to learn about AutoIt :) so it may be a whiles yet.

We had it working after a fashion on Yahoo! Chat the other day as a dry beta run thru YahELite :idea: It was hilarious fun.

Apologies for being Slightly offtopic... But man AI is fun!

01000001 01110101 01110100 01101111 01001001 01110100 00100000
An immortal object must be copied, so that we get a mortal copy of it, since we try not to destroy immortal objects.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...