Day 23 (unfinished)
This commit is contained in:
parent
05c9339028
commit
e41c655d6c
2
Day22.cs
2
Day22.cs
|
|
@ -1,4 +1,4 @@
|
|||
#define Day22
|
||||
// #define Day22
|
||||
#if Day22
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
#define Day23
|
||||
#if Day23
|
||||
|
||||
var lines = File.ReadAllLines("day23/input")
|
||||
.ToList();
|
||||
|
||||
var aStack = new Stack<char>();
|
||||
var bStack = new Stack<char>();
|
||||
var cStack = new Stack<char>();
|
||||
var dStack = new Stack<char>();
|
||||
|
||||
var stackSpace = new Dictionary<Stack<char>, int>() {{aStack, 2}, {bStack, 4}, {cStack, 6}, {dStack, 8}};
|
||||
var moveCost = new Dictionary<char, int>() {{'A', 1},{'B', 10},{'C', 100},{'D', 1000}};
|
||||
var spaces = Enumerable.Repeat('.', 11).ToArray();
|
||||
|
||||
foreach ((var stack, var space) in stackSpace) {
|
||||
int pos = 2;
|
||||
while (pos < lines.Count && lines[pos][space+1] != '#') {
|
||||
stack.Push(lines[pos][space+1]);
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
|
||||
Console.WriteLine("adsf");
|
||||
|
||||
|
||||
long Solve(Dictionary<Stack<char>, int> stackSpace, char[] spaces) {
|
||||
if (spaces.Any(c => c != '.')) {
|
||||
|
||||
}
|
||||
|
||||
// first check that all chars from spaces that can be moved to its corresponding stack has been moved
|
||||
// if possible, call recursive (remember what has been moved and undo after call)
|
||||
// iterate all stacks, check if stack contains element that does not fit. then move the top most element
|
||||
// after move, call recursive
|
||||
|
||||
// if move is not possible, return int max? each recursive all needs to optimize su-calls to minimum. hand down current minimum to check against? (can be done in second step. solve first?)
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#############
|
||||
#...........#
|
||||
###B#C#C#B###
|
||||
#D#D#A#A#
|
||||
#########
|
||||
Loading…
Reference in New Issue