2D Array ?
Community Forums/Monkey Talk/2D Array ?| 
 | ||
| Method CreateAi() Self.AiMoves = [New Int[4],New Int[9]] Self.AiMoves[0]=[0,2,6,3,1,8,7,5,4] Self.AiMoves[1]=[2,8,0,1,5,6,3,7,4] Self.AiMoves[2]=[0,2,6,3,1,8,7,5,4] End Method Thats what I am trying, had a quick skim of the forums but cant see to track down why this isn't working Just trying to create a 2D Array to hold my AI moves, the first index will hold the move ID, and the second 9 deep index will hold the moves. Im getting an array index out of bounds (ITHINK) the editors kinda lame. | 
| 
 | ||
| Method CreateAi() Self.AiMoves = [[0,2,6,3,1,8,7,5,4],[2,8,0,1,5,6,3,7,4],[0,2,6,3,1,8,7,5,4]] End Method if you understand what I did then you will understand what you did wrong. and this is only a 3x9 not a 4 by 9. [I havent tried this but I think this: Self.AiMoves = [New Int[4],New Int[9]] should have been like this: Self.AiMoves = [New Int[9],New Int[9],new Int[9],new Int[9]] Last edited 2011 | 
| 
 | ||
| Right I can understand hows that's storing the info but how would I for example access the second element and then the 6th move. 
                                               \/
Self.AiMoves = [[0,2,6,3,1,8,7,5,4],[2,8,0,1,5,6,3,7,4],[0,2,6,3,1,8,7,5,4]]
it wouldnt be Self.AiMove[2,6] would it ? Last edited 2011 | 
| 
 | ||
| Monkey only allow single dimension arrays or arrays of arrays. and what that is is an array of arrays. in other words: self.AiMoves[2,6] should be like this: self.AiMoves[2][6] Last edited 2011 | 
| 
 | ||
| Ah got it.. thats gona take some getting used to . thanks for the help m8 | 
| 
 | ||
| Also the [2][6] above should be [1][5] due to starting indexes on zero. Last edited 2011 |