diff --git a/aoc2017.iml b/aoc2017.iml
deleted file mode 100644
index d7aced9..0000000
--- a/aoc2017.iml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/day01.py b/day01.py
new file mode 100644
index 0000000..029f483
--- /dev/null
+++ b/day01.py
@@ -0,0 +1,36 @@
+from tools.aoc import AOCDay
+from typing import Any
+
+
+class Day(AOCDay):
+ inputs = [
+ [
+ (1251, "input1")
+ ],
+ [
+ (1244, "input1")
+ ]
+ ]
+
+ def part1(self) -> Any:
+ sum = 0
+ last_x = self.getInput()[-1]
+ for x in self.getInput():
+ if x == last_x:
+ sum += int(x)
+ last_x = x
+ return sum
+
+ def part2(self) -> Any:
+ sum = 0
+ x = self.getInput()
+ a, b = x[:len(x)//2], x[len(x)//2:]
+ for i, x in enumerate(a):
+ if x == b[i]:
+ sum += int(x) * 2
+ return sum
+
+
+if __name__ == '__main__':
+ day = Day(2017, 1)
+ day.run(verbose=True)
diff --git a/src/resources/input01 b/inputs/input1
similarity index 98%
rename from src/resources/input01
rename to inputs/input1
index 3af3b68..c2c2085 100644
--- a/src/resources/input01
+++ b/inputs/input1
@@ -1 +1 @@
-516299281491169512719425276194596424291268712697155863651846937925928456958813624428156218468331423858422613471962165756423837756856519754524985759763747559711257977361228357678293572698839754444752898835313399815748562519958329927911861654784216355489319995566297499836295985943899373615223375271231128914745273184498915241488393761676799914385265459983923743146555465177886491979962465918888396664233693243983969412682561799628789569294374554575677368219724142536789649121758582991345537639888858113763738518511184439854223386868764189133964543721941169786274781775658991329331759679943342217578532643519615296424396487669451453728113114748217177826874953466435436129165295379157226345786756899935747336785161745487933721527239394118721517195849186676814232887413175587327214144876898248571248517121796766248817366614333915154796983612174281237846165129114988453188844745119798643314857871527757831265298846833327863781341559381238458322786192379487455671563757123534253463563421716138641611915686247343417126655317378639314168461345613427262786624689498485599942336813995725145169355942616672812792174556866436158375938988738721253664772584577384558696477546232189312287262439452141564522329987139692281984783513691857538335537553448919819545332125483128878925492334361562192621672993868479566688564752226111784486619789588318171745995253645886833872665447241245329935643883892447524286642296955354249478815116517315832179925494818748478164317669471654464867111924676961162162841232473474394739793968624974397916495667233337397241933765513777241916359166994384923869741468174653353541147616645393917694581811193977311981752554551499629219873391493426883886536219455848354426461562995284162323961773644581815633779762634745339565196798724847722781666948626231631632144371873154872575615636322965353254642186897127423352618879431499138418872356116624818733232445649188793318829748789349813295218673497291134164395739665667255443366383299669973689528188264386373591424149784473698487315316676637165317972648916116755224598519934598889627918883283534261513179931798591959489372165295
\ No newline at end of file
+516299281491169512719425276194596424291268712697155863651846937925928456958813624428156218468331423858422613471962165756423837756856519754524985759763747559711257977361228357678293572698839754444752898835313399815748562519958329927911861654784216355489319995566297499836295985943899373615223375271231128914745273184498915241488393761676799914385265459983923743146555465177886491979962465918888396664233693243983969412682561799628789569294374554575677368219724142536789649121758582991345537639888858113763738518511184439854223386868764189133964543721941169786274781775658991329331759679943342217578532643519615296424396487669451453728113114748217177826874953466435436129165295379157226345786756899935747336785161745487933721527239394118721517195849186676814232887413175587327214144876898248571248517121796766248817366614333915154796983612174281237846165129114988453188844745119798643314857871527757831265298846833327863781341559381238458322786192379487455671563757123534253463563421716138641611915686247343417126655317378639314168461345613427262786624689498485599942336813995725145169355942616672812792174556866436158375938988738721253664772584577384558696477546232189312287262439452141564522329987139692281984783513691857538335537553448919819545332125483128878925492334361562192621672993868479566688564752226111784486619789588318171745995253645886833872665447241245329935643883892447524286642296955354249478815116517315832179925494818748478164317669471654464867111924676961162162841232473474394739793968624974397916495667233337397241933765513777241916359166994384923869741468174653353541147616645393917694581811193977311981752554551499629219873391493426883886536219455848354426461562995284162323961773644581815633779762634745339565196798724847722781666948626231631632144371873154872575615636322965353254642186897127423352618879431499138418872356116624818733232445649188793318829748789349813295218673497291134164395739665667255443366383299669973689528188264386373591424149784473698487315316676637165317972648916116755224598519934598889627918883283534261513179931798591959489372165295
diff --git a/skel_day.py b/skel_day.py
new file mode 100644
index 0000000..dcebd15
--- /dev/null
+++ b/skel_day.py
@@ -0,0 +1,24 @@
+from tools.aoc import AOCDay
+from typing import Any
+
+
+class Day(AOCDay):
+ inputs = [
+ [
+ (None, "input%DAY%")
+ ],
+ [
+ (None, "input%DAY%")
+ ]
+ ]
+
+ def part1(self) -> Any:
+ return ""
+
+ def part2(self) -> Any:
+ return ""
+
+
+if __name__ == '__main__':
+ day = Day(%YEAR%, %DAY%)
+ day.run(verbose=True)
diff --git a/src/de/domainforge/aoc2017/Day01.java b/src/de/domainforge/aoc2017/Day01.java
deleted file mode 100644
index f95a6c5..0000000
--- a/src/de/domainforge/aoc2017/Day01.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package de.domainforge.aoc2017;
-
-import de.domainforge.tools.AOCDay;
-import java.nio.charset.StandardCharsets;
-
-public class Day01 extends AOCDay {
- public Day01(String input) {
- super(input);
- }
-
- @Override
- public String part1() {
- byte[] input = this.input.getBytes(StandardCharsets.UTF_8);
- int res = 0;
- if (input[0] == input[input.length - 1]) {
- res += input[0] - 48;
- }
- for (int i = 0; i < input.length - 1; i++) {
- if (input[i] == input[i+1]) {
- res += input[i] - 48;
- }
- }
-
- return String.valueOf(res);
- }
-
- @Override
- public String part2() {
- byte[] input = this.input.getBytes(StandardCharsets.UTF_8);
- int res = 0;
- int half = input.length / 2;
-
- for (int i = 0; i < half; i++) {
- if (input[i] == input[half + i]) {
- res += (input[i] - 48) * 2;
- }
- }
-
- return String.valueOf(res);
- }
-}
diff --git a/src/de/domainforge/aoc2017/Day02.java b/src/de/domainforge/aoc2017/Day02.java
deleted file mode 100644
index c19e5a2..0000000
--- a/src/de/domainforge/aoc2017/Day02.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package de.domainforge.aoc2017;
-
-import de.domainforge.tools.AOCDay;
-import java.util.ArrayList;
-
-public class Day02 extends AOCDay {
- public Day02(String input) { super(input); }
-
- @Override
- public String part1() {
- String[] input = this.getInputAsArray();
- int res = 0;
- for (String line : input) {
- int min = Integer.MAX_VALUE;
- int max = 0;
- String[] items = line.strip().split("[\s\t]+");
- for (String item : items) {
- int value = Integer.parseInt(item);
- if (value < min) {
- min = value;
- }
- if (value > max) {
- max = value;
- }
- }
- res += (max - min);
- }
-
- return String.valueOf(res);
- }
-
- @Override
- public String part2() {
- String[] input = this.getInputAsArray();
- int res = 0;
- for (String line : input) {
- ArrayList items = new ArrayList<>();
- for (String number : line.strip().split("[\s\t]+")) {
- items.add(Integer.parseInt(number));
- }
- for (Integer i : items) {
- for (Integer j : items) {
- if (i % j == 0 && i / j != 1) {
- res += i / j;
- }
- }
- }
- }
- return String.valueOf(res);
- }
-}
diff --git a/src/resources/input02 b/src/resources/input02
deleted file mode 100644
index 19b0021..0000000
--- a/src/resources/input02
+++ /dev/null
@@ -1,16 +0,0 @@
-62 1649 1731 76 51 1295 349 719 52 1984 2015 2171 981 1809 181 1715
-161 99 1506 1658 84 78 533 242 1685 86 107 1548 670 960 1641 610
-95 2420 2404 2293 542 2107 2198 121 109 209 2759 1373 1446 905 1837 111
-552 186 751 527 696 164 114 530 558 307 252 200 481 142 205 479
-581 1344 994 1413 120 112 656 1315 1249 193 1411 1280 110 103 74 1007
-2536 5252 159 179 4701 1264 1400 2313 4237 161 142 4336 1061 3987 2268 4669
-3270 1026 381 185 293 3520 1705 1610 3302 628 3420 524 3172 244 295 39
-4142 1835 4137 3821 3730 2094 468 141 150 3982 147 4271 1741 2039 4410 179
-1796 83 2039 1252 84 1641 2165 1218 1936 335 1807 2268 66 102 1977 2445
-96 65 201 275 257 282 233 60 57 200 216 134 72 105 81 212
-3218 5576 5616 5253 178 3317 6147 5973 2424 274 4878 234 200 4781 5372 276
-4171 2436 134 3705 3831 3952 2603 115 660 125 610 152 4517 587 1554 619
-2970 128 2877 1565 1001 167 254 2672 59 473 2086 181 1305 162 1663 2918
-271 348 229 278 981 1785 2290 516 473 2037 737 2291 2521 1494 1121 244
-2208 2236 1451 621 1937 1952 865 61 1934 49 1510 50 1767 59 194 1344
-94 2312 2397 333 1192 106 2713 2351 2650 2663 703 157 89 510 1824 125
\ No newline at end of file
diff --git a/start_day.py b/start_day.py
new file mode 100644
index 0000000..6388eef
--- /dev/null
+++ b/start_day.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python3
+from argparse import ArgumentParser
+from datetime import datetime
+from os.path import exists
+from platform import system
+from subprocess import call
+from time import sleep
+import webbrowser
+
+
+YEAR = 2017
+CHARMS = {
+ 'Linux': '/usr/local/bin/charm',
+ 'Windows': r'C:\Users\pennywise\AppData\Local\JetBrains\Toolbox\scripts\pycharm.cmd'
+}
+
+arg_parser = ArgumentParser()
+arg_parser.add_argument("-d", "--day", help="start a specific day (default: today)", type=int)
+args = arg_parser.parse_args()
+
+DAY = args.day or datetime.now().day
+
+if YEAR < 2015 or not 1 <= DAY <= 25:
+ print("Invalid year or day for year: %d, day: %d" % (YEAR, DAY))
+ exit()
+
+day_file = "day%02d.py" % DAY
+if exists(day_file):
+ print(day_file, "already exists. Use that one!")
+ exit()
+
+with open("skel_day.py", "r") as IN:
+ with open(day_file, "w") as OUT:
+ while in_line := IN.readline():
+ OUT.write(in_line.replace("%YEAR%", str(YEAR)).replace("%DAY%", str(DAY)))
+
+start = datetime(YEAR, 12, DAY, 6, 0, 0)
+now = datetime.now()
+if start > now:
+ time_wait = start - now
+ if time_wait.days > 0:
+ print("Do you really want to wait %d days?" % time_wait.days)
+ exit()
+
+ for x in range(time_wait.seconds, -1, -1):
+ print("Day starts in %02ds.\r")
+ sleep(1)
+
+call([CHARMS[system()], day_file])
+webbrowser.open("https://adventofcode.com/%d/day/%d" % (YEAR, DAY))
+call(["git", "add", day_file])
diff --git a/test/de/domainforge/aoc2017/Day01Test.java b/test/de/domainforge/aoc2017/Day01Test.java
deleted file mode 100644
index 3427c58..0000000
--- a/test/de/domainforge/aoc2017/Day01Test.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package de.domainforge.aoc2017;
-
-import de.domainforge.tools.*;
-import org.junit.jupiter.api.Test;
-import java.io.*;
-import java.util.*;
-import static org.junit.jupiter.api.Assertions.*;
-
-class Day01Test {
-
- @Test
- void part1() throws IOException {
- HashMap tests = new HashMap<>();
- tests.put("input01_1_1", "3");
- tests.put("input01_1_2", "4");
- tests.put("input01_1_3", "0");
- tests.put("input01_1_4", "9");
-
- for (String inputFileName : tests.keySet()) {
- File inputFile = new File(Objects.requireNonNull(Main.class.getClassLoader().getResource(inputFileName)).getPath());
- AOCDay day01 = new Day01(FileHelper.readFileToString(inputFile));
- assertEquals(tests.get(inputFileName), day01.part1());
- }
- }
-
- @Test
- void part2() throws IOException {
- HashMap tests = new HashMap<>();
- tests.put("input01_2_1", "6");
- tests.put("input01_2_2", "0");
- tests.put("input01_2_3", "4");
- tests.put("input01_2_4", "12");
- tests.put("input01_2_5", "4");
-
- for (String inputFileName : tests.keySet()) {
- File inputFile = new File(Objects.requireNonNull(Main.class.getClassLoader().getResource(inputFileName)).getPath());
- AOCDay day01 = new Day01(FileHelper.readFileToString(inputFile));
- assertEquals(tests.get(inputFileName), day01.part2());
- }
- }
-}
\ No newline at end of file
diff --git a/test/de/domainforge/aoc2017/Day02Test.java b/test/de/domainforge/aoc2017/Day02Test.java
deleted file mode 100644
index bc5e89d..0000000
--- a/test/de/domainforge/aoc2017/Day02Test.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package de.domainforge.aoc2017;
-
-import de.domainforge.tools.AOCDay;
-import de.domainforge.tools.FileHelper;
-import org.junit.jupiter.api.Test;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Objects;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-class Day02Test {
-
- @Test
- void part1() throws IOException {
- HashMap tests = new HashMap<>();
- tests.put("input02_1_1", "18");
-
- for (String inputFileName : tests.keySet()) {
- File inputFile = new File(Objects.requireNonNull(Main.class.getClassLoader().getResource(inputFileName)).getPath());
- AOCDay day = new Day02(FileHelper.readFileToString(inputFile));
- assertEquals(tests.get(inputFileName), day.part1());
- }
- }
-
- @Test
- void part2() throws IOException {
- HashMap tests = new HashMap<>();
- tests.put("input02_2_1", "9");
-
- for (String inputFileName : tests.keySet()) {
- File inputFile = new File(Objects.requireNonNull(Main.class.getClassLoader().getResource(inputFileName)).getPath());
- AOCDay day = new Day02(FileHelper.readFileToString(inputFile));
- assertEquals(tests.get(inputFileName), day.part2());
- }
- }
-}
\ No newline at end of file
diff --git a/test/resources/input01_1_1 b/test/resources/input01_1_1
deleted file mode 100644
index 4ee16cc..0000000
--- a/test/resources/input01_1_1
+++ /dev/null
@@ -1 +0,0 @@
-1122
\ No newline at end of file
diff --git a/test/resources/input01_1_2 b/test/resources/input01_1_2
deleted file mode 100644
index d1d06ad..0000000
--- a/test/resources/input01_1_2
+++ /dev/null
@@ -1 +0,0 @@
-1111
\ No newline at end of file
diff --git a/test/resources/input01_1_3 b/test/resources/input01_1_3
deleted file mode 100644
index 274c005..0000000
--- a/test/resources/input01_1_3
+++ /dev/null
@@ -1 +0,0 @@
-1234
\ No newline at end of file
diff --git a/test/resources/input01_1_4 b/test/resources/input01_1_4
deleted file mode 100644
index 4864670..0000000
--- a/test/resources/input01_1_4
+++ /dev/null
@@ -1 +0,0 @@
-91212129
\ No newline at end of file
diff --git a/test/resources/input01_2_1 b/test/resources/input01_2_1
deleted file mode 100644
index f73dd74..0000000
--- a/test/resources/input01_2_1
+++ /dev/null
@@ -1 +0,0 @@
-1212
\ No newline at end of file
diff --git a/test/resources/input01_2_2 b/test/resources/input01_2_2
deleted file mode 100644
index 35c53b6..0000000
--- a/test/resources/input01_2_2
+++ /dev/null
@@ -1 +0,0 @@
-1221
\ No newline at end of file
diff --git a/test/resources/input01_2_3 b/test/resources/input01_2_3
deleted file mode 100644
index b12c5cc..0000000
--- a/test/resources/input01_2_3
+++ /dev/null
@@ -1 +0,0 @@
-123425
\ No newline at end of file
diff --git a/test/resources/input01_2_4 b/test/resources/input01_2_4
deleted file mode 100644
index 93a5f6a..0000000
--- a/test/resources/input01_2_4
+++ /dev/null
@@ -1 +0,0 @@
-123123
\ No newline at end of file
diff --git a/test/resources/input01_2_5 b/test/resources/input01_2_5
deleted file mode 100644
index cb05196..0000000
--- a/test/resources/input01_2_5
+++ /dev/null
@@ -1 +0,0 @@
-12131415
\ No newline at end of file
diff --git a/test/resources/input02_1_1 b/test/resources/input02_1_1
deleted file mode 100644
index ef93227..0000000
--- a/test/resources/input02_1_1
+++ /dev/null
@@ -1,3 +0,0 @@
-5 1 9 5
-7 5 3
-2 4 6 8
\ No newline at end of file
diff --git a/test/resources/input02_2_1 b/test/resources/input02_2_1
deleted file mode 100644
index 6cf689b..0000000
--- a/test/resources/input02_2_1
+++ /dev/null
@@ -1,3 +0,0 @@
-5 9 2 8
-9 4 7 3
-3 8 6 5
\ No newline at end of file