This commit is contained in:
Joseph Redmon
2016-11-15 22:53:58 -08:00
parent 9a01e6ccb7
commit 0d6b107ed2
22 changed files with 333 additions and 99 deletions

View File

@ -9,6 +9,21 @@
#include "utils.h"
int *read_map(char *filename)
{
int n = 0;
int *map = 0;
char *str;
FILE *file = fopen(filename, "r");
if(!file) file_error(filename);
while((str=fgetl(file))){
++n;
map = realloc(map, n*sizeof(int));
map[n-1] = atoi(str);
}
return map;
}
void sorta_shuffle(void *arr, size_t n, size_t size, size_t sections)
{
size_t i;