Updated boilerplate code
This commit is contained in:
parent
614d3629a0
commit
b8574fd4d6
|
|
@ -1,6 +1,9 @@
|
||||||
CC=gcc
|
CC=gcc
|
||||||
CFLAGS=-Wall
|
CFLAGS=-Wall
|
||||||
|
|
||||||
|
all: clean bin/part01 bin/part02
|
||||||
|
@echo "built all"
|
||||||
|
|
||||||
run1: clean bin/part01
|
run1: clean bin/part01
|
||||||
cat data/p01data.txt | bin/part01
|
cat data/p01data.txt | bin/part01
|
||||||
|
|
||||||
|
|
@ -19,7 +22,7 @@ bin/part01:
|
||||||
bin/part02:
|
bin/part02:
|
||||||
$(CC) src/part02.c -o bin/part02
|
$(CC) src/part02.c -o bin/part02
|
||||||
|
|
||||||
.PHONY: clean,pytest1
|
.PHONY: clean,pytest1,pytest2,pyrun1,pyrun2
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f bin/*
|
rm -f bin/*
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,19 @@
|
||||||
CC=gcc
|
CC=gcc
|
||||||
CFLAGS=-Wall
|
CFLAGS=-Wall
|
||||||
|
|
||||||
run1: bin/part01
|
all: clean bin/part01 bin/part02
|
||||||
|
@echo "built all"
|
||||||
|
|
||||||
|
run1: clean bin/part01
|
||||||
cat data/p01data.txt | bin/part01
|
cat data/p01data.txt | bin/part01
|
||||||
|
|
||||||
run2: bin/part02
|
run2: clean bin/part02
|
||||||
cat data/p02data.txt | bin/part02
|
cat data/p02data.txt | bin/part02
|
||||||
|
|
||||||
test1: bin/part01
|
test1: clean bin/part01
|
||||||
cat data/p01test.txt | bin/part01
|
cat data/p01test.txt | bin/part01
|
||||||
|
|
||||||
test2: bin/part02
|
test2: clean bin/part02
|
||||||
cat data/p02test.txt | bin/part02
|
cat data/p02test.txt | bin/part02
|
||||||
|
|
||||||
bin/part01:
|
bin/part01:
|
||||||
|
|
@ -19,7 +22,19 @@ bin/part01:
|
||||||
bin/part02:
|
bin/part02:
|
||||||
$(CC) src/part02.c -o bin/part02
|
$(CC) src/part02.c -o bin/part02
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean,pytest1,pytest2,pyrun1,pyrun2
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f bin/*
|
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
|
||||||
|
|
@ -1,14 +1,18 @@
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <stdatomic.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#define DEBUG
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define debug_printf(...) do{ fprintf( stderr, __VA_ARGS__ ); } while( 0 )
|
#define debug_printf(...) do{ fprintf( stderr, __VA_ARGS__ ); } while( 0 )
|
||||||
#else
|
#else
|
||||||
#define debug_printf(...) do{ } while ( 0 )
|
#define debug_printf(...) do{ } while ( 0 )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LINE_MAX 90
|
#define LINE_MAX 160
|
||||||
|
|
||||||
int main(int argc, char *argv[]){
|
int main(int argc, char *argv[]){
|
||||||
int linesProcessed = 0;
|
int linesProcessed = 0;
|
||||||
|
|
@ -17,9 +21,14 @@ int main(int argc, char *argv[]){
|
||||||
while (fgets(line, LINE_MAX, stdin) != NULL) {
|
while (fgets(line, LINE_MAX, stdin) != NULL) {
|
||||||
linesProcessed++;
|
linesProcessed++;
|
||||||
}
|
}
|
||||||
|
printf("\n Ingested %d Lines\n", linesProcessed);
|
||||||
printf("\n Processed %d Lines\n", linesProcessed);
|
|
||||||
printf("===================================\n");
|
printf("===================================\n");
|
||||||
printf("Answer: \nXXXX\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
//insert processing code
|
||||||
|
|
||||||
|
printf("\n Processed XXX\n");
|
||||||
|
printf("===================================\n");
|
||||||
|
|
||||||
|
|
||||||
|
printf("Answer: \nXXXX\n");
|
||||||
|
}
|
||||||
|
|
@ -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");
|
||||||
|
|
@ -1,14 +1,18 @@
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <stdatomic.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#define DEBUG
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define debug_printf(...) do{ fprintf( stderr, __VA_ARGS__ ); } while( 0 )
|
#define debug_printf(...) do{ fprintf( stderr, __VA_ARGS__ ); } while( 0 )
|
||||||
#else
|
#else
|
||||||
#define debug_printf(...) do{ } while ( 0 )
|
#define debug_printf(...) do{ } while ( 0 )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LINE_MAX 90
|
#define LINE_MAX 160
|
||||||
|
|
||||||
int main(int argc, char *argv[]){
|
int main(int argc, char *argv[]){
|
||||||
int linesProcessed = 0;
|
int linesProcessed = 0;
|
||||||
|
|
@ -17,9 +21,14 @@ int main(int argc, char *argv[]){
|
||||||
while (fgets(line, LINE_MAX, stdin) != NULL) {
|
while (fgets(line, LINE_MAX, stdin) != NULL) {
|
||||||
linesProcessed++;
|
linesProcessed++;
|
||||||
}
|
}
|
||||||
|
printf("\n Ingested %d Lines\n", linesProcessed);
|
||||||
printf("\n Processed %d Lines\n", linesProcessed);
|
|
||||||
printf("===================================\n");
|
printf("===================================\n");
|
||||||
printf("Answer: \nXXXX\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
//insert processing code
|
||||||
|
|
||||||
|
printf("\n Processed XXX\n");
|
||||||
|
printf("===================================\n");
|
||||||
|
|
||||||
|
|
||||||
|
printf("Answer: \nXXXX\n");
|
||||||
|
}
|
||||||
|
|
@ -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");
|
||||||
Loading…
Reference in New Issue