Day 15 (visualisation)
This commit is contained in:
parent
fb867cec67
commit
fb8e6cf5dc
5 changed files with 36 additions and 1 deletions
BIN
15-rambunctiousRecitation/0.png
Normal file
BIN
15-rambunctiousRecitation/0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
BIN
15-rambunctiousRecitation/1-hires.png
Normal file
BIN
15-rambunctiousRecitation/1-hires.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 42 KiB |
BIN
15-rambunctiousRecitation/1-lores.png
Normal file
BIN
15-rambunctiousRecitation/1-lores.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
|
@ -1,8 +1,14 @@
|
|||
# [Day 15: Rambunctious Recitation](https://adventofcode.com/2020/day/15)
|
||||
|
||||
### Visualisation
|
||||
|
||||
| Part one | Part two |
|
||||
| ------------------------------ | ------------------------------------ |
|
||||
|  |  |
|
||||
|
||||
### Related
|
||||
|
||||
* [Numberphile - Don't Know (the Van Eck Sequence)](https://www.youtube.com/watch?v=etMJxB-igrc)
|
||||
- [Numberphile - Don't Know (the Van Eck Sequence)](https://www.youtube.com/watch?v=etMJxB-igrc)
|
||||
|
||||
<details><summary>Script output</summary>
|
||||
|
||||
|
|
29
15-rambunctiousRecitation/python/visualise.py
Normal file
29
15-rambunctiousRecitation/python/visualise.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
import common
|
||||
import matplotlib.pyplot as plt
|
||||
from typing import List
|
||||
|
||||
def make_graph(data:List[int], n:int):
|
||||
line_colour = "#3572a5"
|
||||
plt.plot(list(range(len(data))), data, color=line_colour)
|
||||
plt.title(f"AoC 2020, day 15 part {n}")
|
||||
plt.xlabel("Iteration number")
|
||||
plt.ylabel("Value")
|
||||
|
||||
def visualise(instr:str):
|
||||
print("Running part one...")
|
||||
_, one = common.find_value_n(instr, 2020)
|
||||
print("Making graph")
|
||||
make_graph(one, 1)
|
||||
print("Saving")
|
||||
plt.savefig("0.png")
|
||||
plt.clf()
|
||||
print("Running part two...")
|
||||
_, two = common.find_value_n(instr, 30000000)
|
||||
print("Making graph")
|
||||
make_graph(two, 2)
|
||||
print("Saving low resolution")
|
||||
plt.savefig("1-lores.png")
|
||||
print("Saving high resolution")
|
||||
fig = plt.gcf()
|
||||
fig.set_size_inches(20.48, 10.8)
|
||||
fig.savefig('1-hires.png', dpi=100)
|
Loading…
Add table
Add a link
Reference in a new issue