private string[] GetFaceString(FaceLayout2D face) { if (face == null) { return(new string[3] { " ", " ", " " }); } return(Faces[face.Self].GetFaceString(face)); }
public void ResetFromCubeReader(CubeReader rotate, FaceLayout2D postion, int times) { this[postion.Self, postion.Left, postion.Up] = FakeColor(rotate[times, 0, 0]); this[postion.Self, postion.Self, postion.Up] = FakeColor(rotate[times, 0, 1]); this[postion.Self, postion.Right, postion.Up] = FakeColor(rotate[times, 0, 2]); this[postion.Self, postion.Left, postion.Self] = FakeColor(rotate[times, 1, 0]); this[postion.Self, postion.Self, postion.Self] = FakeColor(rotate[times, 1, 1]); this[postion.Self, postion.Right, postion.Self] = FakeColor(rotate[times, 1, 2]); this[postion.Self, postion.Left, postion.Down] = FakeColor(rotate[times, 2, 0]); this[postion.Self, postion.Self, postion.Down] = FakeColor(rotate[times, 2, 1]); this[postion.Self, postion.Right, postion.Down] = FakeColor(rotate[times, 2, 2]); }
private void Print3Faces(FaceLayout2D left, FaceLayout2D center, FaceLayout2D right) { string[] side1 = GetFaceString(left); string[] side2 = GetFaceString(center); string[] side3 = GetFaceString(right); for (int i = 0; i < 3; i++) { //Console.WriteLine("{0}|{1}|{2}", s1[i], s2[i], s3[i]); bool isFirst = true; foreach (var side in new string[][] { side1, side2, side3 }) { if (!isFirst) { Console.Write('|'); } isFirst = false; string[] cells = side[i].Split(':'); if (cells.Length == 1) { Console.Write($"{side[i]}"); } else { foreach (var cell in cells) { if (cell.Trim().Length > 0) { int color = cell.Trim()[0] - '0'; //map the color to what is on my cube color = (int)Face.GetColorForFace((sbyte)color); //set background color with intensity using (new ConsoleColor(color | (int)ConsoleColor.BackGroundColor.White)) { Console.Write($"{cell}"); } Console.Write(":"); } } } } Console.WriteLine(); } Console.WriteLine("____________________________________"); }
public string[] GetFaceString(FaceLayout2D position) { string[] ret = new string[3]; ret[0] = String.Format("{0}{1}{2}", this[position.Self, position.Left, position.Up], this[position.Self, position.Self, position.Up], this[position.Self, position.Right, position.Up] ); ret[1] = String.Format("{0}{1}{2}", this[position.Self, position.Left, position.Self], this[position.Self, position.Self, position.Self], this[position.Self, position.Right, position.Self] ); ret[2] = String.Format("{0}{1}{2}", this[position.Self, position.Left, position.Down], this[position.Self, position.Self, position.Down], this[position.Self, position.Right, position.Down] ); return(ret); }