View Single Post
  #2 (permalink)  
Old 07-05-2007, 06:15 AM
Felissa Felissa is offline
Member
 
Join Date: Jun 2007
Posts: 95
Felissa is on a distinguished road
You're problem is that you limit to the number of plays to 22. But it is very possible for you to play more then 22 times.

If you notice, sometimes you'll get the exception and sometimes you wont.
Code:
int whenWin[] = new int[22]
You can do one of three things. You can either increase the amount of the array to some extreme amount that makes no sense.
You can keep it at 22 length, but while you're going through your loop, check for the length and either stop playing or increase the size of the array. Or you can use an ArrayList, which will only give you size issues if you take up the amount of RAM in your computer.

My personal suggestion is to use an ArrayList.

Greetings
Felissa
Reply With Quote