Exemple #1
0
        public SlotSideModelBase FindSideSlot(CubeModel cube,
                                              IList <StickerIndexModel> stickers
                                              )
        {
            SlotSideModelBase result = null;

            PieceFrontNorthModel pieceFrontNorthWest = new PieceFrontNorthModel(XyzCubeTypes.OrangeWhiteBlue);

            IList <StickerIndexModel> orangeStickers = stickers.Where(x => x.SideStickerColorType == StickerColorTypes.Orange).ToList();
            IList <StickerIndexModel> whiteStickers  = stickers.Where(x => x.SideStickerColorType == StickerColorTypes.White).ToList();
            IList <StickerIndexModel> blueeStickers  = stickers.Where(x => x.SideStickerColorType == StickerColorTypes.Blue).ToList();



            return(result);
        }
Exemple #2
0
        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);
        }