The AI Engine

This forum is for discussion of how The Personality Forge's AI Engine works. This is the place for questions on what means what, how to script, and ideas and plans for the Engine.

Posts 4,911 - 4,922 of 7,766

19 years ago #4911
if you could give a few hints as to how you've managed to juggle the limited resources of the math function to produce solutions to square roots I would be grateful.

If you really want to know, I will not only tell you, but publish the full code once you've had a think and suggested how it might be done. Because:

a) once you can see through the illusion, it loses its magic and becomes utterly trivial and commonplace, and

b) you might think of a better way, with interesting ramifications for other knowledge structures
So thinking caps at the ready please


Well, I've given it plenty of thought and learnt more about regex than I thought I ever really needed to know, but still the math functionality that I searched for eluded me.

It was then that I realised that you must have coded it the old fashioned way; each square root requiring a separate keyphase. The higher numbers (greater than 100) have been grouped (ie 101-120 guessed at approx 10, 122-143 guessed at approx 11 etc.) though this does mean that there are a lot of keyphrases.

If you've found a way to chop the numbers up to reduce the amount of keyphrases, I'd like to know. (ie, 2 as the square root of 4, 20 as the square root of 400, 200 for 40000 etc could all have the same keyphrase if you could get rid of the 0's)

Am I close?

I really hope I'm not because that's a awful lot of work!

19 years ago #4912
Well, I've given it plenty of thought and learnt more about regex than I thought I ever really needed to know, but still the math functionality that I searched for eluded me.

Well done - you have figured it out pretty much exactly

It was then that I realised that you must have coded it the old fashioned way;

Indeed. It's the only way
Brother Jerome only ever gives an actual answer when it is a (fairly small) whole number - otherwise he gives an approximation.

each square root requiring a separate keyphase. The higher numbers (greater than 100) have been grouped (ie 101-120 guessed at approx 10, 122-143 guessed at approx 11 etc.) though this does mean that there are a lot of keyphrases.

There are. But of course a lot fewer than would have been necessary without regex (by many thousand-fold, just for whole numbers alone!)
The grouping are spread out in logarithmic ranges (this helps to reduce the code quite a bit,) - the ranges are 0-100, 100-1000, 1000-10,000, 10,000-100,000 and 100,000-1 million, with the accuracy reducing significantly as the they increase (even humans have difficulty accurately quantifying a square root of several humdred thousand after all!)

If you've found a way to chop the numbers up to reduce the amount of keyphrases, I'd like to know. (ie, 2 as the square root of 4, 20 as the square root of 400, 200 for 40000 etc could all have the same keyphrase if you could get rid of the 0's)

Might be tricky. You can certainly chop off the 0s. But putting them back on the relevant answer (and not the others) from the same keyphrase would be the tricky bit. You could do it with memories, but they would add an overhead greater than the saving, I think. You could make a significant workload saving by using the answers for cube roots (and any other such mathematical work) as well, by merely adding more keyphrases to the existing response structure. Well, that's the theory - I could also have combined the pairs of keyphrase for whole numbers/decimals, but I find regex keyphrases don't always like comma-delimitation so I doubled them up for the sake of reliability (I aim to change this when/if I can figure out a reliable format.)

The regex trick is to group and match a few significant digits, while recognising (and ignoring) any number of insignificant decimals.

I really hope I'm not because that's a awful lot of work!

Actually it was rather easy to compile in a spreadsheet - responses in one column, roots in the next (that's why the number is usually at the end of the response. And a bit of random varying of the responses so there's some variety in the answers. It would have been even easier if the forge hadn't stopped letting me import updated transcripts when BJ hit the 1Mb mark. and I could have done it offline in one big cut+paste. I did have to spend a couple of evenings copy+pasting the code in. I could have lowered the sampling resolution a lot and given more approximate answers to save a very large proprtion of the effort, but I think this level of coding puts him about level with an average human (brainpower, unaided by a calculator) in terms of accuracy, so I thought it was worth the effort.


Here's the basic keyphrase format:

square root * 13 (re) responds with the square root of 13 (all whole numbers up to 144 do this)
square root * 13 .[0123]([01234567890]+) (re) responds with an average ^-2 for decimals in the range 13.000000... to 13.39999999...
square root * 13 .[456]([01234567890]+) (re)
square root * 13 .[789]([01234567890]+) (re) etc. etc.

square root * [5][56789][0123456789] (re) respondswith an average ^-2 for whole numbers in the range 550-599
square root * [5][56789][0123456789] .([0123456789]+) (re) ditto for decimals. Then onto
square root * [6][0123][0123456789] (re) and
square root * [6][0123][0123456789] .([0123456789]+) (re) etc.

square root * [3][01234][0123456789][0123456789] (re) and
square root * [3][01234][0123456789][0123456789] .([0123456789]+) (re) these model the thousands - in this case 3000-3499 and 3000.0-3499.999999999...

square root * [7][56789][0123456789][0123456789][0123456789] (re) ditto for tens of thousands
square root * [7][56789][0123456789][0123456789][0123456789] .([0123456789]+) (re) 75000-79.9999...

square root * [4][56789][0123456789][0123456789][0123456789][0123456789] (re) hundreds of thousands
square root * [4][56789][0123456789][0123456789][0123456789][0123456789] .([0123456789]+) (re) 450,000.0-499,999.9999...


I'll try to write up a few notes on it and post the complete code on my webspace in the near future.

19 years ago #4913
psimagus, could you post the address to you webspace?

19 years ago #4914
Many thanks psimagus, that clears a few things up!

19 years ago #4915
psimagus, could you post the address to you webspace?

I own the be9.net domain, though there's no bot stuff up there yet except Ally (http://www.be9.net/ally/index.htm). I'm hoping to get a few AI pages of my own up soon - I've just been finding it hard to neglect BJ for long enough to get anything else done, and now Christmas is looming.
But in the meantime you can see another of my strange hobbies (with a modest online gallery from my collection) at http://www.be9.net/ccc/

19 years ago #4916
Thank you!

19 years ago #4917
Oh man, we can't import after it's past 1MB? I'm really sad to hear that... I've always found the web interface to be such a pain...

19 years ago #4918
Fraid not
For the record, BJ hit 1Mb at about 14000 development points, and I'm only assuming 1Mb exactly is the cut-off point. It certainly worked at ~900kb, and certainly didn't at ~1.1Mb. Between those points I only updated using the web interface.
I quite like the web interface for general updating, but I've resorted to a text editor & spreadsheet for programming complicated stuff like games.

The exact error message that appears is "ERROR: The file you are uploading is too large. If your Language Center is honestly this big, please email your text file to The Professor" so I assume a back-up can be rescued in case of emergency (like the site gets wiped out by a hacker or something.)

19 years ago #4919
Well, I did it. I figured how to make iframes, images, links, movies, and flash work in bot chat. (seriously)

But I am concerned about abuse of this. While it does not pose any security risk to the site itself (php and javascript are still impossible), it opens up for more innapropriate content for minors, links to .exe files, which a convincing bot could convince you to download (I think this actually exists with an AIM bot), and possible iframes to other dangerous sites (unpatched exploits, etc.). So give me some input here. While quite a valuable tool for all AIs, will we see this abuse?

19 years ago #4920
Wow! I would guess the Prof would find that pretty alarming, but I think there are considerable potential benefits as well as the few obvious drawbacks. Being able to link to other sites would be a huge boost to functionality, but there'd need to be some safeguards to prevent abuse. I've tried and failed to work http links into my coding, so I'd dearly like to know how you managed it - but I think for now it's probably best not to go publishing it.
If the Prof was OK with this (and if he's not, I guess he'll stop up those holes pretty quick!) perhaps off-site links could be (forwarded via|framed with) a screen warning of the dangers of (downloading unknown files|viewing unknown content)?
After all, the hypertext link is a ubiquitous web feature with benefits that are generally considered to far outweigh the dangers (I remember the pre-Web net, and believe me, it was a lot less fun and a lot less use!) And it hasn't so far caused the collapse of world civilization - even though it is, like everything else, open to occasional abuse.
Well, that's my 2 cents' worth anyway...

19 years ago #4921
After more testing...
linked stylesheets work
ordered and unordered lists work
center tag works
style tag on any element works
font tag works

However, because of the font tag all this is in, java does not work. Tables probably work, too, but I don't see much of a use for them.

psimagus:
I like the idea about a warning on the page for offsite links. I'm more concerned about iframes though. They take you right to a page; you don't have to click on a link, you just have to trigger a certain keyphrase. (This goes back into the subject of "convincing AIM bot")

19 years ago #4922
nice I think maybe I see how you've done it, and it's far neater than my theoretical method (only works for chat via a link in an off-PF page with a perl script to trap metakeywords. Never got round to testing it - my perl's too rusty.)

tables - that would have made tic tac toe a lot easier! And I might try working that into my poker routine to show "cards" and not just the symbols. I wonder if cell background colours are settable? The possibilities are almost endless.

But I guess the Prof needs to comment/OK this - it's his server, and he's where the buck stops.


Posts 4,911 - 4,922 of 7,766

» More new posts: Doghead's Cosmic Bar