tadd dec 4 part 2 - aoc22 - advent of code 2022 solutions
 (HTM) git clone git://src.adamsgaard.dk/aoc22
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
       ---
 (DIR) commit 02e9cc5f5cf0456ab4a261952bc91906f392c448
 (DIR) parent 0bc85c36d6e35b7a76c5c9217cb56b82118736ec
 (HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
       Date:   Sun,  4 Dec 2022 08:10:45 +0000
       
       add dec 4 part 2
       
       Diffstat:
         A 4/aoc4b                             |       9 +++++++++
         M 4/mkfile                            |       5 +++++
       
       2 files changed, 14 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/4/aoc4b b/4/aoc4b
       t@@ -0,0 +1,9 @@
       +#!/bin/awk -f
       +BEGIN{ FS="," }
       +{
       +        if (split($1, a, "-") != 2 || split($2, b, "-") != 2)
       +                printf("split error: %s", $0)
       +        if (a[1] <= b[2] && b[1] <= a[2])
       +            sum++
       +}
       +END{ print sum }
 (DIR) diff --git a/4/mkfile b/4/mkfile
       t@@ -1,7 +1,12 @@
        run:V:
                ./aoc4 <input
       +        ./aoc4b <input
        
        test:V:
                # correct result: 2
                # pair 4 and 5 are fully contained
                ./aoc4 <testinput
       +        
       +test2:V:
       +        # correct result: 4
       +        ./aoc4b <testinput