SHOW:
|
|
- or go back to the newest paste.
1 | class Program { | |
2 | static void Main(){ | |
3 | int[] m = System.Linq.Enumerable.ToArray(System.Linq.Enumerable.OrderBy(new [] {1, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, x => System.Guid.NewGuid())); | |
4 | while (System.Linq.Enumerable.Any(m, x => x < m.Length - 1 && m[x] > m[x + 1])) { | |
5 | System.Console.WriteLine((m[0]+"\t"+m[1]+"\t"+m[2]+"\t"+m[3]+"\n"+m[4]+"\t"+m[5]+"\t"+m[6]+"\t"+m[7]+"\n"+m[8]+"\t"+m[9]+"\t"+m[10]+"\t"+m[11]+"\n"+m[12]+"\t"+m[13]+"\t"+m[14]+"\t"+m[15]+"\n").Replace("0", "x").Replace("1x", "10")); //draw board | |
6 | new System.Action<int>(k => m[System.Array.IndexOf(m, 0)] += ((k == -1 && System.Array.IndexOf(m, 0) % 4 == 0) || (k == 1 && (System.Array.IndexOf(m, 0) + 1) % 4 == 0) || System.Array.IndexOf(m, 0) + k < 0 || System.Array.IndexOf(m, 0) + k >= m.Length) ? 0 : m[System.Array.IndexOf(m, 0) + k] - (m[System.Array.IndexOf(m, 0) + k] = m[System.Array.IndexOf(m, 0)]))(new [] { -1, -4, 1, 4 }[(int)System.Console.ReadKey().Key - 37]);}}} |