コード例 #1
0
 public CubeFace(BitColour colour)
 {
     for (int i = 0; i < 9; i++)
     {
         SetBit(i, colour);
     }
 }
コード例 #2
0
        public void RotateRight()
        {
            BitColour[] newbits = new BitColour[9];

            newbits[0] = _facebits[6];
            newbits[1] = _facebits[3];
            newbits[2] = _facebits[0];
            newbits[3] = _facebits[7];
            newbits[4] = _facebits[4];
            newbits[5] = _facebits[1];
            newbits[6] = _facebits[8];
            newbits[7] = _facebits[5];
            newbits[8] = _facebits[2];

            _facebits = newbits;
        }
コード例 #3
0
        private void FrontForward()
        {
            BitColour l0 = _faces[FaceType.Left].GetBit(2);
            BitColour l1 = _faces[FaceType.Left].GetBit(5);
            BitColour l2 = _faces[FaceType.Left].GetBit(8);

            _faces[FaceType.Left].SetBit(2, _faces[FaceType.Bottom].GetBit(0));
            _faces[FaceType.Left].SetBit(5, _faces[FaceType.Bottom].GetBit(1));
            _faces[FaceType.Left].SetBit(8, _faces[FaceType.Bottom].GetBit(2));

            _faces[FaceType.Bottom].SetBit(0, _faces[FaceType.Right].GetBit(6));
            _faces[FaceType.Bottom].SetBit(1, _faces[FaceType.Right].GetBit(3));
            _faces[FaceType.Bottom].SetBit(2, _faces[FaceType.Right].GetBit(0));

            _faces[FaceType.Right].SetBit(0, _faces[FaceType.Top].GetBit(6));
            _faces[FaceType.Right].SetBit(3, _faces[FaceType.Top].GetBit(7));
            _faces[FaceType.Right].SetBit(6, _faces[FaceType.Top].GetBit(8));

            _faces[FaceType.Top].SetBit(6, l2);
            _faces[FaceType.Top].SetBit(7, l1);
            _faces[FaceType.Top].SetBit(8, l0);

            _faces[FaceType.Front].RotateRight();
        }
コード例 #4
0
        private void BackReverse()
        {
            BitColour l0 = _faces[FaceType.Left].GetBit(0);
            BitColour l1 = _faces[FaceType.Left].GetBit(3);
            BitColour l2 = _faces[FaceType.Left].GetBit(6);

            _faces[FaceType.Left].SetBit(0, _faces[FaceType.Bottom].GetBit(6));
            _faces[FaceType.Left].SetBit(3, _faces[FaceType.Bottom].GetBit(7));
            _faces[FaceType.Left].SetBit(6, _faces[FaceType.Bottom].GetBit(8));

            _faces[FaceType.Bottom].SetBit(6, _faces[FaceType.Right].GetBit(8));
            _faces[FaceType.Bottom].SetBit(7, _faces[FaceType.Right].GetBit(5));
            _faces[FaceType.Bottom].SetBit(8, _faces[FaceType.Right].GetBit(2));

            _faces[FaceType.Right].SetBit(8, _faces[FaceType.Top].GetBit(2));
            _faces[FaceType.Right].SetBit(5, _faces[FaceType.Top].GetBit(1));
            _faces[FaceType.Right].SetBit(2, _faces[FaceType.Top].GetBit(0));

            _faces[FaceType.Top].SetBit(0, l2);
            _faces[FaceType.Top].SetBit(1, l1);
            _faces[FaceType.Top].SetBit(2, l0);

            _faces[FaceType.Back].RotateLeft();
        }
コード例 #5
0
        private void LowerReverse()
        {
            BitColour l0 = _faces[FaceType.Front].GetBit(6);
            BitColour l1 = _faces[FaceType.Front].GetBit(7);
            BitColour l2 = _faces[FaceType.Front].GetBit(8);

            _faces[FaceType.Front].SetBit(6, _faces[FaceType.Right].GetBit(6));
            _faces[FaceType.Front].SetBit(7, _faces[FaceType.Right].GetBit(7));
            _faces[FaceType.Front].SetBit(8, _faces[FaceType.Right].GetBit(8));

            _faces[FaceType.Right].SetBit(6, _faces[FaceType.Back].GetBit(2));
            _faces[FaceType.Right].SetBit(7, _faces[FaceType.Back].GetBit(1));
            _faces[FaceType.Right].SetBit(8, _faces[FaceType.Back].GetBit(0));

            _faces[FaceType.Back].SetBit(2, _faces[FaceType.Left].GetBit(6));
            _faces[FaceType.Back].SetBit(1, _faces[FaceType.Left].GetBit(7));
            _faces[FaceType.Back].SetBit(0, _faces[FaceType.Left].GetBit(8));

            _faces[FaceType.Left].SetBit(6, l0);
            _faces[FaceType.Left].SetBit(7, l1);
            _faces[FaceType.Left].SetBit(8, l2);

            _faces[FaceType.Bottom].RotateLeft();
        }
