Skip to content

Commit

Permalink
Added documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-wsp committed Apr 17, 2024
1 parent 0ccb207 commit 575bfb3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/game/crossteaser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,16 @@ const ORIENTATION_MAP: [u64; 24] = [
0b101_001_011, // 24
];

/// Defines a sequence of axis-wise rotations which will return an orientation
/// to orientation 1 (index 0 in ORIENTATION_MAP).
/// An axis-wise rotation on axis x is a rotation on a piece along the axis
/// from face x to face 5 - x.
/// Format: each rotation is 5 bits of format abc_de
/// abc: axis on which the rotation is performed
/// de: direction of the rotation. 01 = cw, 11 = ccw.
/// Order of transformations is right to left.
/// NOTE: This can likely be improved by combining transformations in a
/// clever way.
const TRANSFORM_MAP: [u64; 24] = [
0b0, // 1
0b000_01, // 2
Expand Down Expand Up @@ -390,6 +400,9 @@ mod mov {
}
}

/// Performs a clowckwise orientation on an orientation
/// along the specified axis.
/// I am trying to figure out a way to make this faster.
pub fn cw_on_axis(o: &Orientation, axis: u64) -> Orientation {
if axis == o.front {
return cw_front(o);
Expand Down

0 comments on commit 575bfb3

Please sign in to comment.