Updated boilerplate code

This commit is contained in:
icaema 2023-12-02 15:37:27 -05:00
parent 614d3629a0
commit b8574fd4d6
6 changed files with 114 additions and 16 deletions

View File

@ -1,6 +1,9 @@
CC=gcc
CFLAGS=-Wall
all: clean bin/part01 bin/part02
@echo "built all"
run1: clean bin/part01
cat data/p01data.txt | bin/part01
@ -19,7 +22,7 @@ bin/part01:
bin/part02:
$(CC) src/part02.c -o bin/part02
.PHONY: clean,pytest1
.PHONY: clean,pytest1,pytest2,pyrun1,pyrun2
clean:
rm -f bin/*

View File

@ -1,16 +1,19 @@
CC=gcc
CFLAGS=-Wall
run1: bin/part01
all: clean bin/part01 bin/part02
@echo "built all"
run1: clean bin/part01
cat data/p01data.txt | bin/part01
run2: bin/part02
run2: clean bin/part02
cat data/p02data.txt | bin/part02
test1: bin/part01
test1: clean bin/part01
cat data/p01test.txt | bin/part01
test2: bin/part02
test2: clean bin/part02
cat data/p02test.txt | bin/part02
bin/part01:
@ -19,7 +22,19 @@ bin/part01:
bin/part02:
$(CC) src/part02.c -o bin/part02
.PHONY: clean
.PHONY: clean,pytest1,pytest2,pyrun1,pyrun2
clean:
rm -f bin/*
pytest1:
cat data/p01test.txt | python3 src/part01.py
pyrun1:
cat data/p01data.txt | python3 src/part01.py
pytest2:
cat data/p02test.txt | python3 src/part02.py
pyrun2:
cat data/p02data.txt | python3 src/part02.py

View File

@ -1,14 +1,18 @@
#include <ctype.h>
#include <stdatomic.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define DEBUG
#ifdef DEBUG
#define debug_printf(...) do{ fprintf( stderr, __VA_ARGS__ ); } while( 0 )
#else
#define debug_printf(...) do{ } while ( 0 )
#endif
#define LINE_MAX 90
#define LINE_MAX 160
int main(int argc, char *argv[]){
int linesProcessed = 0;
@ -17,9 +21,14 @@ int main(int argc, char *argv[]){
while (fgets(line, LINE_MAX, stdin) != NULL) {
linesProcessed++;
}
printf("\n Processed %d Lines\n", linesProcessed);
printf("\n Ingested %d Lines\n", linesProcessed);
printf("===================================\n");
//insert processing code
printf("\n Processed XXX\n");
printf("===================================\n");
printf("Answer: \nXXXX\n");
}

View File

@ -0,0 +1,31 @@
import sys
from dataclasses import dataclass
DEBUG = True
padding=24
def debug_print(printname, *args):
if not DEBUG:
return
print(f"{'DEBUG::'+printname:<{padding}}", *args)
pass
FILENAME = "/home/icaema/Public/advent-of-code/day-XX/data/p01test.txt"
f = open(FILENAME, "r")
#for line in sys.stdin:
for line in f.readlines():
line = line.strip()
debug_print("input", line)
# Insert Processing Code
print("")
print("Processed:")
print("")
print("===================================\n");
print("Answer: XXX");

View File

@ -1,14 +1,18 @@
#include <ctype.h>
#include <stdatomic.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define DEBUG
#ifdef DEBUG
#define debug_printf(...) do{ fprintf( stderr, __VA_ARGS__ ); } while( 0 )
#else
#define debug_printf(...) do{ } while ( 0 )
#endif
#define LINE_MAX 90
#define LINE_MAX 160
int main(int argc, char *argv[]){
int linesProcessed = 0;
@ -17,9 +21,14 @@ int main(int argc, char *argv[]){
while (fgets(line, LINE_MAX, stdin) != NULL) {
linesProcessed++;
}
printf("\n Processed %d Lines\n", linesProcessed);
printf("\n Ingested %d Lines\n", linesProcessed);
printf("===================================\n");
//insert processing code
printf("\n Processed XXX\n");
printf("===================================\n");
printf("Answer: \nXXXX\n");
}

View File

@ -0,0 +1,31 @@
import sys
from dataclasses import dataclass
DEBUG = True
padding=24
def debug_print(printname, *args):
if not DEBUG:
return
print(f"{'DEBUG::'+printname:<{padding}}", *args)
pass
FILENAME = "/home/icaema/Public/advent-of-code/day-XX/data/p01test.txt"
f = open(FILENAME, "r")
#for line in sys.stdin:
for line in f.readlines():
line = line.strip()
debug_print("input", line)
# Insert Processing Code
print("")
print("Processed:")
print("")
print("===================================\n");
print("Answer: XXX");