/* r_walk.c * calculates an interest table * * King Chapter 8, Ex. 9. * * By Cory Spitzer * March 29th, 2013 */ #include #include #include #define N 8 // Dimensions of Matrix - change START1 and START2 #define START1 2 #define START2 3 int main(void){ int array [N][N]; int row, col, direction; // directions 0 thru 4 inclusive int a_period = 0x2e; // ascii for "." int current_pos = array[START1][START2]; // seed rand() with the current time srand((unsigned) time(NULL)); // line from deal.c, in KN King // fill the array with ". " for (row = 0; row <= N; row ++) { for (col = 0; col <= N; col ++) { array[row][col] = a_period; } } while (current_pos... ){ direction = (srand % 4); if (new_pos == 0x2e) { current_pos = new_pos; if (direction == 0) current_pos = current_pos[+1][] else if () else if () else } } //// print the blank array //for (row = 0; row <= N; row ++){ //for (col = 0; col <= N; col ++) { //printf("%c ", (char)a_period); //} //printf("\n"); //} return 0; }