Spójrzmy na 3-kostkę jak na sztywną bryłę.
Pokażemy algorytm obrotu 3-kostki wzdłuz osi „zero” – „siedem”. Czyli algorytm permutacji (0)(1 2 4)(3 6 5)(7) przy pomocy transpozycji t(1), t(2), t(4).
#include <iostream>
using namespace std;
#include „prob-16-kern.h”
#include „prob-16-bope.h”
extern int currentpoint;
int pointdata;
int sizeofpoint = 4;
int main()
{
int A;
tx(1); tx(2); tx(4);
A = currentpoint;
t(gtrans(3)); // 000011
t(1); // 000001
t(gtrans(6)); // 000110
t(2); // 000010
cout << ” currentpoint ” << currentpoint << ” A = ” << A << ” \n „;
o();
}
wydruk:
currentpoint 0 A = 0
currentpoint 2 A = 4
currentpoint 1 A = 2
currentpoint 3 A = 6
currentpoint 4 A = 1
currentpoint 6 A = 5
currentpoint 5 A = 3
currentpoint 7 A = 7
Tak wiec (0)(1 2 4)(3 6 5)(7). Porównajcie z „ćwiczeniem” na podstronie „wiecej przestrzeni”, gdzie przy pomocy t(gtrans(5)) otrzymamy permutację (0,4,5,1)(2,6,7,3). Powoli zbliżamy sie do problemu realizacji dowolnych permutacji z wyłącznym wykorzystaniem generatorów 1,2,4,8,16,…