DEV Community

Cover image for understanding : what computer wants
Mohammed Hamza (Horse Radish)
Mohammed Hamza (Horse Radish)

Posted on

understanding : what computer wants

So
this is my first post in a while
I am a serious procrastinator, so here it goes:
I am writing this post without any preparation (I know its the best) but I had to break the perfect chance cycle aka the perfectionist trap.
Today I just understood or more likely perception changed utterly, regarding a simple thing: ND arrays
I am re-learning and revising programming from 1 not zero since I had a couple of courses about a decade ago.
so I decided to make a 3*3 game puzzle
but kept thinking about how to make Python, C, or Java treat it as a grid, as in height and width because we were always taught that way and drawn in the board that way.
however, all the answers were about nested arrays or arrays inside arrays.
I finally understood it
s what and how perceiving a 2D array is different from how its created.
for Computer it
s always Linear but nested.
On the PC it`s always 1 big line so
1 2 3
4 5 6
7 8 9
is actually (1,2,3)(4,5,6)(7,8,9) but you use a library like NumPY to represent it to you in Human readable 2D table way.

Top comments (0)