42 lines
1.3 KiB
C#
42 lines
1.3 KiB
C#
#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 |