Hey i've been bothering with contiguous and linear allocated memory spaces out of good habit purposes.
I've been wondering if there is in somehow a capability to simply compare 2 Contiguously allocated 2D Array's.
Both are allocated like these, both the board and the game piece.
map->board = malloc(sizeof(char[map->x][map->y + 1]));
a board looks like this
000 ..............................
001 ..............................
002 ..X...........................
003 ..............................
004 ..............................
005 ..............................
006 ..............................
007 ..............................
008 ..............................
009 ..............................
010 ..............................
011 ...........................O..
012 ..............................
013 ..............................
The pieces look like these.
Piece 4 7 Piece 4 5: Piece 3 6:
...*... .**.. .****.
...*... .***. **....
...*... ..*.. *.....
..***.. .....
The purpose is for a piece to overlap '1' already placed token, and not exceed the dimensions.
However i'm unable to properly check if a piece exceeds the boards dimensions because it is a single dimensional array allocated with the size of a 2D Array, nor am i able to compare multiple rows.
Would i be better off just using Pointer-to-Pointer arrays?