public string RunPart1(IEnumerable <string> testData) { var input = testData.First().Split(','); // Start at home var current = new HexPoint(0, 0, 0); foreach (var direction in input) { var point = _actions[direction]; current = current.AddPoint(point); } return(current.CalculateDistanceToRoot().ToString()); }
public string RunPart2(IEnumerable <string> testData) { var input = testData.First().Split(','); var current = new HexPoint(0, 0, 0); int max = 0; foreach (var direction in input) { var point = _actions[direction]; current = current.AddPoint(point); // I can go the distance! I have found my way, if I can be-e strong! I know every mile would be worth my while // if I can go the distance I'll be right where I-I-I.... belooooooooong! var distance = current.CalculateDistanceToRoot(); if (distance > max) { max = distance; } } return(max.ToString()); }