AI Project Help

I can’t get the AI to work correctly in this project. For some reason it won’t play the right cards. Does anyone know why?

@CodeHelp

11 Likes

oh that happens to me to
idk why

2 Likes

that is amazing dude!!! so good

3 Likes

Nice job, is there any way u could sow me the AI code? For example put maybe a brain emoji or something so it’s easier to understand

2 Likes

I mean too

2 Likes

@ArcadeGrounds Yeah.
@Salmon Thanks!
@FRENCH_WAVE123 The AI code is under the text titled “AI Brains”. It’s on the left side of the editor.

3 Likes

Not really good with AI, but I’ll take a look.

3 Likes

Thanks!

3 Likes

Yeah, AI is something I’ve played around with in hopscotch quite a bit

3 Likes

Could you tell me what each variable means?

2 Likes

Sure! Any variable where it says “PC_N” (_ is a number 1-7) is the number of one of the player’s cards. It’s the same thing for the colors, but instead it’s “PC_C”. CCC is the current card color, and CCN is the current card number. Turn is who’s turn it is. When turn = 2, it’s AI’s turn, and when turn = 1, it’s your turn. C_N is for the computers numbers. C_C is for the computers colors. Thinking is to make it appear as if the AI is thinking. Did that make sense? @Shadow_Spider

3 Likes

That’s good, thanks!

2 Likes

One more thing: could you elaborate on what the AI is doing wrong?
@Stylishpoopemoji33

2 Likes

So it’s only supposed to set the current card to one of it’s cards if it has one that would work. However, it’s occasionally just setting the current card to a card of a completely different color and number. Once it uses a card, it sets that cards values to -1. For some reason, though, it’s setting the current card to -1 sometimes.

3 Likes

I’ll take a look.

2 Likes

Cool, thanks.

2 Likes

Everything looks good so far - I might use Awesome_E’s debugger for this.

One question - what does it mean when CCN = 11 or 12?

2 Likes

When CCN = 10, the card is a reverse
When CCN = 11, the card is a skip
When CCN = 12, the card is a +2
When CCN = 13, the card is a wild
When CCN = 14, the card is a wild +4

2 Likes

Okay. Thanks.

How do you simulate getting +2/+4 cards? Or is that not added yet?

2 Likes

This would help @Spider

I would love to debug this!

4 Likes