-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDay 5.txt
81 lines (78 loc) · 14.4 KB
/
Day 5.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
string input = "move 1 from 8 to 4\r\nmove 1 from 7 to 8\r\nmove 1 from 6 to 3\r\nmove 2 from 6 to 5\r\nmove 8 from 5 to 1\r\nmove 5 from 3 to 8\r\nmove 1 from 7 to 8\r\nmove 8 from 1 to 2\r\nmove 3 from 3 to 9\r\nmove 13 from 8 to 7\r\nmove 2 from 1 to 2\r\nmove 1 from 6 to 2\r\nmove 2 from 1 to 7\r\nmove 4 from 4 to 2\r\nmove 10 from 9 to 4\r\nmove 7 from 4 to 1\r\nmove 1 from 6 to 7\r\nmove 2 from 4 to 5\r\nmove 1 from 5 to 2\r\nmove 1 from 5 to 8\r\nmove 3 from 1 to 5\r\nmove 2 from 4 to 6\r\nmove 2 from 6 to 4\r\nmove 2 from 4 to 5\r\nmove 5 from 1 to 5\r\nmove 1 from 9 to 5\r\nmove 1 from 8 to 5\r\nmove 14 from 2 to 6\r\nmove 12 from 7 to 4\r\nmove 4 from 6 to 7\r\nmove 3 from 6 to 4\r\nmove 4 from 4 to 9\r\nmove 2 from 4 to 6\r\nmove 2 from 9 to 3\r\nmove 9 from 4 to 3\r\nmove 2 from 1 to 6\r\nmove 5 from 7 to 3\r\nmove 4 from 7 to 8\r\nmove 2 from 6 to 7\r\nmove 3 from 6 to 7\r\nmove 10 from 5 to 8\r\nmove 8 from 8 to 9\r\nmove 10 from 9 to 7\r\nmove 12 from 7 to 5\r\nmove 1 from 1 to 5\r\nmove 3 from 7 to 2\r\nmove 10 from 3 to 7\r\nmove 6 from 5 to 7\r\nmove 2 from 6 to 1\r\nmove 12 from 2 to 7\r\nmove 3 from 3 to 1\r\nmove 1 from 6 to 5\r\nmove 10 from 5 to 7\r\nmove 3 from 3 to 4\r\nmove 34 from 7 to 1\r\nmove 2 from 6 to 9\r\nmove 1 from 6 to 3\r\nmove 3 from 1 to 3\r\nmove 1 from 7 to 3\r\nmove 3 from 3 to 6\r\nmove 1 from 4 to 3\r\nmove 22 from 1 to 6\r\nmove 2 from 9 to 7\r\nmove 2 from 4 to 9\r\nmove 12 from 6 to 8\r\nmove 1 from 7 to 6\r\nmove 4 from 8 to 2\r\nmove 1 from 7 to 1\r\nmove 6 from 8 to 9\r\nmove 1 from 2 to 5\r\nmove 1 from 2 to 7\r\nmove 13 from 1 to 2\r\nmove 2 from 3 to 1\r\nmove 4 from 7 to 5\r\nmove 3 from 9 to 4\r\nmove 1 from 1 to 8\r\nmove 4 from 5 to 2\r\nmove 12 from 6 to 2\r\nmove 3 from 1 to 3\r\nmove 1 from 4 to 1\r\nmove 9 from 8 to 5\r\nmove 6 from 5 to 7\r\nmove 2 from 4 to 5\r\nmove 5 from 9 to 6\r\nmove 5 from 3 to 7\r\nmove 30 from 2 to 6\r\nmove 11 from 7 to 9\r\nmove 36 from 6 to 3\r\nmove 10 from 9 to 3\r\nmove 1 from 6 to 5\r\nmove 3 from 5 to 2\r\nmove 2 from 5 to 2\r\nmove 28 from 3 to 4\r\nmove 6 from 4 to 1\r\nmove 1 from 2 to 3\r\nmove 2 from 5 to 2\r\nmove 6 from 1 to 7\r\nmove 1 from 1 to 6\r\nmove 6 from 3 to 5\r\nmove 6 from 7 to 2\r\nmove 1 from 6 to 4\r\nmove 2 from 2 to 6\r\nmove 8 from 2 to 1\r\nmove 3 from 2 to 4\r\nmove 2 from 3 to 4\r\nmove 4 from 3 to 4\r\nmove 1 from 6 to 1\r\nmove 2 from 1 to 8\r\nmove 1 from 6 to 4\r\nmove 1 from 9 to 3\r\nmove 2 from 5 to 4\r\nmove 1 from 8 to 7\r\nmove 1 from 7 to 9\r\nmove 1 from 3 to 5\r\nmove 1 from 8 to 6\r\nmove 34 from 4 to 9\r\nmove 13 from 9 to 8\r\nmove 1 from 8 to 2\r\nmove 1 from 2 to 1\r\nmove 4 from 5 to 1\r\nmove 9 from 8 to 7\r\nmove 11 from 1 to 3\r\nmove 1 from 4 to 2\r\nmove 1 from 6 to 7\r\nmove 1 from 9 to 4\r\nmove 1 from 4 to 1\r\nmove 1 from 5 to 3\r\nmove 5 from 7 to 8\r\nmove 1 from 2 to 5\r\nmove 1 from 5 to 1\r\nmove 21 from 9 to 5\r\nmove 19 from 3 to 4\r\nmove 17 from 4 to 6\r\nmove 2 from 8 to 4\r\nmove 2 from 6 to 8\r\nmove 2 from 6 to 9\r\nmove 2 from 7 to 6\r\nmove 1 from 4 to 9\r\nmove 6 from 5 to 6\r\nmove 1 from 9 to 8\r\nmove 8 from 5 to 7\r\nmove 15 from 6 to 2\r\nmove 1 from 9 to 7\r\nmove 2 from 1 to 6\r\nmove 3 from 4 to 7\r\nmove 1 from 1 to 6\r\nmove 3 from 5 to 4\r\nmove 2 from 5 to 6\r\nmove 2 from 4 to 1\r\nmove 13 from 7 to 8\r\nmove 2 from 6 to 4\r\nmove 3 from 2 to 4\r\nmove 2 from 7 to 6\r\nmove 5 from 4 to 6\r\nmove 4 from 2 to 6\r\nmove 1 from 1 to 9\r\nmove 18 from 8 to 3\r\nmove 1 from 4 to 5\r\nmove 1 from 2 to 7\r\nmove 15 from 3 to 1\r\nmove 1 from 5 to 1\r\nmove 3 from 3 to 4\r\nmove 1 from 5 to 4\r\nmove 1 from 5 to 6\r\nmove 1 from 6 to 8\r\nmove 2 from 8 to 2\r\nmove 3 from 1 to 8\r\nmove 6 from 2 to 8\r\nmove 1 from 7 to 6\r\nmove 12 from 8 to 5\r\nmove 2 from 9 to 6\r\nmove 6 from 1 to 5\r\nmove 9 from 5 to 3\r\nmove 1 from 2 to 8\r\nmove 20 from 6 to 9\r\nmove 3 from 6 to 7\r\nmove 1 from 7 to 1\r\nmove 7 from 3 to 4\r\nmove 2 from 7 to 2\r\nmove 1 from 8 to 7\r\nmove 8 from 4 to 1\r\nmove 11 from 1 to 7\r\nmove 10 from 7 to 6\r\nmove 2 from 4 to 9\r\nmove 21 from 9 to 3\r\nmove 6 from 5 to 9\r\nmove 6 from 3 to 2\r\nmove 1 from 4 to 5\r\nmove 1 from 7 to 9\r\nmove 8 from 3 to 2\r\nmove 9 from 2 to 1\r\nmove 14 from 1 to 6\r\nmove 1 from 1 to 7\r\nmove 4 from 3 to 8\r\nmove 3 from 8 to 7\r\nmove 5 from 7 to 4\r\nmove 3 from 6 to 9\r\nmove 2 from 3 to 7\r\nmove 3 from 5 to 6\r\nmove 1 from 5 to 6\r\nmove 2 from 7 to 9\r\nmove 1 from 8 to 3\r\nmove 22 from 6 to 5\r\nmove 3 from 9 to 4\r\nmove 3 from 6 to 1\r\nmove 5 from 4 to 6\r\nmove 9 from 2 to 8\r\nmove 4 from 6 to 1\r\nmove 1 from 3 to 2\r\nmove 1 from 2 to 3\r\nmove 6 from 8 to 1\r\nmove 2 from 4 to 3\r\nmove 10 from 1 to 7\r\nmove 2 from 8 to 7\r\nmove 1 from 9 to 6\r\nmove 4 from 3 to 5\r\nmove 1 from 8 to 3\r\nmove 4 from 9 to 8\r\nmove 1 from 4 to 3\r\nmove 1 from 3 to 8\r\nmove 3 from 7 to 6\r\nmove 1 from 1 to 5\r\nmove 10 from 5 to 9\r\nmove 5 from 6 to 4\r\nmove 5 from 8 to 5\r\nmove 4 from 9 to 8\r\nmove 3 from 3 to 9\r\nmove 2 from 8 to 6\r\nmove 5 from 7 to 5\r\nmove 1 from 4 to 1\r\nmove 1 from 1 to 2\r\nmove 2 from 8 to 6\r\nmove 1 from 2 to 1\r\nmove 1 from 7 to 2\r\nmove 1 from 1 to 5\r\nmove 28 from 5 to 9\r\nmove 3 from 6 to 1\r\nmove 1 from 6 to 9\r\nmove 1 from 2 to 9\r\nmove 2 from 1 to 2\r\nmove 2 from 7 to 5\r\nmove 1 from 7 to 5\r\nmove 1 from 2 to 5\r\nmove 3 from 1 to 9\r\nmove 1 from 5 to 8\r\nmove 15 from 9 to 2\r\nmove 11 from 9 to 4\r\nmove 11 from 4 to 7\r\nmove 2 from 4 to 1\r\nmove 7 from 7 to 8\r\nmove 1 from 1 to 4\r\nmove 20 from 9 to 1\r\nmove 2 from 7 to 8\r\nmove 1 from 4 to 6\r\nmove 1 from 6 to 2\r\nmove 2 from 7 to 5\r\nmove 1 from 9 to 6\r\nmove 1 from 4 to 9\r\nmove 4 from 5 to 2\r\nmove 1 from 6 to 8\r\nmove 1 from 4 to 9\r\nmove 11 from 8 to 3\r\nmove 1 from 1 to 9\r\nmove 1 from 5 to 9\r\nmove 1 from 2 to 6\r\nmove 4 from 9 to 8\r\nmove 4 from 8 to 7\r\nmove 10 from 1 to 6\r\nmove 7 from 1 to 5\r\nmove 8 from 3 to 4\r\nmove 2 from 3 to 5\r\nmove 3 from 7 to 4\r\nmove 1 from 4 to 5\r\nmove 2 from 1 to 6\r\nmove 9 from 2 to 6\r\nmove 1 from 7 to 9\r\nmove 1 from 3 to 2\r\nmove 7 from 4 to 3\r\nmove 3 from 3 to 7\r\nmove 5 from 2 to 3\r\nmove 1 from 1 to 9\r\nmove 2 from 2 to 7\r\nmove 1 from 4 to 6\r\nmove 3 from 5 to 6\r\nmove 4 from 7 to 6\r\nmove 1 from 7 to 4\r\nmove 1 from 4 to 7\r\nmove 1 from 2 to 8\r\nmove 1 from 7 to 1\r\nmove 27 from 6 to 2\r\nmove 1 from 4 to 1\r\nmove 7 from 5 to 7\r\nmove 1 from 4 to 1\r\nmove 1 from 8 to 3\r\nmove 3 from 7 to 3\r\nmove 2 from 1 to 6\r\nmove 2 from 9 to 1\r\nmove 18 from 2 to 1\r\nmove 2 from 7 to 5\r\nmove 12 from 3 to 4\r\nmove 1 from 5 to 6\r\nmove 3 from 6 to 1\r\nmove 24 from 1 to 8\r\nmove 9 from 2 to 4\r\nmove 3 from 2 to 1\r\nmove 2 from 6 to 3\r\nmove 1 from 6 to 9\r\nmove 1 from 5 to 6\r\nmove 1 from 6 to 2\r\nmove 1 from 1 to 7\r\nmove 1 from 2 to 1\r\nmove 1 from 1 to 2\r\nmove 3 from 7 to 2\r\nmove 2 from 1 to 4\r\nmove 8 from 4 to 5\r\nmove 22 from 8 to 1\r\nmove 1 from 8 to 1\r\nmove 13 from 4 to 1\r\nmove 1 from 8 to 5\r\nmove 3 from 3 to 1\r\nmove 1 from 2 to 7\r\nmove 38 from 1 to 6\r\nmove 27 from 6 to 1\r\nmove 2 from 2 to 9\r\nmove 3 from 9 to 8\r\nmove 2 from 8 to 6\r\nmove 1 from 8 to 3\r\nmove 1 from 2 to 1\r\nmove 1 from 3 to 6\r\nmove 1 from 2 to 3\r\nmove 1 from 7 to 6\r\nmove 7 from 6 to 3\r\nmove 20 from 1 to 4\r\nmove 6 from 1 to 6\r\nmove 17 from 4 to 7\r\nmove 3 from 6 to 5\r\nmove 14 from 7 to 9\r\nmove 8 from 5 to 7\r\nmove 3 from 1 to 6\r\nmove 3 from 3 to 1\r\nmove 2 from 4 to 1\r\nmove 4 from 5 to 1\r\nmove 9 from 6 to 2\r\nmove 3 from 6 to 4\r\nmove 4 from 7 to 8\r\nmove 4 from 1 to 6\r\nmove 2 from 3 to 1\r\nmove 6 from 6 to 7\r\nmove 4 from 8 to 7\r\nmove 4 from 2 to 1\r\nmove 4 from 2 to 3\r\nmove 4 from 9 to 5\r\nmove 8 from 9 to 5\r\nmove 1 from 9 to 5\r\nmove 1 from 2 to 1\r\nmove 16 from 7 to 2\r\nmove 10 from 2 to 9\r\nmove 11 from 9 to 8\r\nmove 4 from 3 to 5\r\nmove 3 from 1 to 4\r\nmove 13 from 5 to 7\r\nmove 10 from 8 to 5\r\nmove 2 from 1 to 5\r\nmove 11 from 7 to 4\r\nmove 2 from 3 to 6\r\nmove 3 from 7 to 6\r\nmove 1 from 3 to 2\r\nmove 1 from 1 to 8\r\nmove 2 from 8 to 4\r\nmove 3 from 1 to 2\r\nmove 4 from 6 to 1\r\nmove 7 from 1 to 9\r\nmove 1 from 6 to 7\r\nmove 2 from 5 to 8\r\nmove 1 from 2 to 9\r\nmove 1 from 7 to 8\r\nmove 5 from 5 to 8\r\nmove 1 from 2 to 3\r\nmove 4 from 2 to 5\r\nmove 17 from 4 to 1\r\nmove 10 from 5 to 9\r\nmove 2 from 4 to 2\r\nmove 2 from 4 to 1\r\nmove 1 from 4 to 9\r\nmove 1 from 3 to 7\r\nmove 1 from 7 to 8\r\nmove 12 from 9 to 2\r\nmove 1 from 2 to 4\r\nmove 1 from 4 to 1\r\nmove 1 from 1 to 9\r\nmove 1 from 8 to 1\r\nmove 8 from 8 to 3\r\nmove 2 from 5 to 1\r\nmove 3 from 1 to 9\r\nmove 1 from 2 to 6\r\nmove 4 from 3 to 7\r\nmove 1 from 7 to 6\r\nmove 10 from 9 to 2\r\nmove 1 from 5 to 9\r\nmove 1 from 9 to 3\r\nmove 17 from 1 to 6\r\nmove 2 from 1 to 2\r\nmove 11 from 6 to 7\r\nmove 2 from 2 to 9\r\nmove 2 from 9 to 5\r\nmove 12 from 7 to 9\r\nmove 20 from 2 to 7\r\nmove 5 from 9 to 5\r\nmove 21 from 7 to 1\r\nmove 2 from 6 to 4\r\nmove 11 from 1 to 4\r\nmove 5 from 4 to 6\r\nmove 1 from 7 to 8\r\nmove 5 from 9 to 3\r\nmove 5 from 2 to 8\r\nmove 3 from 9 to 3\r\nmove 2 from 8 to 7\r\nmove 2 from 1 to 7\r\nmove 10 from 6 to 3\r\nmove 1 from 2 to 6\r\nmove 2 from 8 to 5\r\nmove 1 from 6 to 5\r\nmove 2 from 4 to 9\r\nmove 1 from 4 to 5\r\nmove 8 from 1 to 6\r\nmove 4 from 4 to 8\r\nmove 6 from 8 to 4\r\nmove 21 from 3 to 9\r\nmove 5 from 9 to 2\r\nmove 4 from 7 to 9\r\nmove 22 from 9 to 3\r\nmove 9 from 6 to 4\r\nmove 2 from 2 to 6\r\nmove 2 from 2 to 1\r\nmove 2 from 5 to 7\r\nmove 7 from 5 to 4\r\nmove 22 from 4 to 2\r\nmove 2 from 5 to 4\r\nmove 16 from 2 to 5\r\nmove 2 from 6 to 2\r\nmove 13 from 3 to 4\r\nmove 5 from 5 to 7\r\nmove 15 from 4 to 7\r\nmove 3 from 2 to 3\r\nmove 3 from 2 to 5\r\nmove 1 from 1 to 2\r\nmove 1 from 2 to 4\r\nmove 6 from 5 to 9\r\nmove 4 from 3 to 6\r\nmove 2 from 5 to 9\r\nmove 1 from 2 to 7\r\nmove 1 from 1 to 9\r\nmove 2 from 4 to 5\r\nmove 19 from 7 to 8\r\nmove 1 from 6 to 5\r\nmove 1 from 5 to 1\r\nmove 1 from 9 to 4\r\nmove 5 from 8 to 1\r\nmove 3 from 8 to 1\r\nmove 7 from 5 to 6\r\nmove 3 from 7 to 1\r\nmove 1 from 2 to 5\r\nmove 4 from 9 to 8\r\nmove 2 from 5 to 6\r\nmove 10 from 1 to 4\r\nmove 1 from 7 to 2\r\nmove 6 from 3 to 4\r\nmove 9 from 4 to 3\r\nmove 2 from 2 to 8\r\nmove 2 from 9 to 5\r\nmove 5 from 8 to 3\r\nmove 1 from 1 to 5\r\nmove 2 from 5 to 6\r\nmove 1 from 1 to 7\r\nmove 2 from 9 to 7\r\nmove 8 from 4 to 7\r\nmove 3 from 3 to 9\r\nmove 4 from 6 to 3\r\nmove 1 from 5 to 3\r\nmove 1 from 7 to 2\r\nmove 1 from 2 to 1\r\nmove 1 from 6 to 5\r\nmove 1 from 5 to 2\r\nmove 10 from 7 to 4\r\nmove 10 from 4 to 1\r\nmove 10 from 1 to 8\r\nmove 1 from 9 to 6\r\nmove 1 from 1 to 4\r\nmove 11 from 8 to 1\r\nmove 2 from 9 to 5\r\nmove 5 from 6 to 3\r\nmove 1 from 3 to 8\r\nmove 4 from 1 to 3\r\nmove 5 from 3 to 8\r\nmove 1 from 4 to 7\r\nmove 1 from 7 to 2\r\nmove 13 from 3 to 5\r\nmove 2 from 2 to 1\r\nmove 4 from 3 to 1\r\nmove 4 from 5 to 6\r\nmove 3 from 6 to 2\r\nmove 4 from 5 to 4\r\nmove 8 from 8 to 7\r\nmove 1 from 3 to 9";
string[] moves = input.Split("\r\n");
List<string[]> movesList = new List<string[]>();
foreach (string s in moves)
{
string[] temp = s.Split(" ");
movesList.Add(temp);
}
Stack<string> one = new Stack<string>(new string[] { "J", "H", "P", "M", "S", "F", "N", "V" });
Stack<string> two = new Stack<string>(new string[] { "S", "R", "L", "M", "J", "D", "Q" });
Stack<string> three = new Stack<string>(new string[] { "N", "Q", "D", "H", "C", "S", "W", "B" });
Stack<string> four = new Stack<string>(new string[] { "R", "S", "C", "L" });
Stack<string> five = new Stack<string>(new string[] { "M", "V", "T", "P", "F", "B" });
Stack<string> six = new Stack<string>(new string[] { "T", "R", "Q", "N", "C" });
Stack<string> seven = new Stack<string>(new string[] { "G", "V", "R" });
Stack<string> eight = new Stack<string>(new string[] { "C", "Z", "S", "P", "D", "L", "R" });
Stack<string> nine = new Stack<string>(new string[] { "D", "S", "J", "V", "G", "P", "B", "F" });
foreach (string[] action in movesList)
{
Stack<string> tempStack = new Stack<string>();
int amount = Convert.ToInt32(action[1]);
int from = Convert.ToInt32(action[3]);
int to = Convert.ToInt32(action[5]);
string temp;
for (int i = 0; i < amount; i++)
{
if (from == 1)
temp = one.Pop();
else if (from == 2)
temp = two.Pop();
else if (from == 3)
temp = three.Pop();
else if (from == 4)
temp = four.Pop();
else if (from == 5)
temp = five.Pop();
else if (from == 6)
temp = six.Pop();
else if (from == 7)
temp = seven.Pop();
else if (from == 8)
temp = eight.Pop();
else
temp = nine.Pop();
tempStack.Push(temp);
}
for (int i = 0; i < amount; i++)
{
temp = tempStack.Pop();
if (to == 1)
one.Push(temp);
else if (to == 2)
two.Push(temp);
else if (to == 3)
three.Push(temp);
else if (to == 4)
four.Push(temp);
else if (to == 5)
five.Push(temp);
else if (to == 6)
six.Push(temp);
else if (to == 7)
seven.Push(temp);
else if (to == 8)
eight.Push(temp);
else
nine.Push(temp);
}
}
Console.WriteLine(one.Peek());
Console.WriteLine(two.Peek());
Console.WriteLine(three.Peek());
Console.WriteLine(four.Peek());
Console.WriteLine(five.Peek());
Console.WriteLine(six.Peek());
Console.WriteLine(seven.Peek());
Console.WriteLine(eight.Peek());
Console.WriteLine(nine.Peek());