mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-26 13:20:32 +01:00
Initial work on day 22.
This commit is contained in:
100
2019/inputs/22.txt
Normal file
100
2019/inputs/22.txt
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
cut -8737
|
||||||
|
deal with increment 36
|
||||||
|
deal into new stack
|
||||||
|
deal with increment 32
|
||||||
|
cut -3856
|
||||||
|
deal with increment 27
|
||||||
|
deal into new stack
|
||||||
|
cut 8319
|
||||||
|
deal with increment 15
|
||||||
|
deal into new stack
|
||||||
|
deal with increment 53
|
||||||
|
cut 2157
|
||||||
|
deal with increment 3
|
||||||
|
deal into new stack
|
||||||
|
cut 9112
|
||||||
|
deal with increment 59
|
||||||
|
cut 957
|
||||||
|
deal with increment 28
|
||||||
|
cut -9423
|
||||||
|
deal with increment 51
|
||||||
|
deal into new stack
|
||||||
|
deal with increment 8
|
||||||
|
cut 3168
|
||||||
|
deal with increment 16
|
||||||
|
cut 6558
|
||||||
|
deal with increment 32
|
||||||
|
deal into new stack
|
||||||
|
cut -8246
|
||||||
|
deal with increment 40
|
||||||
|
cut 4405
|
||||||
|
deal with increment 9
|
||||||
|
cut -2225
|
||||||
|
deal with increment 36
|
||||||
|
cut -5080
|
||||||
|
deal with increment 59
|
||||||
|
cut -648
|
||||||
|
deal with increment 64
|
||||||
|
cut -1845
|
||||||
|
deal into new stack
|
||||||
|
cut -7726
|
||||||
|
deal with increment 44
|
||||||
|
cut 1015
|
||||||
|
deal with increment 12
|
||||||
|
cut 960
|
||||||
|
deal with increment 30
|
||||||
|
deal into new stack
|
||||||
|
deal with increment 65
|
||||||
|
deal into new stack
|
||||||
|
deal with increment 27
|
||||||
|
cut 6877
|
||||||
|
deal with increment 5
|
||||||
|
deal into new stack
|
||||||
|
cut -3436
|
||||||
|
deal with increment 63
|
||||||
|
deal into new stack
|
||||||
|
deal with increment 71
|
||||||
|
deal into new stack
|
||||||
|
deal with increment 7
|
||||||
|
cut -9203
|
||||||
|
deal with increment 38
|
||||||
|
cut 9008
|
||||||
|
deal with increment 59
|
||||||
|
deal into new stack
|
||||||
|
deal with increment 13
|
||||||
|
cut 5979
|
||||||
|
deal with increment 55
|
||||||
|
cut 9483
|
||||||
|
deal with increment 65
|
||||||
|
cut -9250
|
||||||
|
deal with increment 75
|
||||||
|
deal into new stack
|
||||||
|
cut -1830
|
||||||
|
deal with increment 55
|
||||||
|
deal into new stack
|
||||||
|
deal with increment 67
|
||||||
|
cut -8044
|
||||||
|
deal into new stack
|
||||||
|
cut 8271
|
||||||
|
deal with increment 51
|
||||||
|
cut 6002
|
||||||
|
deal into new stack
|
||||||
|
deal with increment 47
|
||||||
|
cut 3638
|
||||||
|
deal with increment 18
|
||||||
|
cut -785
|
||||||
|
deal with increment 63
|
||||||
|
cut -2460
|
||||||
|
deal with increment 25
|
||||||
|
cut 5339
|
||||||
|
deal with increment 61
|
||||||
|
cut -5777
|
||||||
|
deal with increment 54
|
||||||
|
deal into new stack
|
||||||
|
cut 8075
|
||||||
|
deal into new stack
|
||||||
|
deal with increment 22
|
||||||
|
cut 3443
|
||||||
|
deal with increment 34
|
||||||
|
cut 5193
|
||||||
|
deal with increment 3
|
||||||
@@ -1,7 +1,30 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "days.hpp"
|
#include "days.hpp"
|
||||||
|
#include "utils.hpp"
|
||||||
|
|
||||||
void aoc2019::day22_part1(std::istream &input, std::ostream &output) {
|
void aoc2019::day22_part1(std::istream &input, std::ostream &output) {
|
||||||
|
std::int64_t increment = 1;
|
||||||
|
std::int64_t offset = 0;
|
||||||
|
|
||||||
|
constexpr std::int64_t DECK_SIZE = 10007;
|
||||||
|
|
||||||
|
std::string buffer;
|
||||||
|
while (std::getline(input, buffer)) {
|
||||||
|
std::string_view line = buffer;
|
||||||
|
if (!line.find("deal into new stack")) {
|
||||||
|
increment *= -1;
|
||||||
|
} else if (!line.find("deal with increment ")) {
|
||||||
|
std::int64_t new_increment;
|
||||||
|
from_chars(line.substr(20), new_increment);
|
||||||
|
increment *= new_increment;
|
||||||
|
increment %= DECK_SIZE;
|
||||||
|
} else {
|
||||||
|
std::int64_t new_offset;
|
||||||
|
from_chars(line, new_offset);
|
||||||
|
offset += increment * new_offset;
|
||||||
|
offset %= DECK_SIZE;
|
||||||
|
}
|
||||||
|
}
|
||||||
output << "Not implemented\n";
|
output << "Not implemented\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user