# 4x4x4 Last Layer Wing Edge Solver for the Ti-83p/84p Calculators! (K4 Method)

#### Christopher Mowla

A little over a year ago, I programmed a solver in Ti-83p basic language which solves back the last layer wing edges on a 4x4x4 (or any NxNxN cube, if you solve one orbit of wings back at a time). Since then, I have significantly improved the code's efficiency as well as written pseudocode for those interested in understanding the code.

Although I have not programmed it to solve basic 2 2-cycle cases like "PLL Parity" with an algorithm like r2 F2 U2 r2 U2 F2 r2, or other common cases (which are neither 3-cycles nor 2-cycles) between two opposite composite edges on Thom's ELL page, this program can be useful for people learning K4 to solve the last layer with the minimum number of 3-cycles of wings (if they like to solve that way). If odd parity exists, then the solver will finish off with a 2-cycle algorithm.

In addition, although it's trivial for a solver to know whether or not there is an odd permutation in the cube, I have made it say whether or not there is odd parity, before the algorithms are given to the user.

I have attached a file containing the following:

1) The programs (along with additional 3-cycle and 2-cycle algorithm table programs),

2) An application (for those who do not want 9 programs in his or her program list),

3) A group (for those who like to send the group to their calculator and then ungroup it into his or her RAM).

4) A separate program to create scrambles (explained in the readme file, but if anyone has questions about it, let me know).

Looking at the size of the group of all 10 programs (including the scramble program), the total program takes up 7887 bites of RAM (mostly due to the size of the algorithm table programs).

I was forced to attach the readme file separately (due to the forum attachment size limit for zip files).

