summaryrefslogtreecommitdiffstats
path: root/prog
diff options
context:
space:
mode:
Diffstat (limited to 'prog')
-rwxr-xr-xprog/aoc/23/12/1.py53
-rw-r--r--prog/aoc/23/12/correct.txt6
-rw-r--r--prog/aoc/23/12/in.txt6
-rwxr-xr-xprog/aoc/23/13/1.py22
-rw-r--r--prog/skovikanje/skovik/test.html15
m---------prog/ž/QR-Code-generator0
6 files changed, 102 insertions, 0 deletions
diff --git a/prog/aoc/23/12/1.py b/prog/aoc/23/12/1.py
new file mode 100755
index 0000000..7e07935
--- /dev/null
+++ b/prog/aoc/23/12/1.py
@@ -0,0 +1,53 @@
+#!/usr/bin/python3
+springs = []
+try:
+ while True:
+ s = input()
+ springs.append((s.split(" ")[0], list(map(int, s.split(" ")[1].split(",")))))
+except EOFError:
+ pass
+def counts(vhod):
+ s = vhod + "$"
+ prev = None
+ r = []
+ run = 0
+ for c in s:
+ if prev == None:
+ prev = c
+ run = 1
+ continue
+ if c == prev:
+ run += 1
+ continue
+ if prev == "#":
+ r.append(run)
+ prev = c
+ run = 1
+ return r
+"""
+for spring in springs:
+ print(counts(spring[0]), spring[1])
+"""
+def possibilities(x):
+ r = 0
+ countq = x[0].count("?")
+ for bits in range(2**countq):
+ copy = x[0]
+ for i in range(countq):
+ if bits & (1 << i):
+ copy = copy.replace("?", ".", 1)
+ else:
+ copy = copy.replace("?", "#", 1)
+ if counts(copy) == x[1]:
+ r += 1
+ return r
+def possibilities_serial(array):
+ s = 0
+ for element in array:
+ s += possibilities(element)
+ return s
+batch_size = 10
+batches = [springs[x:x+batch_size] for x in range(0, len(springs), batch_size)]
+from multiprocessing import Pool
+with Pool(len(batches)) as p:
+ print(sum(p.map(possibilities_serial, batches)))
diff --git a/prog/aoc/23/12/correct.txt b/prog/aoc/23/12/correct.txt
new file mode 100644
index 0000000..e2bdf5e
--- /dev/null
+++ b/prog/aoc/23/12/correct.txt
@@ -0,0 +1,6 @@
+#.#.### 1,1,3
+.#...#....###. 1,1,3
+.#.###.#.###### 1,3,1,6
+####.#...#... 4,1,1
+#....######..#####. 1,6,5
+.###.##....# 3,2,1
diff --git a/prog/aoc/23/12/in.txt b/prog/aoc/23/12/in.txt
new file mode 100644
index 0000000..e925935
--- /dev/null
+++ b/prog/aoc/23/12/in.txt
@@ -0,0 +1,6 @@
+???.### 1,1,3
+.??..??...?##. 1,1,3
+?#?#?#?#?#?#?#? 1,3,1,6
+????.#...#... 4,1,1
+????.######..#####. 1,6,5
+?###???????? 3,2,1
diff --git a/prog/aoc/23/13/1.py b/prog/aoc/23/13/1.py
new file mode 100755
index 0000000..14f231e
--- /dev/null
+++ b/prog/aoc/23/13/1.py
@@ -0,0 +1,22 @@
+#!/usr/bin/python3
+from sys import stdin
+data = stdin.read()[:-1]
+patterns = []
+for datum in data.split("\n\n"):
+ patterns.append(datum.split("\n"))
+def try_gap(pattern, gap):
+ for l in range(gap+1):
+ if pattern[gap-l] != pattern[line+l+1]:
+ return False
+ return True
+def transpose(pattern):
+ r = []
+ for column in range(len(pattern[0])):
+ l = ""
+ for line in range(len(pattern)):
+ l += pattern[line][column]
+ r.append(l)
+ return r
+for pattern in patterns:
+ for line in len(pattern):
+ try_line(line
diff --git a/prog/skovikanje/skovik/test.html b/prog/skovikanje/skovik/test.html
index 67c6136..bf3220a 100644
--- a/prog/skovikanje/skovik/test.html
+++ b/prog/skovikanje/skovik/test.html
@@ -7,6 +7,11 @@
a {
overflow-wrap: break-word;
}
+html {
+ margin: auto;
+ max-width: 60em;
+ text-align: justify;
+}
</style>
<meta name=viewport content='width=device-width, initial-scale=1.0'>
<link rel=alternate type=application/rss+xml title=RSS href=/skovikanje/rss.xml>
@@ -74,6 +79,16 @@ skovik the type of word that drake would use
<img style=max-width:100% src='https://media.tenor.com/KAAhgZ9CTekAAAAd/skeleton-smoking.gif' />
</div>
</div>
+<div class=komentar style='border:1px solid red'>
+<i><a href=# onclick=citiraj('z6nz')><code>z6nz</code></a> <b class=avtor></b> dne <span class=datum>tor 28 nov 2023 12:44:26 CET</span> <a href=//z.4a.si/skovikanje/komentar.php?koga=z6nz target=_blank>uredi</a> <a href=/skovikanje/skovik/test.html>na</a></i>
+<div class=besedilo>
+<img style=max-width:100% src='https://raw.githubusercontent.com/Codelessly/FlutterLoadingGIFs/master/packages/cupertino_activity_indicator_square_small.gif ' />
+<br>
+
+loading demo za un cursed <a class=raw href='https://ass.si'>ass.si</a> link
+
+</div>
+</div>
<div id=odgovor><details open id=odgovordetails><summary>pokaži/skrij</summary><form method=post action='//z.4a.si/skovikanje/komentar.php?na=test&amp;tip=objava&amp;ref=HTTP_REFERER'>
<label for=avtor>
avtor:
diff --git a/prog/ž/QR-Code-generator b/prog/ž/QR-Code-generator
-Subproject 22fac31bdf81da68730c177c0e931c93234d2a3
+Subproject 49a66a2b8bb8f8852fd2e1deb00b8672f576013