My Artificial Intelligence Code Doesn't Work -- Help please! {Solved -- thank you! Any input?]



@WynterDiamond why couldn’t you check when an answer is tapped?


I can, but then when it asks a new question, it comes up as the same answer as before. The random idea is a good one, though. :slight_smile:


@WynterDiamond So, you could make it so that when the screen is tapped, the computer checks what the value of all of the answers on the question value. And make a random answer


That’s a good idea! I have to try that :slight_smile:
I’ll be back!
Thank you!


@WynterDiamond Your welcome! If that doesn’t work, be sure to tell me what went wrong, so I can tell you how to fix it.


Okay, so here’s what I found @Work_kids_coding, (I’m trying to make my modifications in a simpler AI before I transfer them to the more complex one):
When I put in “when ipad is tapped” as the when, it takes two tries to get Aaron to say what I want it to, but when I put in “when Text 3 is tapped” (the text object of option 1), it only takes 1 try… I’m not sure whether this is just a fluke or not, but I am kinda puzzled by it. Thank you!
(I haven’t tried putting the random answer thing in yet – I will right now.


@WynterDiamond Uh, explain yourself with that…


Okay – never mind about what I said before – here is the updated version. It worked until I put the second question in, but I’m not sure why. Could you please take a look? I will as well :slight_smile:

@HopscotchRemixer, maybe you would be able to help as well?


I have an idea. I will try it out when I get home (we are about to go eat). Have 2 different variables. One for the questions and one for the answers. Every question has its own number and every answer has its own number.


That’s a good idea – I’ve put those variables in but I haven’t used the one for the answer yet, maybe I will try that :slight_smile:


Ok, I will check out the project…


@WynterDiamond Looks like you are doing good!


Be careful with When rules like these

One or the other Whens is continuously running if the variable is always 0 or 1. You only need Whens to execute once when the BeInvisibleOrNot variable changes.

Since you said this is an assignment, I’ll let you figure out the solution. :grinning:


Okay, thank you! :slight_smile:


Use variables for keeping track of question number, the option the user chose, and which stage the thing is in (question: when the question is asked, answers: when the answers are displayed, and response: what the AI says after the question is replied to). I made a test project using this method. It’s quite simple, and the code is easy to reuse. If you like I can give you the link or screenshots of the code.

@WynterDiamond here you go! Https://


Thank you! Could you please just give me a link? That would help me out a lot! :smiley:


Thank you! I will add the same principle to my code :grin:


@Gobli09, can you please take a look at my code and tell me if you have any input? @HappyDolphin and @KoalaKrazy, you might be able to help too!
Thank you so much!


I’m really bad at AI and stuff xD



That’s fine :slight_smile:
Could you please just look at the code to see if you notice any bugs? Thank you!
(If you don’t feel like doing that, that’s also fine)