This is what i have so far, Not sure if it makes sense but i tried my best.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
int random_horse(int chess[8][8], int i, int j) this is a function? you havent declared any variables to pass to the funtion. also you cant declare a funtion inside of main. they can only be created before or after main. If you do it after main you must also include a function header before main. I think you should listen to your instructor and read the book that came with the class. is it to late to drop the class and change your major?
for (i=0; i<7; i++)
for(j=0; j<7; j++)
//? whats going on here?why assign the 8,8 position of the checker board to 16?
random_horse[i][j] = i+j;
i=2; //wtf is this?
j=2; /wtf is this?
numofsquares = random_horse(chess, i, j); //what is this suppose to be doing?
print(“Number of squares visited = %d\n”, numofsquares);
// where in the hell did you declare numberofsquares and
//where in the hell did you add anything to it?
while(1) i-1>=0 && j-2>=0 && chess [i-1][j-2]== -1) // you have absoluty no idea do you?
{
pm[k][0] = i-1; //
pm[k][1] = j-2; //
k++;
}
{
if(k==0) return chess[1][j];
rc = rand_int (0,k-1);
x = pm[rc][0];
y = pm[rc][1];
chess[x][y] = chess[i][j] + 1;
i=x;
j=y;
}
return 0;
}