]> fbox.kageds.com Git - adventofcode.git/commitdiff
Create 6.py
authorCptG9000 <71446401+CptG9000@users.noreply.github.com>
Tue, 7 Dec 2021 02:29:48 +0000 (02:29 +0000)
committerCptG9000 <71446401+CptG9000@users.noreply.github.com>
Tue, 7 Dec 2021 02:29:48 +0000 (02:29 +0000)
Gareth solution Python/6.py [new file with mode: 0644]

diff --git a/Gareth solution Python/6.py b/Gareth solution Python/6.py
new file mode 100644 (file)
index 0000000..cbfd5f4
--- /dev/null
@@ -0,0 +1,18 @@
+#it is very not efficient for pt2 but I didn't have much time today to think of a better solution
+fish = [2,3,1,3,4,4,1,5,2,3,1,1,4,5,5,3,5,5,4,1,2,1,1,1,1,1,1,4,1,1,1,4,1,3,1,4,1,1,4,1,3,4,5,1,1,5,3,4,3,4,1,5,1,3,1,1,1,3,5,3,2,3,1,5,2,2,1,1,4,1,1,2,2,2,2,3,2,1,2,5,4,1,1,1,5,5,3,1,3,2,2,2,5,1,5,2,4,1,1,3,3,5,2,3,1,2,1,5,1,4,3,5,2,1,5,3,4,4,5,3,1,2,4,3,4,1,3,1,1,2,5,4,3,5,3,2,1,4,1,4,4,2,3,1,1,2,1,1,3,3,3,1,1,2,2,1,1,1,5,1,5,1,4,5,1,5,2,4,3,1,1,3,2,2,1,4,3,1,1,1,3,3,3,4,5,2,3,3,1,3,1,4,1,1,1,2,5,1,4,1,2,4,5,4,1,5,1,5,5,1,5,5,2,5,5,1,4,5,1,1,3,2,5,5,5,4,3,2,5,4,1,1,2,4,4,1,1,1,3,2,1,1,2,1,2,2,3,4,5,4,1,4,5,1,1,5,5,1,4,1,4,4,1,5,3,1,4,3,5,3,1,3,1,4,2,4,5,1,4,1,2,4,1,2,5,1,1,5,1,1,3,1,1,2,3,4,2,4,3,1]
+day = 0
+index = 0
+while True:
+    if day == 256:
+        break
+    if index == len(fish):
+        index = 0
+        day = day + 1
+        print("Day",day)
+    if fish[index] == 0: 
+        fish[index] = 6
+        fish.append(9)
+    elif fish[index]!=0:
+        fish[index]= fish[index]-1
+    index = index + 1
+print("Number fo fish ",len(fish))
\ No newline at end of file