Discuss Scratch

StarscreamClone
Scratcher
1000+ posts

Online Turing Test -- In Need of Some Coding Help

In the event that you do not know what a Turing test is, here is a quick description.

The Turing test– named for Alan Turing– consists of three people– an interviewer, a human (Subject A), and a robot (Subject B). The interviewer does not know which subject is the human or the robot, and so what they do is ask each one any question of his/her choice until they decide which is the robot. It is believed that a robot able to convince an interviewer that he or she (depending on the programming) is a human, they are considered intelligent. Well, the same was said for a robot who was able to beat the world chess champion, but when Deep Blue defeated Gary Kasparov, people still weren't convinced. Alright, I know I'm rambling, but you get the idea of the test.

So, what I want to do is create a Turing test (or variation of it) on Scratch. I have a couple coding issues here, and I would like your help if possible.

1. The first one that came to mind is having the AI program itself search text for certain things. I know you can do this in JS, but for Scratch, I wasn't so sure. For example, I would like him (yes, I will refer to the program as a ‘him’) to search the text of the interviewer's question for his name so he can respond appropriately in some cases.
ie.
Interviewer: Hey, (program name)?
Program: Yes, what do you need?

But then, if I can do that, that brings up another issue: what if his name is included, but I don't want him to respond with that? This was an issue I found in Alice that I think contributed to her failure in the Turing test (as well as the inability to hold a conversation without becoming suddenly sidetracked, but that's an issue to address later). I think I could figure this out when I figure/find out the code for the first issue, but I'll leave this up here just in case.

2. The next issue is for the cloud. Evidently, if I were to use the approach used in the description of the original Turing test, I would a) need cloud lists and b) need to make a whitelist of words so the interviewer's questions remain within the parameters as set by the Community Guidelines. I am fairly certain I have heard about DIY cloud lists, and if someone could either walk me through it or link me to a project explaining it, I would be most appreciative. For issue b, the same basic thing applies.

3. Next up, how would one set up a way to have different ‘rooms’ so that there can be several sets of interviewers and subjects at the same time?

4. Finally, and probably the least important, how could one be able to have it so that users can pick icons and similar such things to be displayed to others in the same ‘room’?

Thank you very much for your patience and any such help you can provide. If your solution works, I will be sure to mention you in the project notes.
~ Dark Surge

Somewhere in my 20s | He/It
Workin' on my degree in computer science and cognitive science, and the future president of 2036!

Surge is my imaginary husband - he's the guy in my icon!
drmcw
Scratcher
1000+ posts

Online Turing Test -- In Need of Some Coding Help

Check out the Eliza project in my signature. It's a Scratch version of what may have been the first chat bot. Scratch isn't too good when it comes to string manipulation but maybe some of the procedures in there may be of use?

Last edited by drmcw (Dec. 12, 2013 22:25:35)


10 !
ScratchVaders or Galaga?
Maybe Eliza can help you decide?
StarscreamClone
Scratcher
1000+ posts

Online Turing Test -- In Need of Some Coding Help

drmcw wrote:

Check out the Eliza project in my signature. It's a Scratch version of what may have been the first chat bot. Scratch isn't too good when it comes to string manipulation but maybe some of the procedures in there may be of use?
Ooh, I've heard of Eliza! Simon and Newell developed the original, right?
Thank you! I will indeed look into it!

Somewhere in my 20s | He/It
Workin' on my degree in computer science and cognitive science, and the future president of 2036!

Surge is my imaginary husband - he's the guy in my icon!
drmcw
Scratcher
1000+ posts

Online Turing Test -- In Need of Some Coding Help

StarscreamClone wrote:

Ooh, I've heard of Eliza! Simon and Newell developed the original, right?

ELIZA was written at MIT by Joseph Weizenbaum between 1964 and 1966


10 !
ScratchVaders or Galaga?
Maybe Eliza can help you decide?
StarscreamClone
Scratcher
1000+ posts

Online Turing Test -- In Need of Some Coding Help

drmcw wrote:

StarscreamClone wrote:

Ooh, I've heard of Eliza! Simon and Newell developed the original, right?

ELIZA was written at MIT by Joseph Weizenbaum between 1964 and 1966

Right right right. DER. That wasn't even in the section of the book with Newell and Simon… X'D It was in with Alan Turing! Oh, gee, Surge, what makes you think that, huh?

Anyway. Quite. Ignore me. I need to get my facts in order… XD

