Compare commits
9 commits
c2b2be8fec
...
012e2bfe7e
Author | SHA1 | Date | |
---|---|---|---|
012e2bfe7e | |||
9a2564986b | |||
b9a86c612c | |||
85ec6c22fe | |||
6b928eab64 | |||
4b601b56a5 | |||
65c325dc96 | |||
34dc974dd6 | |||
d4095749d0 |
16 changed files with 843 additions and 0 deletions
1
day4/answer1
Normal file
1
day4/answer1
Normal file
|
@ -0,0 +1 @@
|
||||||
|
24733
|
2
day5/.gitattributes
vendored
Normal file
2
day5/.gitattributes
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# Normalize EOL for all files that Git considers text files.
|
||||||
|
* text=auto eol=lf
|
2
day5/.gitignore
vendored
Normal file
2
day5/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# Godot 4+ specific ignores
|
||||||
|
.godot/
|
24
day5/README.md
Normal file
24
day5/README.md
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# AoC 2023 Day 5 (GDScript & Python)
|
||||||
|
|
||||||
|
Today's code was written for Godot, somewhat lazily.
|
||||||
|
|
||||||
|
I also made a port to Python because I'm lazy and didn't feel like waiting all day to test the script (see commentary for more info). The Python versions are a direct port of the GDScript versions, so there's some seemingly strange choices in them.
|
||||||
|
|
||||||
|
### Requirements:
|
||||||
|
- **Godot**: Godot 4 Editor or a compiled Godot 4 based project
|
||||||
|
- **Python**: Python ≥ 3.6 compatible interpreter
|
||||||
|
|
||||||
|
### Usage:
|
||||||
|
- To use the Godot version, run `godot --headless -s d5p1.gd -- $INPUT` where $INPUT is the path to your input file relative to the project root. Your input file should have an extension, ideally `.txt`.
|
||||||
|
- To use the Python version, run `python3 d5p2.py $INPUT`.
|
||||||
|
|
||||||
|
### Commentary (Spoilers):
|
||||||
|
<details>
|
||||||
|
<summary>**Reveal**</summary>
|
||||||
|
Godot fought me at many points. It seems to have some behavior inconsistencies, as well as some poorly made functions (namely range). Admittedly it's not meant to do this, but I feel like it shouldn't be this bad.
|
||||||
|
|
||||||
|
Part 2 is not great. Originally it was written such that in order to find the answer, 1,809,081,164 iterations of the main while loop were required. This was definitely not good. On my 3700X it would've taken ~8h22m to find the answer. Fortunately I thought of a better way while porting Part 2 to Python. Instead of 1,809,081,164 iterations, it instead now takes 34,039,469 iterations (53x improvement!). Sadly, it's also slower per iteration now. I still feel like there is a far faster way to determine the answer, but at least it can finish in less time than it takes to port it to another language.
|
||||||
|
|
||||||
|
The Python versions are as close to 1:1 with the GDScript versions as I can reasonably manage. Their biggest advantage is that they're way faster, even with stock Python.
|
||||||
|
</details>
|
||||||
|
|
1
day5/answer1
Normal file
1
day5/answer1
Normal file
|
@ -0,0 +1 @@
|
||||||
|
26273516
|
1
day5/answer2
Normal file
1
day5/answer2
Normal file
|
@ -0,0 +1 @@
|
||||||
|
34039469
|
101
day5/d5p1.gd
Normal file
101
day5/d5p1.gd
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
#!/usr/bin/godot -s
|
||||||
|
#d5p1.gd
|
||||||
|
#extends Node3D
|
||||||
|
extends SceneTree
|
||||||
|
|
||||||
|
enum Maps {
|
||||||
|
seeds,
|
||||||
|
seedToSoil,
|
||||||
|
soilToFertilizer,
|
||||||
|
fertilizerToWater,
|
||||||
|
waterToLight,
|
||||||
|
lightToTemp,
|
||||||
|
temptoHumidity,
|
||||||
|
humidityToLocation
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Column {
|
||||||
|
destination,
|
||||||
|
origin,
|
||||||
|
range
|
||||||
|
}
|
||||||
|
|
||||||
|
func file_load(path):
|
||||||
|
var file = FileAccess.open(path, FileAccess.READ)
|
||||||
|
var content = file.get_as_text()
|
||||||
|
return content
|
||||||
|
|
||||||
|
func strarr_to_arr(input):
|
||||||
|
var new = []
|
||||||
|
for i in range(0, input.size()):
|
||||||
|
new.append(input[i])
|
||||||
|
|
||||||
|
return new
|
||||||
|
|
||||||
|
func input_clean(input):
|
||||||
|
for i in range(0, input.size()):
|
||||||
|
var regex = RegEx.new()
|
||||||
|
regex.compile("^(.*-to-.* map:\n)|^(seeds: )")
|
||||||
|
input[i] = regex.sub(input[i], "", true)
|
||||||
|
|
||||||
|
# bad variable names :(
|
||||||
|
func input_format(input):
|
||||||
|
var new = []
|
||||||
|
for i in range(0, input.size()):
|
||||||
|
var temp = strarr_to_arr(input[i].split("\n"))
|
||||||
|
var temp4 = []
|
||||||
|
|
||||||
|
for j in range(0, temp.size()):
|
||||||
|
var temp2 = strarr_to_arr(temp[j].split(" "))
|
||||||
|
var temp3 = []
|
||||||
|
|
||||||
|
for k in range(0, temp2.size()):
|
||||||
|
temp3.append(int(temp2[k]))
|
||||||
|
|
||||||
|
temp4.append(temp3)
|
||||||
|
|
||||||
|
new.append(temp4)
|
||||||
|
|
||||||
|
return new
|
||||||
|
|
||||||
|
func is_mapped(map, input):
|
||||||
|
for v in map:
|
||||||
|
#if input in range(v[Column.origin], v[Column.origin]+v[Column.range]): # Fucking Godot runs out of memory when I use this
|
||||||
|
if input >= v[Column.origin] && input <= v[Column.origin]+v[Column.range]:
|
||||||
|
return v[Column.destination] + (input-v[Column.origin])
|
||||||
|
|
||||||
|
return input
|
||||||
|
|
||||||
|
func map_input(data, seed):
|
||||||
|
var temp = seed
|
||||||
|
for map in range(Maps.seedToSoil, Maps.humidityToLocation+1):
|
||||||
|
temp = is_mapped(data[map], temp)
|
||||||
|
#print("Output: %s %s" % [map, temp])
|
||||||
|
|
||||||
|
return temp
|
||||||
|
|
||||||
|
func _init():
|
||||||
|
print("Hello!")
|
||||||
|
|
||||||
|
var temp = file_load(OS.get_cmdline_user_args()[0]).split("\n\n")
|
||||||
|
input_clean(temp)
|
||||||
|
|
||||||
|
var input = input_format(temp)
|
||||||
|
#print(input[Maps.seeds])
|
||||||
|
#print(input[Maps.seedToSoil])
|
||||||
|
|
||||||
|
temp.clear()
|
||||||
|
|
||||||
|
var seeds = input[0][0]
|
||||||
|
print(seeds)
|
||||||
|
|
||||||
|
var minval = 2**32
|
||||||
|
for seed in seeds:
|
||||||
|
|
||||||
|
var location = map_input(input, seed)
|
||||||
|
|
||||||
|
if location < minval:
|
||||||
|
minval = location
|
||||||
|
|
||||||
|
print("Answer: %s" % minval)
|
||||||
|
quit()
|
115
day5/d5p1.py
Normal file
115
day5/d5p1.py
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
from enum import IntEnum
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class Maps(IntEnum):
|
||||||
|
seeds = 0
|
||||||
|
seedToSoil = 1
|
||||||
|
soilToFertilizer = 2
|
||||||
|
fertilizerToWater = 3
|
||||||
|
waterToLight = 4
|
||||||
|
lightToTemp = 5
|
||||||
|
temptoHumidity = 6
|
||||||
|
humidityToLocation = 7
|
||||||
|
|
||||||
|
class Column(IntEnum):
|
||||||
|
DESTINATION = 0
|
||||||
|
ORIGIN = 1
|
||||||
|
LENGTH = 2
|
||||||
|
|
||||||
|
def file_load(path):
|
||||||
|
file = FileAccess.open(path, FileAccess.READ)
|
||||||
|
content = file.get_as_text()
|
||||||
|
return content
|
||||||
|
|
||||||
|
def strarr_to_arr(data):
|
||||||
|
new = []
|
||||||
|
for i in range(0, len(data)):
|
||||||
|
new.append(data[i])
|
||||||
|
|
||||||
|
return new
|
||||||
|
|
||||||
|
def input_clean(data):
|
||||||
|
output = []
|
||||||
|
for i in range(len(data)):
|
||||||
|
regex = re.compile(r"^(.*-to-.* map:\n)|^(seeds: )")
|
||||||
|
output.append(regex.sub("", data[i]))
|
||||||
|
|
||||||
|
return output
|
||||||
|
|
||||||
|
# bad variable names :(
|
||||||
|
def input_format(data):
|
||||||
|
new = []
|
||||||
|
for i in range(0, len(data)):
|
||||||
|
temp = strarr_to_arr(data[i].split("\n"))
|
||||||
|
temp4 = []
|
||||||
|
|
||||||
|
for j in range(0, len(temp)):
|
||||||
|
temp2 = strarr_to_arr(temp[j].split(" "))
|
||||||
|
temp3 = []
|
||||||
|
|
||||||
|
for k in range(0, len(temp2)):
|
||||||
|
if not len(temp2[k]):
|
||||||
|
continue
|
||||||
|
temp3.append(int(temp2[k]))
|
||||||
|
|
||||||
|
temp4.append(temp3)
|
||||||
|
|
||||||
|
new.append(temp4)
|
||||||
|
|
||||||
|
return new
|
||||||
|
|
||||||
|
def is_mapped(thing, data):
|
||||||
|
for v in thing:
|
||||||
|
if data >= v[Column.ORIGIN] and data <= v[Column.ORIGIN]+v[Column.LENGTH]:
|
||||||
|
return v[Column.DESTINATION] + (data-v[Column.ORIGIN])
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
||||||
|
def is_revmapped(thing, data):
|
||||||
|
for v in thing:
|
||||||
|
if data >= v[Column.DESTINATION] and data <= v[Column.DESTINATION]+v[Column.LENGTH]:
|
||||||
|
return v[Column.ORIGIN] + (data-v[Column.DESTINATION])
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
||||||
|
def map_input(data, seed):
|
||||||
|
temp = seed
|
||||||
|
for map in range(Maps.seedToSoil, Maps.humidityToLocation+1):
|
||||||
|
temp = is_mapped(data[map], temp)
|
||||||
|
#print("Output: %s %s" % [map, temp])
|
||||||
|
|
||||||
|
return temp
|
||||||
|
|
||||||
|
def revmap_input(data, location):
|
||||||
|
temp = location
|
||||||
|
for map in range(Maps.humidityToLocation, Maps.seedToSoil-1, -1):
|
||||||
|
temp = is_revmapped(data[map], temp)
|
||||||
|
#print("Output: %s %s" % [map, temp])
|
||||||
|
|
||||||
|
return temp
|
||||||
|
|
||||||
|
def __main__():
|
||||||
|
print("Hello!")
|
||||||
|
|
||||||
|
temp = ""
|
||||||
|
with open(sys.argv[1]) as f:
|
||||||
|
temp = f.read().split("\n\n")
|
||||||
|
|
||||||
|
temp = input_clean(temp)
|
||||||
|
data = input_format(temp)
|
||||||
|
|
||||||
|
seeds = data[0][0]
|
||||||
|
print(seeds)
|
||||||
|
|
||||||
|
minval = 2**32
|
||||||
|
for seed in seeds:
|
||||||
|
location = map_input(data, seed)
|
||||||
|
|
||||||
|
if location < minval:
|
||||||
|
minval = location
|
||||||
|
|
||||||
|
print("Answer: %s" % minval)
|
||||||
|
|
||||||
|
__main__()
|
124
day5/d5p2.gd
Normal file
124
day5/d5p2.gd
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
#!/usr/bin/godot -s
|
||||||
|
#d5p2.gd
|
||||||
|
#extends Node3D
|
||||||
|
extends SceneTree
|
||||||
|
|
||||||
|
enum Maps {
|
||||||
|
seeds,
|
||||||
|
seedToSoil,
|
||||||
|
soilToFertilizer,
|
||||||
|
fertilizerToWater,
|
||||||
|
waterToLight,
|
||||||
|
lightToTemp,
|
||||||
|
temptoHumidity,
|
||||||
|
humidityToLocation
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Column {
|
||||||
|
destination,
|
||||||
|
origin,
|
||||||
|
range
|
||||||
|
}
|
||||||
|
|
||||||
|
func file_load(path):
|
||||||
|
var file = FileAccess.open(path, FileAccess.READ)
|
||||||
|
var content = file.get_as_text()
|
||||||
|
return content
|
||||||
|
|
||||||
|
func strarr_to_arr(input):
|
||||||
|
var new = []
|
||||||
|
for i in range(0, input.size()):
|
||||||
|
new.append(input[i])
|
||||||
|
|
||||||
|
return new
|
||||||
|
|
||||||
|
func input_clean(input):
|
||||||
|
for i in range(0, input.size()):
|
||||||
|
var regex = RegEx.new()
|
||||||
|
regex.compile("^(.*-to-.* map:\n)|^(seeds: )")
|
||||||
|
input[i] = regex.sub(input[i], "", true)
|
||||||
|
|
||||||
|
# bad variable names :(
|
||||||
|
func input_format(input):
|
||||||
|
var new = []
|
||||||
|
for i in range(0, input.size()):
|
||||||
|
var temp = strarr_to_arr(input[i].split("\n"))
|
||||||
|
var temp4 = []
|
||||||
|
|
||||||
|
for j in range(0, temp.size()):
|
||||||
|
var temp2 = strarr_to_arr(temp[j].split(" "))
|
||||||
|
var temp3 = []
|
||||||
|
|
||||||
|
for k in range(0, temp2.size()):
|
||||||
|
temp3.append(int(temp2[k]))
|
||||||
|
|
||||||
|
temp4.append(temp3)
|
||||||
|
|
||||||
|
new.append(temp4)
|
||||||
|
|
||||||
|
return new
|
||||||
|
|
||||||
|
func is_mapped(map, input):
|
||||||
|
for v in map:
|
||||||
|
#if input in range(v[Column.origin], v[Column.origin]+v[Column.range]): # Fucking Godot runs out of memory when I use this
|
||||||
|
if input >= v[Column.origin] && input <= v[Column.origin]+v[Column.range]:
|
||||||
|
return v[Column.destination] + (input-v[Column.origin])
|
||||||
|
|
||||||
|
return input
|
||||||
|
|
||||||
|
func is_revmapped(map, input):
|
||||||
|
for v in map:
|
||||||
|
if input >= v[Column.destination] && input <= v[Column.destination]+v[Column.range]:
|
||||||
|
return v[Column.origin] + (input-v[Column.destination])
|
||||||
|
|
||||||
|
return input
|
||||||
|
|
||||||
|
func map_input(data, seed):
|
||||||
|
var temp = seed
|
||||||
|
for map in range(Maps.seedToSoil, Maps.humidityToLocation+1):
|
||||||
|
temp = is_mapped(data[map], temp)
|
||||||
|
#print("Output: %s %s" % [map, temp])
|
||||||
|
|
||||||
|
return temp
|
||||||
|
|
||||||
|
func revmap_input(data, location):
|
||||||
|
var temp = location
|
||||||
|
for map in range(Maps.humidityToLocation, Maps.seedToSoil-1, -1):
|
||||||
|
temp = is_revmapped(data[map], temp)
|
||||||
|
#print("Output: %s %s" % [map, temp])
|
||||||
|
|
||||||
|
return temp
|
||||||
|
|
||||||
|
func _init():
|
||||||
|
print("Hello!")
|
||||||
|
|
||||||
|
var temp = file_load(OS.get_cmdline_user_args()[0]).split("\n\n")
|
||||||
|
input_clean(temp)
|
||||||
|
|
||||||
|
var input = input_format(temp)
|
||||||
|
#print(input[Maps.seeds])
|
||||||
|
#print(input[Maps.seedToSoil])
|
||||||
|
|
||||||
|
temp.clear()
|
||||||
|
|
||||||
|
var seeds = input[0][0]
|
||||||
|
print(seeds)
|
||||||
|
|
||||||
|
|
||||||
|
var testlocation = 0
|
||||||
|
while true:
|
||||||
|
if testlocation % 10000 == 0:
|
||||||
|
print(testlocation)
|
||||||
|
for i in range(0, seeds.size() / 2):
|
||||||
|
var seed = revmap_input(input, testlocation)
|
||||||
|
if seed >= seeds[i*2] && seed <= seeds[i*2]+seeds[i*2+1]:
|
||||||
|
print("Answer 2: %s" % testlocation)
|
||||||
|
print("Value is between seed %s and %s" % [seeds[i*2], seeds[i*2]+seeds[i*2+1]])
|
||||||
|
quit()
|
||||||
|
return
|
||||||
|
|
||||||
|
testlocation+=1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
140
day5/d5p2.py
Normal file
140
day5/d5p2.py
Normal file
|
@ -0,0 +1,140 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
from enum import IntEnum
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class Maps(IntEnum):
|
||||||
|
seeds = 0
|
||||||
|
seedToSoil = 1
|
||||||
|
soilToFertilizer = 2
|
||||||
|
fertilizerToWater = 3
|
||||||
|
waterToLight = 4
|
||||||
|
lightToTemp = 5
|
||||||
|
temptoHumidity = 6
|
||||||
|
humidityToLocation = 7
|
||||||
|
|
||||||
|
class Column(IntEnum):
|
||||||
|
DESTINATION = 0
|
||||||
|
ORIGIN = 1
|
||||||
|
LENGTH = 2
|
||||||
|
|
||||||
|
def file_load(path):
|
||||||
|
file = FileAccess.open(path, FileAccess.READ)
|
||||||
|
content = file.get_as_text()
|
||||||
|
return content
|
||||||
|
|
||||||
|
def strarr_to_arr(data):
|
||||||
|
new = []
|
||||||
|
for i in range(0, len(data)):
|
||||||
|
new.append(data[i])
|
||||||
|
|
||||||
|
return new
|
||||||
|
|
||||||
|
def input_clean(data):
|
||||||
|
output = []
|
||||||
|
for i in range(len(data)):
|
||||||
|
regex = re.compile(r"^(.*-to-.* map:\n)|^(seeds: )")
|
||||||
|
output.append(regex.sub("", data[i]))
|
||||||
|
|
||||||
|
return output
|
||||||
|
|
||||||
|
# bad variable names :(
|
||||||
|
def input_format(data):
|
||||||
|
new = []
|
||||||
|
for i in range(0, len(data)):
|
||||||
|
temp = strarr_to_arr(data[i].split("\n"))
|
||||||
|
temp4 = []
|
||||||
|
|
||||||
|
for j in range(0, len(temp)):
|
||||||
|
temp2 = strarr_to_arr(temp[j].split(" "))
|
||||||
|
temp3 = []
|
||||||
|
|
||||||
|
for k in range(0, len(temp2)):
|
||||||
|
if not len(temp2[k]):
|
||||||
|
continue
|
||||||
|
temp3.append(int(temp2[k]))
|
||||||
|
|
||||||
|
temp4.append(temp3)
|
||||||
|
|
||||||
|
new.append(temp4)
|
||||||
|
|
||||||
|
return new
|
||||||
|
|
||||||
|
def is_mapped(thing, data):
|
||||||
|
for v in thing:
|
||||||
|
if data >= v[Column.ORIGIN] and data <= v[Column.ORIGIN]+v[Column.LENGTH]:
|
||||||
|
return v[Column.DESTINATION] + (data-v[Column.ORIGIN])
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
||||||
|
def is_revmapped(thing, data):
|
||||||
|
for v in thing:
|
||||||
|
if data >= v[Column.DESTINATION] and data <= v[Column.DESTINATION]+v[Column.LENGTH]:
|
||||||
|
return v[Column.ORIGIN] + (data-v[Column.DESTINATION])
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
||||||
|
def map_input(data, seed):
|
||||||
|
temp = seed
|
||||||
|
for map in range(Maps.seedToSoil, Maps.humidityToLocation+1):
|
||||||
|
temp = is_mapped(data[map], temp)
|
||||||
|
#print("Output: %s %s" % [map, temp])
|
||||||
|
|
||||||
|
return temp
|
||||||
|
|
||||||
|
def revmap_input(data, location):
|
||||||
|
temp = location
|
||||||
|
for map in range(Maps.humidityToLocation, Maps.seedToSoil-1, -1):
|
||||||
|
temp = is_revmapped(data[map], temp)
|
||||||
|
#print("Output: %s %s" % [map, temp])
|
||||||
|
|
||||||
|
return temp
|
||||||
|
|
||||||
|
def __main__():
|
||||||
|
print("Hello!")
|
||||||
|
|
||||||
|
temp = ""
|
||||||
|
with open(sys.argv[1]) as f:
|
||||||
|
temp = f.read().split("\n\n")
|
||||||
|
|
||||||
|
temp = input_clean(temp)
|
||||||
|
data = input_format(temp)
|
||||||
|
#print(input[Maps.seeds])
|
||||||
|
#print(input[Maps.seedToSoil])
|
||||||
|
|
||||||
|
seeds = data[0][0]
|
||||||
|
print(seeds)
|
||||||
|
|
||||||
|
"""
|
||||||
|
minval = 2**32
|
||||||
|
for i in range(0, len(seeds) // 2):
|
||||||
|
start = seeds[i*2]
|
||||||
|
end = seeds[i*2+1]
|
||||||
|
|
||||||
|
print(f"Testing seeds: {start}-{start+end}")
|
||||||
|
|
||||||
|
for j in range(0, end):
|
||||||
|
if not j % 1000000:
|
||||||
|
print(f"Test: {start+j}")
|
||||||
|
|
||||||
|
location = map_input(data, start+j)
|
||||||
|
if location < minval:
|
||||||
|
minval = location
|
||||||
|
|
||||||
|
print(f"Answer 2: {minval}")
|
||||||
|
"""
|
||||||
|
|
||||||
|
testlocation = 0
|
||||||
|
while True:
|
||||||
|
if testlocation % 100000 == 0:
|
||||||
|
print(testlocation)
|
||||||
|
for i in range(0, len(seeds) // 2):
|
||||||
|
seed = revmap_input(data, testlocation)
|
||||||
|
if seed >= seeds[i*2] and seed <= seeds[i*2]+seeds[i*2+1]:
|
||||||
|
print(f"Answer 2: {testlocation}")
|
||||||
|
print(f"Value is between seed {seeds[i*2]} and {seeds[i*2]+seeds[i*2+1]}")
|
||||||
|
return
|
||||||
|
|
||||||
|
testlocation+=1
|
||||||
|
|
||||||
|
__main__()
|
1
day5/icon.svg
Normal file
1
day5/icon.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg height="128" width="128" xmlns="http://www.w3.org/2000/svg"><rect x="2" y="2" width="124" height="124" rx="14" fill="#363d52" stroke="#212532" stroke-width="4"/><g transform="scale(.101) translate(122 122)"><g fill="#fff"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 813 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H447l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c3 34 55 34 58 0v-86c-3-34-55-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></g></svg>
|
After Width: | Height: | Size: 950 B |
37
day5/icon.svg.import
Normal file
37
day5/icon.svg.import
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://7ruosx6gbedk"
|
||||||
|
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://icon.svg"
|
||||||
|
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
|
svg/scale=1.0
|
||||||
|
editor/scale_with_editor_scale=false
|
||||||
|
editor/convert_colors_with_editor_theme=false
|
238
day5/input.txt
Normal file
238
day5/input.txt
Normal file
|
@ -0,0 +1,238 @@
|
||||||
|
seeds: 4188359137 37519573 3736161691 172346126 2590035450 66446591 209124047 106578880 1404892542 30069991 3014689843 117426545 2169439765 226325492 1511958436 177344330 1822605035 51025110 382778843 823998526
|
||||||
|
|
||||||
|
seed-to-soil map:
|
||||||
|
1014943420 3864598346 36796924
|
||||||
|
3481858860 1134944893 176050938
|
||||||
|
1463359964 377309295 172917932
|
||||||
|
1909673912 2511534001 114785858
|
||||||
|
3472030089 1310995831 9828771
|
||||||
|
188280292 3055921442 55776498
|
||||||
|
352078282 1410745074 662865138
|
||||||
|
1436499332 3759669547 26860632
|
||||||
|
281816159 550227227 70262123
|
||||||
|
2940933503 180112079 197197216
|
||||||
|
3314718477 977633281 157311612
|
||||||
|
3269652387 3354932755 45066090
|
||||||
|
3138688421 4164003330 130963966
|
||||||
|
3689427547 3407181792 70304018
|
||||||
|
2673867052 3901395270 21291616
|
||||||
|
3881132258 2371714487 139819514
|
||||||
|
180112079 3751501334 8168213
|
||||||
|
2471524173 3399998845 7182947
|
||||||
|
244056790 3826838977 37759369
|
||||||
|
2330362750 620489350 141161423
|
||||||
|
1730119344 3786530179 40308798
|
||||||
|
1770428142 4040990485 122455143
|
||||||
|
1892883285 4024199858 16790627
|
||||||
|
3657909798 2340196738 31517749
|
||||||
|
1365072738 2268770144 71426594
|
||||||
|
1636277896 3930358410 93841448
|
||||||
|
1173574466 2626319859 183826748
|
||||||
|
3871069976 3233532062 10062282
|
||||||
|
3138130719 4163445628 557702
|
||||||
|
3759731565 3243594344 111338411
|
||||||
|
1357401214 3922686886 7671524
|
||||||
|
2478707120 2073610212 195159932
|
||||||
|
2695158668 2810146607 245774835
|
||||||
|
1051740344 3111697940 121834122
|
||||||
|
2024459770 761650773 215982508
|
||||||
|
2240442278 1320824602 89920472
|
||||||
|
4020951772 3477485810 274015524
|
||||||
|
|
||||||
|
soil-to-fertilizer map:
|
||||||
|
3211509025 2411974869 518394
|
||||||
|
3778955089 2412493263 120143427
|
||||||
|
1387254723 3589309701 265617279
|
||||||
|
3899098516 3906385182 120055953
|
||||||
|
1714049028 3209939839 261248850
|
||||||
|
3687768172 2393589437 18385432
|
||||||
|
554325135 488411873 327969675
|
||||||
|
2579624415 1520719313 60457941
|
||||||
|
4019154469 1244906486 275812827
|
||||||
|
65913262 0 488411873
|
||||||
|
1244906486 2362023384 31566053
|
||||||
|
2251369843 4026441135 268526161
|
||||||
|
0 826989738 65913262
|
||||||
|
3737515035 2233559302 41440054
|
||||||
|
1975297878 2563998121 276071965
|
||||||
|
3606812793 2152603923 80955379
|
||||||
|
3706153604 2532636690 31361431
|
||||||
|
1327930741 2336176382 25847002
|
||||||
|
3262441387 2840070086 276664362
|
||||||
|
1353777743 3176462859 33476980
|
||||||
|
1007455475 962102883 213088648
|
||||||
|
3212027419 3538895733 50413968
|
||||||
|
2519896004 3116734448 59728411
|
||||||
|
938255592 892903000 69199883
|
||||||
|
3539105749 3471188689 67707044
|
||||||
|
2640082356 1581177254 571426669
|
||||||
|
927647402 816381548 10608190
|
||||||
|
882294810 1175191531 45352592
|
||||||
|
1652872002 2274999356 61177026
|
||||||
|
1276472539 3854926980 51458202
|
||||||
|
|
||||||
|
fertilizer-to-water map:
|
||||||
|
3919934952 4034286493 116558226
|
||||||
|
3104838986 886102234 15848522
|
||||||
|
151486725 1109841455 112301087
|
||||||
|
38656834 2035810690 62773281
|
||||||
|
1106567462 3087125934 135164894
|
||||||
|
1010741746 2114463748 17027276
|
||||||
|
1428501666 0 69192244
|
||||||
|
1241732356 699332924 186769310
|
||||||
|
728534624 1829633882 45432965
|
||||||
|
465497393 318840419 263037231
|
||||||
|
263787812 69192244 201709581
|
||||||
|
1750247416 2131491024 226195640
|
||||||
|
3103410010 1396336613 1428976
|
||||||
|
1541007057 2541565636 209240359
|
||||||
|
2557596892 1222142542 146760701
|
||||||
|
3810606692 4150844719 109328260
|
||||||
|
1497693910 2098583971 15879777
|
||||||
|
2027240691 1925694260 110116430
|
||||||
|
3120687508 1664856712 30800728
|
||||||
|
2919531038 2357686664 183878972
|
||||||
|
2271333563 2800862605 286263329
|
||||||
|
0 660676090 38656834
|
||||||
|
121820432 2771196312 29666293
|
||||||
|
773967589 1428082555 236774157
|
||||||
|
2137357121 1695657440 133976442
|
||||||
|
2704357593 270901825 47938594
|
||||||
|
2782613153 952748391 136917885
|
||||||
|
4200808114 3619712494 94159182
|
||||||
|
1513573687 1368903243 27433370
|
||||||
|
3151488236 1875066847 50627413
|
||||||
|
4036493178 4260172979 34794317
|
||||||
|
1027769022 581877650 78798440
|
||||||
|
3202115649 1089666276 20175179
|
||||||
|
4071287495 3713871676 33593925
|
||||||
|
1976443056 901950756 50797635
|
||||||
|
2752296187 1397765589 30316966
|
||||||
|
101430115 2750805995 20390317
|
||||||
|
4104881420 3523785800 95926694
|
||||||
|
3523785800 3747465601 286820892
|
||||||
|
|
||||||
|
water-to-light map:
|
||||||
|
3408155249 2527370950 73535457
|
||||||
|
1697763259 1358503385 195569028
|
||||||
|
4146691798 4150439777 2978835
|
||||||
|
1667104621 3141702962 30658638
|
||||||
|
3109198454 2600906407 225322957
|
||||||
|
2896907826 3481425874 212290628
|
||||||
|
3568598531 1256359145 28510402
|
||||||
|
1021594560 3172361600 54292616
|
||||||
|
2709047387 0 23043868
|
||||||
|
634713149 1912815102 64867237
|
||||||
|
2732091255 3693716502 115595269
|
||||||
|
4005143114 4153418612 141548684
|
||||||
|
1341220299 1554072413 325884322
|
||||||
|
3514549073 2826229364 54049458
|
||||||
|
1113545862 2299696513 227674437
|
||||||
|
3481690706 1879956735 32858367
|
||||||
|
379941491 3226654216 254771658
|
||||||
|
4149670633 4005143114 145296663
|
||||||
|
699580386 1977682339 322014174
|
||||||
|
2847686524 2880278822 49221302
|
||||||
|
1075887176 23043868 37658686
|
||||||
|
3334521411 1284869547 73633838
|
||||||
|
3597108933 2929500124 212202838
|
||||||
|
1893332287 440644045 815715100
|
||||||
|
0 60702554 379941491
|
||||||
|
|
||||||
|
light-to-temperature map:
|
||||||
|
3239555722 2588818955 376881377
|
||||||
|
413170934 1615450109 438931580
|
||||||
|
1386539780 3880234113 95792562
|
||||||
|
3901352290 2965700332 122376625
|
||||||
|
2415511159 396206595 236868242
|
||||||
|
396206595 3092807515 16964339
|
||||||
|
2652379401 633074837 587176321
|
||||||
|
1998109231 1220251158 178061188
|
||||||
|
2176170419 3109771854 239340740
|
||||||
|
852102514 2054381689 534437266
|
||||||
|
1806003521 3349112594 192105710
|
||||||
|
1487062900 3976026675 318940621
|
||||||
|
1482332342 3088076957 4730558
|
||||||
|
3616437099 3687776838 138356657
|
||||||
|
3754793756 3541218304 146558534
|
||||||
|
4077829533 1398312346 217137763
|
||||||
|
4023728915 3826133495 54100618
|
||||||
|
|
||||||
|
temperature-to-humidity map:
|
||||||
|
2477444013 1065021126 6182773
|
||||||
|
845330217 1308005650 445611689
|
||||||
|
1290941906 3378900568 76961272
|
||||||
|
2975821403 1792935684 125881029
|
||||||
|
2161173272 2394771508 172817491
|
||||||
|
2483626786 3710234886 492194617
|
||||||
|
3447920062 2383111679 11659829
|
||||||
|
4033768577 1918816713 94002198
|
||||||
|
3319210784 3455861840 27565379
|
||||||
|
1373852246 1071203899 92358857
|
||||||
|
3101702432 845330217 174648768
|
||||||
|
2026258159 2567588999 134915113
|
||||||
|
1799450492 3483427219 226807667
|
||||||
|
3552117684 3041692569 337207999
|
||||||
|
3889325683 1163562756 144442894
|
||||||
|
3346776163 2047917336 101143899
|
||||||
|
3459579891 4202429503 92537793
|
||||||
|
0 348737431 60744241
|
||||||
|
1367903178 2829658946 5949068
|
||||||
|
1466211103 2702504112 127154834
|
||||||
|
1764704299 2835608014 34746193
|
||||||
|
60744241 322208375 20457270
|
||||||
|
1593365937 2870354207 171338362
|
||||||
|
81201511 342665645 6071786
|
||||||
|
4255648951 1753617339 39318345
|
||||||
|
2442345588 2012818911 35098425
|
||||||
|
2333990763 2231897270 108354825
|
||||||
|
87273297 0 322208375
|
||||||
|
4210606810 1019978985 45042141
|
||||||
|
3276351200 2340252095 42859584
|
||||||
|
4127770775 2149061235 82836035
|
||||||
|
|
||||||
|
humidity-to-location map:
|
||||||
|
4164635022 1854717524 130332274
|
||||||
|
1293632444 529805154 119897086
|
||||||
|
2886189584 4227662016 67305280
|
||||||
|
2977935483 447338344 82466810
|
||||||
|
1796689277 771172820 2500486
|
||||||
|
3592167651 2376391709 149158288
|
||||||
|
85140393 196642481 8447522
|
||||||
|
1799189763 1985049798 97611367
|
||||||
|
93587915 82281848 114360633
|
||||||
|
1191989560 4020597507 76356570
|
||||||
|
2953494864 3996156888 24440619
|
||||||
|
2292169251 649702240 113196341
|
||||||
|
3741325939 3311723608 237145571
|
||||||
|
3978471510 3948521384 47635504
|
||||||
|
2457376544 762898581 6077326
|
||||||
|
1413529530 768975907 2196913
|
||||||
|
1268346130 3923235070 25286314
|
||||||
|
4064092089 3749326886 100542933
|
||||||
|
2463453870 3849869819 73365251
|
||||||
|
2858545 0 82281848
|
||||||
|
4026107014 4166840403 37985075
|
||||||
|
3060402293 223340676 11429685
|
||||||
|
0 205090003 2858545
|
||||||
|
3071831978 1031969734 125782276
|
||||||
|
895745297 2082661165 83676280
|
||||||
|
513318799 1318499280 382426498
|
||||||
|
2536819121 3548869179 86842399
|
||||||
|
2405365592 1157752010 52010952
|
||||||
|
2086131564 3105685921 206037687
|
||||||
|
1972516256 3635711578 113615308
|
||||||
|
3197614254 2921186788 184499133
|
||||||
|
3382113387 2166337445 210054264
|
||||||
|
383000830 933333460 37595105
|
||||||
|
2777453266 1209762962 108736318
|
||||||
|
443432473 4096954077 69886326
|
||||||
|
1461500584 2540223954 335188693
|
||||||
|
1415726443 2875412647 45774141
|
||||||
|
420595935 4204825478 22836538
|
||||||
|
979421577 234770361 212567983
|
||||||
|
223340676 773673306 159660154
|
||||||
|
1911475087 970928565 61041169
|
||||||
|
1896801130 2525549997 14673957
|
||||||
|
2623661520 1700925778 153791746
|
||||||
|
|
6
day5/node_3d.tscn
Normal file
6
day5/node_3d.tscn
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://rmb3kbg2ja4p"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://d5p1.gd" id="1_p6b62"]
|
||||||
|
|
||||||
|
[node name="Node3D" type="Node3D"]
|
||||||
|
script = ExtResource("1_p6b62")
|
16
day5/project.godot
Normal file
16
day5/project.godot
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
; Engine configuration file.
|
||||||
|
; It's best edited using the editor UI and not directly,
|
||||||
|
; since the parameters that go here are not all obvious.
|
||||||
|
;
|
||||||
|
; Format:
|
||||||
|
; [section] ; section goes between []
|
||||||
|
; param=value ; assign values to parameters
|
||||||
|
|
||||||
|
config_version=5
|
||||||
|
|
||||||
|
[application]
|
||||||
|
|
||||||
|
config/name="Day 5"
|
||||||
|
run/main_scene="res://node_3d.tscn"
|
||||||
|
config/features=PackedStringArray("4.2", "Forward Plus")
|
||||||
|
config/icon="res://icon.svg"
|
34
day5/sample.txt
Normal file
34
day5/sample.txt
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
seeds: 79 14 55 13
|
||||||
|
|
||||||
|
seed-to-soil map:
|
||||||
|
50 98 2
|
||||||
|
52 50 48
|
||||||
|
|
||||||
|
soil-to-fertilizer map:
|
||||||
|
0 15 37
|
||||||
|
37 52 2
|
||||||
|
39 0 15
|
||||||
|
|
||||||
|
fertilizer-to-water map:
|
||||||
|
49 53 8
|
||||||
|
0 11 42
|
||||||
|
42 0 7
|
||||||
|
57 7 4
|
||||||
|
|
||||||
|
water-to-light map:
|
||||||
|
88 18 7
|
||||||
|
18 25 70
|
||||||
|
|
||||||
|
light-to-temperature map:
|
||||||
|
45 77 23
|
||||||
|
81 45 19
|
||||||
|
68 64 13
|
||||||
|
|
||||||
|
temperature-to-humidity map:
|
||||||
|
0 69 1
|
||||||
|
1 0 69
|
||||||
|
|
||||||
|
humidity-to-location map:
|
||||||
|
60 56 37
|
||||||
|
56 93 4
|
||||||
|
|
Loading…
Reference in a new issue