« first day (15 days earlier)      last day (73 days later) » 

7:19 AM
Good morning
So:
for (size_t i = 0; i < n * m; ++i) {
		for (size_t k = 0; k < 8; k++) {
			int next_i = x1 + x_move[k];
			int next_j = y1 + y_move[k];
			if (isInside(next_i, next_j, n, m))
				matrix[i][next_i*m + next_j] = 1;
		}
	}
so this should be right
 
7:48 AM
though, is this efficient version you talked about? :
 
 
10 hours later…
5:38 PM
So after the right adjacency matrix
how would we convert the 2d coordinate into 1d?
we should also output the path after determining the number of steps
?
 
5:50 PM
You have the same relation all the time; consider the classic 8x8 chess board:
2D      1D
(0, 0)  0
(0, 1)  1
(0, 2)  2
...
(0, 7)  7
(1, 0)  8
(1, 1)  9
...
(7, 7)  63
To convert one from another:
2D -> 1D: f(x, y) = x*m + y
1D -> 2D: f~(x)   = (x/m, x%m)
 
very important
as someone who also never played chess too
so now the adjacency matrix, we would have the veritices 0-63
right?
at least for the knight to move in 8 directions
 
6:32 PM
in other words
is this the idea:
each square on the chessboard to be represented as a node in the graph, and each valid move by the knight can be represented as an edge in the graph
 
7:32 PM
Exactly...
 

« first day (15 days earlier)      last day (73 days later) »