Problem in having AI respond - Card Game

Hi all, I’m having a problem with the supposed AI that I’ve created for a card game that I’m making. The purpose is to have the function meant for ‘player 2’ to run after the human player has put down a card.

What the function is supposed to do is to compare the value of the card which is stored in a array, and then according to the value assigned the AI is supposed to compared with the 4 cards in its hand and decide on which is the best possible card to pick.

Though the human player’s code seem to work as expected, for some reason the function for the computer did not run and instead churned out a huge chunk of data in the output.

I’ve recently started on AS3 and thus my codings methodology is still pretty raw so perhaps the ‘error’ message that Flash churned out, I can’t seem to find an answer for it.

I will attach 2 separate text files; one will include the portion of the code which I highly suspect is giving the problem, the second will be the supposed error message.

On the side note, I wish to both apologize and thank whoever attempts to take a look at my problem; the length of code involved is quite lengthy and you will most likely notice quite a few repeats.

If there is any other information you need please let me know. :slight_smile: