pub fn as_faces(&self) -> Cube3x3x3Faces {
        let mut faces = Cube3x3x3Faces::new();

        // Translate corner pieces into face colors
        for corner_idx in 0..8 {
            let piece = self.corners[corner_idx];
            for i in 0..3 {
                let dest = crate::tables::corner::CUBE3_CORNER_INDICIES[corner_idx][i];
                let src = crate::tables::corner::CUBE3_CORNER_INDICIES[piece.piece as u8 as usize]
                    [(i + 3 - piece.orientation as usize) % 3];
                let face = Cube3x3x3Faces::face_for_idx(src);
                faces.state[dest] = faces.state[Cube3x3x3Faces::idx(face, 1, 1)];
            }
        }

        // Translate edge pieces into face colors
        for edge_idx in 0..12 {
            let piece = self.edges[edge_idx];
            for i in 0..2 {
                let dest = crate::tables::table3x3x3::CUBE3_EDGE_INDICIES[edge_idx][i];
                let src = crate::tables::table3x3x3::CUBE3_EDGE_INDICIES
                    [piece.piece as u8 as usize][i ^ piece.orientation as usize];
                let face = Cube3x3x3Faces::face_for_idx(src);
                faces.state[dest] = faces.state[Cube3x3x3Faces::idx(face, 1, 1)];
            }
        }

        faces
    }
/// Gets this cube state in face color format
Gets this cube state in face color format
Gets this cube state in face color format
pub fn as_faces(&self) -> Cube3x3x3Faces {
        let mut faces = Cube3x3x3Faces::new();
        // Translate corner pieces into face colors
        for corner_idx in 0..8 {
            let piece = self.corners[corner_idx];
            for i in 0..3 {
                let dest = crate::tables::corner::CUBE3_CORNER_INDICIES[corner_idx][i];
                let src = crate::tables::corner::CUBE3_CORNER_INDICIES[piece.piece as u8 as usize]
                    [(i + 3 - piece.orientation as usize) % 3];
                let face = Cube3x3x3Faces::face_for_idx(src);
                faces.state[dest] = faces.state[Cube3x3x3Faces::idx(face, 1, 1)];
            }
        }
        // Translate edge pieces into face colors
        for edge_idx in 0..12 {
            let piece = self.edges[edge_idx];
            for i in 0..2 {
                let dest = crate::tables::table3x3x3::CUBE3_EDGE_INDICIES[edge_idx][i];
                let src = crate::tables::table3x3x3::CUBE3_EDGE_INDICIES
                    [piece.piece as u8 as usize][i ^ piece.orientation as usize];
                let face = Cube3x3x3Faces::face_for_idx(src);
                faces.state[dest] = faces.state[Cube3x3x3Faces::idx(face, 1, 1)];
            }
        }
        faces
    }
pub fn as_faces ( & self ) -> Cube3x3x3Faces { let mut faces = Cube3x3x3Faces :: new ( ) ; // Translate corner pieces into face colors for corner_idx in 0 .. 8 { let piece = self . corners [ corner_idx ] ; for i in 0 .. 3 { let dest = crate :: tables :: corner :: CUBE3_CORNER_INDICIES [ corner_idx ] [ i ] ; let src = crate :: tables :: corner :: CUBE3_CORNER_INDICIES [ piece . piece as u8 as usize ] [ ( i + 3 - piece . orientation as usize ) % 3 ] ; let face = Cube3x3x3Faces :: face_for_idx ( src ) ; faces . state [ dest ] = faces . state [ Cube3x3x3Faces :: idx ( face , 1 , 1 ) ] ; } } // Translate edge pieces into face colors for edge_idx in 0 .. 12 { let piece = self . edges [ edge_idx ] ; for i in 0 .. 2 { let dest = crate :: tables :: table3x3x3 :: CUBE3_EDGE_INDICIES [ edge_idx ] [ i ] ; let src = crate :: tables :: table3x3x3 :: CUBE3_EDGE_INDICIES [ piece . piece as u8 as usize ] [ i ^ piece . orientation as usize ] ; let face = Cube3x3x3Faces :: face_for_idx ( src ) ; faces . state [ dest ] = faces . state [ Cube3x3x3Faces :: idx ( face , 1 , 1 ) ] ; } } faces }
Gets this cube state in face color format
Gets this cube state in face color format
&self
&self