#include #include #include #include "prettynames.h" #include "player.h" #include "random.h" #include "world.h" int main() { uint32_t seed; printf("Enter seed: "); if (scanf("%u", &seed) != 1) { printf("Invalid seed.\n"); return 1; } int ch = 0; while ((ch = getchar()) != '\n' && ch != EOF) {} set_random_seed(seed); world_t world; world_generate(&world); uint16_t x = WORLD_WIDTH / 2; uint16_t y = WORLD_HEIGHT / 2; const quadrant_t *centre = world_get_quadrant(&world, x, y); if (centre == NULL) { printf("Failed to read centre quadrant.\n"); return 1; } printf("Generated world: %ux%u\n", WORLD_WIDTH, WORLD_HEIGHT); printf( "Centre (%u, %u): type=%s (%d), old=%s, visited=%s, discovered=%s\n", x, y, quadrant_type_name(centre->type), (int)centre->type, centre->is_old ? "true" : "false", centre->is_visited ? "true" : "false", centre->is_discovered ? "true" : "false" ); player_t player = player_create(x, y); char action[128]; for (;;) { printf(">"); fflush(stdout); if (fgets(action, sizeof(action), stdin) == NULL) break; action[strcspn(action, "\n")] = '\0'; player_process_action(&player, action); } return 0; }