Nasiel som takyto kod ale teraz neviem co tam mam presne zadat nech tam napisem hocico program spadne
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#define MAX_FILE_LENGTH 30
#define PUZZLE_SIDE 4
#define EMPTY_SLOT 0
void loadPuzzle(int puzzle[][PUZZLE_SIDE], FILE *fin);
int getMove();
void printPuzzle(int puzzle[][PUZZLE_SIDE]);
int doMove(int puzzle[][PUZZLE_SIDE], int move);
void swap(int *a, int *b);
int solved(int puzzle[][PUZZLE_SIDE]);
int main() {
int puzzle[PUZZLE_SIDE][PUZZLE_SIDE];
char filename[MAX_FILE_LENGTH+1];
int ans;
srand( 0 );
printf("Welcome to the PUZZLE-15 game!\n");
printf("Enter the file storing all of the puzzle configurations.\n");
scanf("%s", filename);
while (ans != 2) {
FILE *fin;
fin = fopen(filename, "r");
loadPuzzle(puzzle, fin);
fclose(fin);
int move;
printPuzzle(puzzle);
move = getMove();
while (move!=0) {
int okay = doMove(puzzle, move);
if (!okay) {
printf("Sorry, that is not a valid square to slide into ");
printf(" the open slot.\nNo move has been executed.\n");
}
else if (solved(puzzle))
break;
printPuzzle(puzzle);
move = getMove();
}
if (move != 0)
printf("Great, you solved the puzzle!!!\n");
else
printf("Sorry, looks like you gave up on the puzzle.\n");
printf("Which selection would you like?\n");
printf("1. Load a new puzzle.\n");
printf("2. Quit.\n");
scanf("%d", &ans);
}
}
void loadPuzzle(int puzzle[][PUZZLE_SIDE], FILE *fin) {
}
int getMove() {
}
void printPuzzle(int puzzle[][PUZZLE_SIDE]) {
}
int doMove(int puzzle[][PUZZLE_SIDE], int move) {
}
void swap(int *a, int *b) {
}
int solved(int puzzle[][PUZZLE_SIDE]) {
}