#define WALK_LEN 200 // #define FILE_PATH "files/in.txt" #define FILE_PATH "files/shakespeare.txt" // #define FILE_PATH "files/south-park-the-aristocrats.txt" // #define PRINT_CHAIN // #define PRINT_ITEM_FREQUENCY #define PRINT_ON_WALK #include #include #include #define ITEM_CAP 4000 #include "markov.h" int ITEMS = 0; double chain[ITEM_CAP][ITEM_CAP] = {0}; char item_names[ITEM_CAP][64] = {0}; void set_stack(); int main(void) { set_stack(); srand(time(NULL)); generate_chain(); take_walk(); #ifdef PRINT_CHAIN print_chain(); #endif return 0; } // for stack #include void set_stack() { const rlim_t kStackSize = 64L * 1024L * 1024L; // min stack size = 64 Mb struct rlimit rl; int result; if(getrlimit(RLIMIT_STACK, &rl) == 0) { if (rl.rlim_cur < kStackSize) { rl.rlim_cur = kStackSize; if((result = setrlimit(RLIMIT_STACK, &rl)) != 0) fprintf(stderr, "setrlimit returned result = %d\n", result); } } }