aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c20
-rw-r--r--src/markov.h7
2 files changed, 20 insertions, 7 deletions
diff --git a/src/main.c b/src/main.c
index 46b9a4c..8b412ca 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,12 +1,18 @@
-#include <stdio.h>
-#include <time.h>
+// ----------------- OPTIONS ----------------- //
+#define FILE_PATH "files/in.txt"
+// #define FILE_PATH "files/south-park-the-aristocrats.txt"
+#define WALK_LEN 100000
+#define PRINT_CHAIN
#define PRINT_ITEM_FREQUENCY
// #define PRINT_ON_WALK
// #define SAVE_TO_FILE_ON_WALK "out.txt"
-#define WALK_LEN 10000
+// --------------- END OPTIONS --------------- //
+
+#include <stdio.h>
+#include <time.h>
-#define ITEM_CAP 400
+#define ITEM_CAP 1024
int ITEMS = 0;
double chain[ITEM_CAP][ITEM_CAP] = {0};
@@ -17,9 +23,11 @@ char item_names[ITEM_CAP][64] = {0};
int main(void)
{
srand(time(NULL));
- generate_chain("files/in.txt");
+ generate_chain();
- // print_chain();
+#ifdef PRINT_CHAIN
+ print_chain();
+#endif
take_walk();
return 0;
}
diff --git a/src/markov.h b/src/markov.h
index 2cb22ce..1c95775 100644
--- a/src/markov.h
+++ b/src/markov.h
@@ -11,8 +11,13 @@ extern int ITEMS;
extern double chain[][ITEM_CAP];
extern char item_names[][64];
-void generate_chain(char *file_path)
+void generate_chain()
{
+ char *file_path = NULL;
+ #ifdef FILE_PATH
+ file_path = FILE_PATH;
+ #endif
+
FILE *fp = fopen(file_path, "r");
if(!fp) {
fprintf(stderr, "ERROR: Could not open file %s\n", file_path);