コード例 #6
0
        private void UpperForward()
        {
            BitColour l0 = _faces[FaceType.Front].GetBit(0);
            BitColour l1 = _faces[FaceType.Front].GetBit(1);
            BitColour l2 = _faces[FaceType.Front].GetBit(2);

            _faces[FaceType.Front].SetBit(0, _faces[FaceType.Right].GetBit(0));
            _faces[FaceType.Front].SetBit(1, _faces[FaceType.Right].GetBit(1));
            _faces[FaceType.Front].SetBit(2, _faces[FaceType.Right].GetBit(2));

            _faces[FaceType.Right].SetBit(0, _faces[FaceType.Back].GetBit(8));
            _faces[FaceType.Right].SetBit(1, _faces[FaceType.Back].GetBit(7));
            _faces[FaceType.Right].SetBit(2, _faces[FaceType.Back].GetBit(6));

            _faces[FaceType.Back].SetBit(8, _faces[FaceType.Left].GetBit(0));
            _faces[FaceType.Back].SetBit(7, _faces[FaceType.Left].GetBit(1));
            _faces[FaceType.Back].SetBit(6, _faces[FaceType.Left].GetBit(2));

            _faces[FaceType.Left].SetBit(0, l0);
            _faces[FaceType.Left].SetBit(1, l1);
            _faces[FaceType.Left].SetBit(2, l2);

            _faces[FaceType.Top].RotateRight();
        }
コード例 #7
0
        private void RightReverse()
        {
            BitColour l0 = _faces[FaceType.Front].GetBit(2);
            BitColour l1 = _faces[FaceType.Front].GetBit(5);
            BitColour l2 = _faces[FaceType.Front].GetBit(8);

            _faces[FaceType.Front].SetBit(2, _faces[FaceType.Top].GetBit(2));
            _faces[FaceType.Front].SetBit(5, _faces[FaceType.Top].GetBit(5));
            _faces[FaceType.Front].SetBit(8, _faces[FaceType.Top].GetBit(8));

            _faces[FaceType.Top].SetBit(2, _faces[FaceType.Back].GetBit(2));
            _faces[FaceType.Top].SetBit(5, _faces[FaceType.Back].GetBit(5));
            _faces[FaceType.Top].SetBit(8, _faces[FaceType.Back].GetBit(8));

            _faces[FaceType.Back].SetBit(2, _faces[FaceType.Bottom].GetBit(2));
            _faces[FaceType.Back].SetBit(5, _faces[FaceType.Bottom].GetBit(5));
            _faces[FaceType.Back].SetBit(8, _faces[FaceType.Bottom].GetBit(8));

            _faces[FaceType.Bottom].SetBit(2, l0);
            _faces[FaceType.Bottom].SetBit(5, l1);
            _faces[FaceType.Bottom].SetBit(8, l2);

            _faces[FaceType.Right].RotateLeft();
        }
コード例 #8
0
        private void LeftForward()
        {
            BitColour l0 = _faces[FaceType.Front].GetBit(0);
            BitColour l1 = _faces[FaceType.Front].GetBit(3);
            BitColour l2 = _faces[FaceType.Front].GetBit(6);

            _faces[FaceType.Front].SetBit(0, _faces[FaceType.Top].GetBit(0));
            _faces[FaceType.Front].SetBit(3, _faces[FaceType.Top].GetBit(3));
            _faces[FaceType.Front].SetBit(6, _faces[FaceType.Top].GetBit(6));

            _faces[FaceType.Top].SetBit(0, _faces[FaceType.Back].GetBit(0));
            _faces[FaceType.Top].SetBit(3, _faces[FaceType.Back].GetBit(3));
            _faces[FaceType.Top].SetBit(6, _faces[FaceType.Back].GetBit(6));

            _faces[FaceType.Back].SetBit(0, _faces[FaceType.Bottom].GetBit(0));
            _faces[FaceType.Back].SetBit(3, _faces[FaceType.Bottom].GetBit(3));
            _faces[FaceType.Back].SetBit(6, _faces[FaceType.Bottom].GetBit(6));

            _faces[FaceType.Bottom].SetBit(0, l0);
            _faces[FaceType.Bottom].SetBit(3, l1);
            _faces[FaceType.Bottom].SetBit(6, l2);

            _faces[FaceType.Left].RotateRight();
        }
コード例 #9
0
ファイル: ConsoleDisplay.cs プロジェクト: mikeyq6/Cuber
        private char colourToLetter(BitColour colour)
        {
            switch (colour)
            {
            case BitColour.Blue:
                return('B');

            case BitColour.Green:
                return('G');

            case BitColour.Orange:
                return('O');

            case BitColour.Red:
                return('R');

            case BitColour.White:
                return('W');

            case BitColour.Yellow:
                return('Y');
            }
            return(' ');
        }
コード例 #10
0
 public void SetBit(int index, BitColour colour)
 {
     _facebits[index] = colour;
 }