Calculating number of rows in a 2D array

I am writing this simple program that takes an 2D array like such:
1
2
3
4
5
6
7
8
9
"######################",
"#@        #        X #",
"#         #          #",
"#                    #",
"#                    #",
"#                    #",
"#                    #",
"#                    #",
"######################"

The goal is for my code that I write to guide the @ symbol through the maze to the X. The logic code for navigating runs in a loop until it is completed and I use a sleep function so I can track the movements as it goes along to find errors/problems with the code.

I would like to figure out how to find the number of rows in my array. I realize that I could very easily look at the number I assigned to the array when I defined it, but the program is written from the standpoint of the symbol @ having no previous knowledge of the map besides what it cannot go through/when it has reached its target.

Thanks
Last edited on
From what you've said, I think the only way to know is to explore the whole maze and keep track of the maximum row number that '@' visits.
I see I kinda screwed myself here, because at some point the @ would have to have knowledge of the array beforehand to calculate the amount of rows. Thanks though ^^
Topic archived. No new replies allowed.