Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

How to debug the code?

I’m trying to implement a Machine Learning algorithm for one of the multiplayer level and as expected, it’s a complicated process with a limited programming environment, since we’re talking about a mini artificial intelligence algorithm. I tried to use console.log(), but it gives an error and I need a way to understand what is happening with the variables to be able to figure out what went wrong.
I also thought about “porting” the algorithms out to a JSFiddle, but there is no way to extract this.findEnemes() and this.findItems() methods. I even thought about spiting out those arrays through a this.say() in a JSON pattern form, but we can’t select and copy those texts.

In my experience your best bet is to output to the .say command.
If you need a copy of what’s in it, try print screen and type it out after.
I generally put a short wait after my .say to make sure I don’t cause the text bubble to go away.

There are a lot of API protections involved, so you may not be able to accomplish everything you’re after, but if you can I’d be very interested to see the results.

I don’t mind sharing the results afterwards, but for now I’m still very interested in playing with it. I don’t even know if it’s a valid idea or if it’s going to be effective, I hope to find out soon.

I’m hoping to avoid the .say because of the amount of data. I’d be having to output data from an array with easily 50 items in it through say and then transform it into usable data manually more than once.

That would be more than tedious, I agree.