aocc22

Advent of Code 2022
git clone git://www.tkruger.se/aocc22.git
Log | Files | Refs | README

common.h (680B)


      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 typedef struct {
     10   int64_t x;
     11   int64_t y;
     12 } pos;
     13 
     14 typedef struct {
     15   size_t h;
     16   size_t w;
     17 
     18   int64_t hoffs;
     19   int64_t woffs;
     20 
     21   uint8_t *data;
     22 } space;
     23 
     24 pos *parse(size_t *npos, char **lines, size_t nlines);
     25 void print_board(const space s, const pos *p, const size_t npos);
     26 space make_space(const size_t npos);
     27 void propose_moves(space s, char *mvs, const pos *p, const size_t npos,
     28                    const size_t round);
     29 int make_moves(pos *p, const space s, const char *mvs, const size_t npos);
     30 int64_t count_empty(const pos *p, const size_t npos);
     31 
     32 #endif