Somewhere in my 20s | He/It
Workin' on my degree in computer science and cognitive science, and the future president of 2036!

Surge is my imaginary husband - he's the guy in my icon!
ErnieParke
Scratcher
1000+ posts

Online Turing Test -- In Need of Some Coding Help

I should be able to help with the first problem. What you need to do is:

  • Parse a user's response into words // Scratch Wiki Link
  • Look at those words and see if any are key

There are two ways to do this. One involves combining the two into one script, and the other involves a more organized approach, but maybe slightly slower. Anyway:

set [letter# v] to (1)
set [word v] to []//This is empty.
delete [all v] of [words v] //Clears all the words.
add [] to [words v]
repeat (length of (string)) //Repeats the amount of letters in the string.
if <(letter (letter#) of (string)) = [ ]>
add (word) to [words v]
if ([names v] contains (word)) then
//AI response
end
set [word v] to []
else
set [word v] to (join (word) (letter (letter#) of (string)))//Word is the word being processed
end
change [letter# v] by (1) //Moves on to the next letter
end

Or:

set [letter# v] to (1)
set [word v] to []
delete [all v] of [words v]
add [] to [words v]
repeat (length of (string))
if <(letter (letter#) of (string)) = [ ]>
add (word) to [words v]
set [word v] to []
else
set [word v] to (join (word) (letter (letter#) of (string)))
end
change [letter# v] by (1)
end
set [i v] to (1)
repeat (length of [words v])
if ([names v] contains (item (i) of [words v])) then
//AI response
end
change [i v] by (1)

Unfortunately, thanks to all the seating in lists, you'll have to be careful how complex you go; this is going to be a CPU heavy project.

As for #4, this shouldn't be too hard if you have #3. All you need is a variable (Icon) and a sprite with all icons possible. That sprite should be switching to the (Icon) of the user, and the variable should be stored along with any information the user/bot has.

Helping,

ErnieParke

StarscreamClone
Scratcher
1000+ posts

Online Turing Test -- In Need of Some Coding Help

Ah, Ernie, you never cease to be of extreme help.

Alright, so this is a bit of a stupid question, but do you think you could explain how lists work (or provide a link)? I've been in the dark of that forever… Anyhow, thank you very much.

Somewhere in my 20s | He/It
Workin' on my degree in computer science and cognitive science, and the future president of 2036!

Surge is my imaginary husband - he's the guy in my icon!
ProdigyZeta7
Scratcher
1000+ posts

Online Turing Test -- In Need of Some Coding Help

StarscreamClone wrote:

how lists work (or provide a link)?
Like any list in real life. You can add to it, you can take away from it, you can replace things in it. If you practice coding, lists become an instant favorite to use.

Like for instance, let's say I want to separate the letters of an inputted word:
define Separate word (word)
delete (all v) of [letters v] //start with an empty list
set [letter v] to [1]
repeat (length of (word)
if <not <[letters v] contains (letter (letter) of (word))>> //does the list already have that letter?
add (letter (letter) of (word)) to [letters v] //adds that letter to the end of the list
end
change [letter v] by (1)
end
Then, as an advanced technique, let's say I want to put them in alphabetical order:
define Alphabetize
set [item v] to [0]
repeat until <(item) = (length of [letters v])> //"length of [list] returns how many items are in the list
change [item v] by (1)
if <<(item) < (length of [letters v])> and <(item (item) of [letters v]) > (item ((item) + (1)) of [letters v])>> //if the selected item > next item
add (item (item) of [letters v]) to [letters v] //pushes a duplicate of the item to the bottom of the list
delete (item) of [letters v] //removes the selected item
set [item v] to [0]
end
end
Without lists, these scripts wouldn't be possible!



ErnieParke
Scratcher
1000+ posts

Online Turing Test -- In Need of Some Coding Help

StarscreamClone wrote:

Ah, Ernie, you never cease to be of extreme help.

Alright, so this is a bit of a stupid question, but do you think you could explain how lists work (or provide a link)? I've been in the dark of that forever… Anyhow, thank you very much.
Ah, thank you a lot for that. :)

Anyway, although ProdigyZeta7's intro is nice, I thought that I might as well make one as well. Let me try my hand at it:

Let's say it's an ordinary day with aliens attacking from outer space. Your mom wants you to go grocery shopping, and hands you a variable of what you should get:

  • CakeCheeseMilkButter

It's pretty easy to read, right? But let's say your mom loves being specific about everything. This is your new variable:

  • 3IbVanillaCakeSwissCheese1pntMilkCreamButter

It's still somewhat easy to read, but not easy at the same time. Now, let's say your dad wants to buy 100+ things for the car he's building, and he also loves being super specific about model, year, metal, seller, ect.. (please save me from this onslaught):

  • 3ozVanillaCakeSwissCheese1pntMilkCreamButter2012MiadanCopperFuelThrustGermanRubberTipBelow$40Grease10qrtzEngineOilBen'sCarShopRubberTireHeavyDutyUnder50IbModelAHeadlights1922Get4TripleSuspensionCanadian…

You get the idea. It's not easy to read at all, especially considering you're being shot at by aliens. Now, how can we make this easier to read? Is there some superb answer? There actually is, and its called lists.

Let me cut the long variable above into something much more manageable:

  • 3 oz Vanilla Cake
  • Swiss Cheese
  • 1 pint Milk
  • Cream Butter
  • 2012 Miadan Copper Fuel Thrust (German)
  • Rubber Tip (Below $40)
  • Grease
  • 10 qtr. Engine Oil from Ben's Car Shop
  • Rubber Tire Heavy-Duty and Under 50 Ib
  • Model A Headlights 1922 (Get 4)
  • Triple Suspension (Canadian)


Thanks to lists, you can fulfill your entire shopping fiasco and spend a few minutes with your family before the Earth blows up. (The aliens were too frustrated with how organized humans were with lists.)

By now you should see how lists are important. Let me show you a bit about how they work in Scratch. For example, let's say we make a new list for our shopping:

  • Blank

It doesn't have anything, so let's put something in there! Whatever we want!

  • Oreos
  • Chips galore
  • A new TV
  • 3DS (the gold embroidered one)
  • A limousine
  • A pencil

I did that through:

add [Oeros] to [shopping v]
add [Chips galore] to [shopping v]
add [A new TV] to [shopping v]
add [3DS (the gold emrboridered one)] to [shopping v]
add [A limousine] to [shopping v]
add [A pencil] to [shopping v]

But that isn't exactly realistic. We are poor. Let's start fresh:

delete [all v] of [shopping v]
repeat (5)
add (item [random v] of [affordable v]) to [shopping v]
end
if <not ([shopping v] contains [a pencil])> then
add [a pencil] to [shopping v]
end

We needed a pencil badly for an essay due tomorrow, and that's what the if does.

We can't buy anything though; we can't see the list. We need to see it, and we can also only buy 4 things, so we do:

show list [shopping v]
delete [1 v] of [shopping v]

Well that should be enough of an intro. What do you think now?

Asking,

ErnieParke

Last edited by ErnieParke (Dec. 14, 2013 21:05:17)


StarscreamClone
Scratcher
1000+ posts

Online Turing Test -- In Need of Some Coding Help

Makes sense (and nice use of the alien invasion), but for the second to last, what would the ‘random’ bit be?

Somewhere in my 20s | He/It
Workin' on my degree in computer science and cognitive science, and the future president of 2036!

Surge is my imaginary husband - he's the guy in my icon!
ErnieParke
Scratcher
1000+ posts

Online Turing Test -- In Need of Some Coding Help

StarscreamClone wrote:

Makes sense (and nice use of the alien invasion), but for the second to last, what would the ‘random’ bit be?
I thought the aliens would be nice. ;)

Anyway, the random is just as it sounds; it gives you a random part of a list. It might give you item 1, it might give you item 5, it might give you item 200! It's random what it picks.

Answering,

ErnieParke

Last edited by ErnieParke (Dec. 14, 2013 23:38:24)


StarscreamClone
Scratcher
1000+ posts

Online Turing Test -- In Need of Some Coding Help

ErnieParke wrote:

StarscreamClone wrote:

Makes sense (and nice use of the alien invasion), but for the second to last, what would the ‘random’ bit be?
I thought the aliens would be nice. ;)

Anyway, the random is just as it sounds; it gives you a random part of a list. It might give you item 1, it might give you item 5, it might give you item 200! It's random what it picks.

Answering,

ErnieParke
Well, thank you very much! That certainly clears things up! You too, PZ7!

Somewhere in my 20s | He/It
Workin' on my degree in computer science and cognitive science, and the future president of 2036!

Surge is my imaginary husband - he's the guy in my icon!

Powered by DjangoBB