aocc22

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

uppgb.c (408B)


      1 #include "common.h"
      2 
      3 int main(int argc, char **argv) {
      4   char **lines;
      5   size_t nlines = readlines(&lines, "input");
      6 
      7   size_t npos;
      8   pos *p = parse(&npos, lines, nlines);
      9 
     10   space s = make_space(npos);
     11 
     12   size_t round = 0;
     13   int moved = 1;
     14   char mvs[npos];
     15   while (moved) {
     16     propose_moves(s, mvs, p, npos, round);
     17     moved = make_moves(p, s, mvs, npos);
     18     round++;
     19   }
     20 
     21   printf("%zu\n", round);
     22 }