summary refs log tree commit diff
path: root/src/inspector/main.c
diff options
context:
space:
mode:
authorvenomade <venomade@venomade.com>2025-02-27 17:25:46 +0000
committervenomade <venomade@venomade.com>2025-02-27 17:25:46 +0000
commit259c727658485ea00d6ef8617ecab579be871470 (patch)
tree5f548781584cf942b0c8a9101eed124da902c9ce /src/inspector/main.c
Initial Commit
Diffstat (limited to 'src/inspector/main.c')
-rw-r--r--src/inspector/main.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/inspector/main.c b/src/inspector/main.c
new file mode 100644
index 0000000..ed035c5
--- /dev/null
+++ b/src/inspector/main.c
@@ -0,0 +1,37 @@
+#include <stdio.h>
+#include <assert.h>
+#include <SDL2/SDL.h>
+
+#include "../game.h"
+
+Game game = {0};
+
+// Tsoding is now a 3-Star Developer!
+const char *tsoding_shift(int *argc, char ***argv) {
+  assert(*argc > 0);
+  const char* result = **argv;
+  *argc -= 1;
+  *argv += 1;
+  return result;
+}
+
+void usage(FILE *stream) {
+  fprintf(stream, "Usage: ./gp_inspector <input.bin>\n");
+}
+
+int main(int argc, char *argv[]) {
+
+  tsoding_shift(&argc, &argv); //Skip Program Name
+
+  if (argc == 0) {
+    usage(stderr);
+    fprintf(stderr, "ERROR: No input file provided\n");
+    exit(1);
+  }
+  const char *input_filepath = tsoding_shift(&argc, &argv);
+
+  load_game(input_filepath, &game);
+
+  static_assert(AGENTS_COUNT > 0, "We need to have at least 1 agent to print");
+  print_chromo(stdout, &game.agents[0].chromo);
+}