public CubeModel Create(XyzCubeTypes patternCubeType, String[] sides) { var cubePeiceBag = new CubePeiceBagModel(patternCubeType); var result = new CubeModel(cubePeiceBag); List <StickerIndexModel> GetCorners(Char[] rawStickers, StickerColorTypes stickerColorType) { return(new List <StickerIndexModel>() { new StickerIndexModel(this.GetStickerColorType(rawStickers[0]), 0, stickerColorType), new StickerIndexModel(this.GetStickerColorType(rawStickers[2]), 2, stickerColorType), new StickerIndexModel(this.GetStickerColorType(rawStickers[6]), 6, stickerColorType), new StickerIndexModel(this.GetStickerColorType(rawStickers[8]), 8, stickerColorType) }); } List <StickerIndexModel> GetSides(Char[] rawStickers, StickerColorTypes stickerColorType) { return(new List <StickerIndexModel>() { new StickerIndexModel(this.GetStickerColorType(rawStickers[1]), 1, stickerColorType), new StickerIndexModel(this.GetStickerColorType(rawStickers[3]), 3, stickerColorType), new StickerIndexModel(this.GetStickerColorType(rawStickers[5]), 5, stickerColorType), new StickerIndexModel(this.GetStickerColorType(rawStickers[7]), 7, stickerColorType) }); } String whiteCommand = String.Empty; String yellowCommand = String.Empty; String blueCommand = String.Empty; String greenCommand = String.Empty; String redCommand = String.Empty; String orangeCommand = String.Empty; { foreach (var side in sides) { switch (side[4]) { case 'W': whiteCommand = side; break; case 'Y': yellowCommand = side; break; case 'B': blueCommand = side; break; case 'G': greenCommand = side; break; case 'R': redCommand = side; break; case 'O': orangeCommand = side; break; default: break; } } } this.VerifyRawCube(whiteCommand, yellowCommand, blueCommand, greenCommand, redCommand, orangeCommand); Char[] whiteStep = whiteCommand.ToCharArray(); Char[] yellowStep = yellowCommand.ToCharArray(); Char[] blueStep = blueCommand.ToCharArray(); Char[] greenStep = greenCommand.ToCharArray(); Char[] redStep = redCommand.ToCharArray(); Char[] orangeStep = orangeCommand.ToCharArray(); var allStickers = new List <StickerIndexModel>(); allStickers.AddRange(GetCorners(whiteStep, StickerColorTypes.White)); allStickers.AddRange(GetCorners(yellowStep, StickerColorTypes.Yellow)); allStickers.AddRange(GetCorners(blueStep, StickerColorTypes.Blue)); allStickers.AddRange(GetCorners(greenStep, StickerColorTypes.Green)); allStickers.AddRange(GetCorners(redStep, StickerColorTypes.Red)); allStickers.AddRange(GetCorners(orangeStep, StickerColorTypes.Orange)); allStickers.AddRange(GetSides(whiteStep, StickerColorTypes.White)); allStickers.AddRange(GetSides(yellowStep, StickerColorTypes.Yellow)); allStickers.AddRange(GetSides(blueStep, StickerColorTypes.Blue)); allStickers.AddRange(GetSides(greenStep, StickerColorTypes.Green)); allStickers.AddRange(GetSides(redStep, StickerColorTypes.Red)); allStickers.AddRange(GetSides(orangeStep, StickerColorTypes.Orange)); SlotSideModelBase pieceFrontNorthModel = this.FindSideSlot(result, allStickers); return(null); }
public CubeModel(CubePeiceBagModel cubePeiceBag) { this.Front.Piece = cubePeiceBag.FrontPiece; this.Back.Piece = cubePeiceBag.BackPiece; this.North.Piece = cubePeiceBag.NorthPiece; this.East.Piece = cubePeiceBag.EastPiece; this.South.Piece = cubePeiceBag.SouthPiece; this.West.Piece = cubePeiceBag.WestPiece; this.FrontNorth.Piece = cubePeiceBag.FrontNorthPiece; this.FrontEast.Piece = cubePeiceBag.FrontEastPiece; this.FrontSouth.Piece = cubePeiceBag.FrontSouthPiece; this.FrontWest.Piece = cubePeiceBag.FrontWestPiece; this.FrontNorthEast.Piece = cubePeiceBag.FrontNorthEastPiece; this.FrontSouthEast.Piece = cubePeiceBag.FrontSouthEastPiece; this.FrontSouthWest.Piece = cubePeiceBag.FrontSouthWestPiece; this.FrontNorthWest.Piece = cubePeiceBag.FrontNorthWestPiece; this.NorthEast.Piece = cubePeiceBag.NorthEastPiece; this.SouthEast.Piece = cubePeiceBag.SouthEastPiece; this.SouthWest.Piece = cubePeiceBag.SouthWestPiece; this.NorthWest.Piece = cubePeiceBag.NorthWestPiece; this.BackNorth.Piece = cubePeiceBag.BackNorthPiece; this.BackEast.Piece = cubePeiceBag.BackEastPiece; this.BackSouth.Piece = cubePeiceBag.BackSouthPiece; this.BackWest.Piece = cubePeiceBag.BackWestPiece; this.BackNorthEast.Piece = cubePeiceBag.BackNorthEastPiece; this.BackSouthEast.Piece = cubePeiceBag.BackSouthEastPiece; this.BackSouthWest.Piece = cubePeiceBag.BackSouthWestPiece; this.BackNorthWest.Piece = cubePeiceBag.BackNorthWestPiece; this.FrontNorthWest.AdjacentSideSlots.Add(this.FrontNorth); this.FrontNorthWest.AdjacentSideSlots.Add(this.NorthWest); this.FrontNorthWest.AdjacentSideSlots.Add(this.FrontWest); this.FrontNorth.AdjacentCornerSlots.Add(this.FrontNorthWest); this.FrontNorth.AdjacentCornerSlots.Add(this.FrontNorthEast); this.FrontNorth.AdjacentMiddlePieces.Add(this.Front); this.FrontNorth.AdjacentMiddlePieces.Add(this.North); this.FrontNorthEast.AdjacentSideSlots.Add(this.FrontNorth); this.FrontNorthEast.AdjacentSideSlots.Add(this.NorthEast); this.FrontNorthEast.AdjacentSideSlots.Add(this.FrontEast); this.NorthEast.AdjacentCornerSlots.Add(this.FrontNorthEast); this.NorthEast.AdjacentCornerSlots.Add(this.BackNorthEast); this.NorthEast.AdjacentMiddlePieces.Add(this.North); this.NorthEast.AdjacentMiddlePieces.Add(this.East); this.BackNorthEast.AdjacentSideSlots.Add(this.BackNorth); this.BackNorthEast.AdjacentSideSlots.Add(this.NorthEast); this.BackNorthEast.AdjacentSideSlots.Add(this.BackEast); this.BackNorth.AdjacentCornerSlots.Add(this.BackNorthEast); this.BackNorth.AdjacentCornerSlots.Add(this.BackNorthWest); this.BackNorth.AdjacentMiddlePieces.Add(this.Back); this.BackNorth.AdjacentMiddlePieces.Add(this.North); this.BackNorthWest.AdjacentSideSlots.Add(this.BackNorth); this.BackNorthWest.AdjacentSideSlots.Add(this.NorthWest); this.BackNorthWest.AdjacentSideSlots.Add(this.BackWest); this.FrontWest.AdjacentCornerSlots.Add(this.FrontNorthWest); this.FrontWest.AdjacentCornerSlots.Add(this.FrontSouthWest); this.FrontWest.AdjacentMiddlePieces.Add(this.Front); this.FrontWest.AdjacentMiddlePieces.Add(this.West); this.FrontEast.AdjacentCornerSlots.Add(this.FrontNorthEast); this.FrontEast.AdjacentCornerSlots.Add(this.FrontSouthEast); this.FrontEast.AdjacentMiddlePieces.Add(this.Front); this.FrontEast.AdjacentMiddlePieces.Add(this.East); this.BackWest.AdjacentCornerSlots.Add(this.BackNorthWest); this.BackWest.AdjacentCornerSlots.Add(this.BackSouthWest); this.BackWest.AdjacentMiddlePieces.Add(this.Back); this.BackWest.AdjacentMiddlePieces.Add(this.West); this.BackEast.AdjacentCornerSlots.Add(this.BackNorthEast); this.BackEast.AdjacentCornerSlots.Add(this.BackSouthEast); this.BackEast.AdjacentMiddlePieces.Add(this.Back); this.BackEast.AdjacentMiddlePieces.Add(this.East); this.FrontSouthWest.AdjacentSideSlots.Add(this.FrontSouth); this.FrontSouthWest.AdjacentSideSlots.Add(this.SouthWest); this.FrontSouthWest.AdjacentSideSlots.Add(this.FrontWest); this.FrontSouth.AdjacentCornerSlots.Add(this.FrontSouthWest); this.FrontSouth.AdjacentCornerSlots.Add(this.FrontSouthEast); this.FrontSouth.AdjacentMiddlePieces.Add(this.Front); this.FrontSouth.AdjacentMiddlePieces.Add(this.South); this.FrontSouthEast.AdjacentSideSlots.Add(this.FrontSouth); this.FrontSouthEast.AdjacentSideSlots.Add(this.SouthEast); this.FrontSouthEast.AdjacentSideSlots.Add(this.FrontEast); this.SouthEast.AdjacentCornerSlots.Add(this.FrontSouthEast); this.SouthEast.AdjacentCornerSlots.Add(this.BackSouthEast); this.SouthEast.AdjacentMiddlePieces.Add(this.South); this.SouthEast.AdjacentMiddlePieces.Add(this.East); this.BackSouthEast.AdjacentSideSlots.Add(this.BackEast); this.BackSouthEast.AdjacentSideSlots.Add(this.BackSouth); this.BackSouthEast.AdjacentSideSlots.Add(this.SouthEast); this.BackSouth.AdjacentCornerSlots.Add(this.BackSouthEast); this.BackSouth.AdjacentCornerSlots.Add(this.BackSouthWest); this.BackSouth.AdjacentMiddlePieces.Add(this.Back); this.BackSouth.AdjacentMiddlePieces.Add(this.South); this.BackSouthWest.AdjacentSideSlots.Add(this.BackSouth); this.BackSouthWest.AdjacentSideSlots.Add(this.BackWest); this.BackSouthWest.AdjacentSideSlots.Add(this.SouthWest); this.North.AdjacentSideSlots.Add(this.BackNorth); this.North.AdjacentSideSlots.Add(this.NorthEast); this.North.AdjacentSideSlots.Add(this.FrontNorth); this.North.AdjacentSideSlots.Add(this.NorthWest); this.South.AdjacentSideSlots.Add(this.BackSouth); this.South.AdjacentSideSlots.Add(this.SouthEast); this.South.AdjacentSideSlots.Add(this.FrontSouth); this.South.AdjacentSideSlots.Add(this.SouthWest); this.East.AdjacentSideSlots.Add(this.NorthEast); this.East.AdjacentSideSlots.Add(this.FrontEast); this.East.AdjacentSideSlots.Add(this.SouthEast); this.East.AdjacentSideSlots.Add(this.BackEast); this.West.AdjacentSideSlots.Add(this.NorthWest); this.West.AdjacentSideSlots.Add(this.FrontWest); this.West.AdjacentSideSlots.Add(this.SouthWest); this.West.AdjacentSideSlots.Add(this.BackWest); this.Front.AdjacentSideSlots.Add(this.FrontNorth); this.Front.AdjacentSideSlots.Add(this.FrontEast); this.Front.AdjacentSideSlots.Add(this.FrontSouth); this.Front.AdjacentSideSlots.Add(this.FrontWest); this.Back.AdjacentSideSlots.Add(this.BackNorth); this.Back.AdjacentSideSlots.Add(this.BackEast); this.Back.AdjacentSideSlots.Add(this.BackSouth); this.Back.AdjacentSideSlots.Add(this.BackWest); }