The readme PDF contains all of the following:
1) Examples
2) Program Outline (It shows the relationship between all 9 programs): the scramble program is independent of the program and is not necessary at all (but I provided it as an extra tool for those who wish to use it).
3) A brief description of each of the programs
4) The code with comments (I think I over commented it, but I didn't want to leave out any details to fully understanding every line of code)

Example

To give everyone a quick peak of how the program input and output works, I have provided one of the examples in the readme file.
When the wings are solved, they are numbered like so:

$$\begin{matrix} {} & \left[ 6 \right] & \left[ 5 \right] & {} \\ \left[ 7 \right] & {} & {} & \left[ 4 \right] \\ \left[ 8 \right] & {} & {} & \left[ 3 \right] \\ {} & \left[ 1 \right] & \left[ 2 \right] & {} \\ \end{matrix}$$
Note that the "solved" list needs to be {1,2,3,4,5,6,7,8}.

Now, here is the example:

________________________

________________________

________________________

________________________

________________________

________________________

________________________

The 3-cycle Algorithms
I have recently made 3-cycle algorithms in <U, R, r, Rw> (no cube rotations). Some of the algorithms are a little longer than what is commonly practiced, but I thought this was a good choice for simplicity. Corresponding to how Thom lists the cases on his ELL page, here are the algorithms I decided to use for each group: Note that we conjugate each algorithm with U, U', and U2, as well as invert all moves and conjugate that with U, U', and U2, to achieve all necessary algorithms.

2-cycle algorithms:

Here are the algorithms I chose to use as the primary algorithms (not solely in <U, R, r, Rw>).

Note that M = (l r') and M' = (l' r) on big cubes, in general. The indicated algorithm lengths take this into account).

l'2 U Lw U2 r' U2 Rw' U2 x U' r' U x' U2 x U' M' l' (15)
diag
r U2 r' U2 r' U2 l U2 r' U2 r U2 M' U2 r2 U2 r' (18)
across (unoriented)
l'2 U' Lw U2 r' U2 Rw' U2 x U r' U' x' U2 x U M' l' (15)
across (oriented)
l' r' U Lw U2 r' U2 Rw' U2 x U' r' U x' U2 x U' M r' (16)
opp
r U2 r U2 M' U2 r U2 r' U2 l U2 r2 (14)
edge flip
x' Rw2 U2 Lw' U2 r U2 Rw U2 x' U r U' F2 U r' U Rw2 x (16)

I have also included a move table for 2-cycle algorithms also in the move set <U, R, r, Rw> (in the subfolder "Other Move Tables"), but I didn't make them the primary algorithms used in the application because they were much longer than the algorithms above:

R U2 Rw' R2 U2 Rw' U2 Rw' U' r2 U Rw U2 Rw U2 Rw' U2 Rw' U' r U Rw U2 r2 U2 R' (26)
diag
Rw' U' Rw U2 Rw U2 Rw' U2 Rw' U' r U Rw U2 Rw U2 Rw' U2 Rw' U' r2 U2 Rw (23)
across (unoriented)
Rw' R' U2 Rw' U2 Rw' U' r2 U Rw U2 Rw U2 Rw' U2 Rw' U' r U Rw U2 Rw2 R (23)
across (oriented)
Rw' U2 r' Rw' U2 Rw U r2 U' Rw' U2 Rw' U2 Rw U2 Rw U r' U' Rw' U2 Rw' U2 Rw2 r U2 Rw (27)
opp
Rw U' R U r U2 r' U' R' U' r U R U r U2 r' U' R' U' r2 U2 Rw' (23)
edge flip
Rw U2 Rw U2 r2 U Rw U2 Rw U2 Rw' U2 Rw' U' r U Rw U2 Rw U2 Rw' U2 Rw' U Rw' U2 Rw' (27)

Note: Here are two additional algorithms for two of the cases I DID NOT include in those algorithm tables:
opp
Rw' U' R U r' U R' U' r U R U2 R' U' r' U2 r' U2 r' U2 r2 Rw (22)
across (unoriented)
Rw2 R' U R' U' r U R U2 R' U' r' U2 r' U2 r' U2 r2 U' R U Rw R2 (23)
(Not that it is really important for this thread, but I did make all of these 3-cycle and 2-cycle algorithms by hand).

If you are experienced in programming these calculators and follow my algorithm program example, you can customize which algorithms the solver uses to solve a certain case (or cases, if you choose to just conjugate it, take the inverse, etc., to cover more cases).

Enjoy!
(If anyone has a question about ANYTHING related to this program or the algorithms, feel free to post your question).

#### Attachments

• 16.3 KB Views: 18
• 128.7 KB Views: 29
Last edited:

#### y3k9

##### Member
You seem to be a very good programmer, do you know python?

#### Christopher Mowla

Unfortunately, no. I have only mastered Ti-83p basic. I know a little bit of C++ and Fortran 90, but not enough to do anything like this.

#### Kenneth

##### Not Alot
INPUT SCRAMBLED LIST: {3,4,2,7,5,8,1,6}

Setup: F2 U M' U2 M U F2 .. (y' x') U' R U r U' R' U (x) ... r2 U2 r2 U2 r U2 r' U2 r U2 r2 U2 r' (27)

=)

Not the way I solved it when I first tried, I did green and one blue using 3x3 ELL, then the other blue and had 1-flip for last, 31 turns in total.

#### Christopher Mowla

Haha, I am glad someone is having fun with this! If you want me to run the program for another scramble to get the 3-cycles and 2-cycle (if odd parity exists), let me know. Just give me the scramble lists (of 8 numbers).

In fact, if you want to, we can try to make a challenge to solve all 24 wings on the cube with cycles (assuming the corners and centers are already solved). The easiest way we can probably communicate scrambles for the entire cube is for you to do a set-up scramble in alg.garron.us. From there, I can input the scramble into the program to spit out the 3-cycle list (and the remaining 2-cycle if odd parity exists).

For example, here is a random derangement scramble (no wings are in their correct positions from the initial point of reference) I got from my scramble program (also included in the attachment).
{8,11,14,22,10,15,20,17,19,9,21,13,18,24,2,1,6,16,23,3,12,5,7,4}

The solver outputs:
"NO Parity!"

3-cycles
1>8>17
1>6>15
1>2>11
1>21>12
1>13>18
3>14>24
3>4>22
3>5>10
3>9>19
3>23>7
1>16>20
1>3>20
"SOLVED!"

We could also assume the cross dedges to be solved and just the E layer wings and last layer wings to be unsolved.

Last edited:

#### Kenneth

##### Not Alot
Lol, I forgot I wrote that post

Use 5 or 7 cycles for scrambling? It would make it more effective.

It also needs parity in 50% of the scrambles, it is not possible using only 3-cycles (or 5,7...)