common.h (671B)
1 #ifndef COMMON_H_ 2 #define COMMON_H_ 3 4 #include <assert.h> 5 #include <reading.h> 6 #include <stdint.h> 7 #include <stdio.h> 8 9 #define RTYPES 4 // ore, clay, obsidian, geode 10 #define MTYPES 4 // ore, clay, obsidian, geode 11 #define ORE 0 12 #define CLA 1 13 #define OBS 2 14 #define GEO 3 15 #define NOT (255) 16 17 #define DONOTHING 0 18 #define BUILDORE 1 19 #define BUILDCLA 2 20 #define BUILDOBS 3 21 #define BUILDGEO 4 22 #define NOPT 5 23 24 typedef struct { 25 uint64_t c[RTYPES][MTYPES]; 26 } blueprint; 27 28 typedef struct { 29 uint64_t nrob[RTYPES]; 30 uint64_t nmin[MTYPES]; 31 } state; 32 33 blueprint *parse(char **lines, size_t nlines); 34 void print_blueprint(blueprint *bp); 35 state start_state(); 36 state empty_state(); 37 38 #endif