How to shuffle a Rubik's cube?












5















documentclass[pstricks,border=10pt]{standalone}
usepackage{pst-solides3d}
usepackage{arrayjob}
begin{document}

newarraycolors
readarray{colors}{red&red&red&red&red&red&red&red&yellow&yellow&yellow&yellow&yellow&yellow&yellow&yellow&yellow&orange&orange&orange&orange&orange&orange&orange&orange&orange&green&green&green&green&green&green&green&green&green&blue&blue&blue&blue&blue&blue&blue&blue&blue}

edefcolorfaces{}%
multido{i=0+1}{57}{%
checkcolors(i)
xdefcolorfaces{colorfacesispace(cachedata)space}}
%
deffigure#1#2{%
psset{viewpoint=120 50 30 rtp2xyz,Decran=50}
begin{pspicture}(-3,-3)(3,3)
psSolid[a=8,object=cube,ngrid=3,%
fcol=colorfaces%
,Rot#2=-#1space]%
end{pspicture}
}
multido{iA=0+10}{36}{figure{iA}{X}}
multido{iA=0+10}{36}{figure{iA}{Y}}
multido{iA=0+10}{36}{figure{iA}{Z}}
end{document}


enter image description here



Question:




  1. Is there an another way without using the package arrayjob?


  2. How to get the random color for it?



Thanks.










share|improve this question




















  • 1





    As for 2.: you are already loading pgf, so you have already a built in way to get a random item. Just add pgfmathdeclarerandomlist{colors}{{red}{red}{red}{red}{red}{red}{red}{red}{yellow}{yellow}{yellow}{yellow}{yellow}{yellow}{yellow}{yellow}{yellow}{orange}{orange}{orange}{orange}{orange}{orange}{orange}{orange}{orange}{green}{green}{green}{green}{green}{green}{green}{green}{green}{blue}{blue}{blue}{blue}{blue}{blue}{blue}{blue}{blue}} pgfmathrandomitem{c}{colors} typeout{c} to your code.

    – marmot
    12 hours ago











  • It occurred to me that random colors may not be a good idea. There are six colors, eight corners and eight edges. Each edge has a unique combination of 2 colors, and each corner has a unique combination of 3 colors, of which each color is used in precisely 4 corners and 4 edges. And each of 6 centers has a different color. What you really need is a random sort of the different components.

    – John Kormylo
    3 hours ago













  • Because the colors are not freely randomized but they must follow some rules, I think I need to change the title to be more specific.

    – Artificial Stupidity
    11 mins ago
















5















documentclass[pstricks,border=10pt]{standalone}
usepackage{pst-solides3d}
usepackage{arrayjob}
begin{document}

newarraycolors
readarray{colors}{red&red&red&red&red&red&red&red&yellow&yellow&yellow&yellow&yellow&yellow&yellow&yellow&yellow&orange&orange&orange&orange&orange&orange&orange&orange&orange&green&green&green&green&green&green&green&green&green&blue&blue&blue&blue&blue&blue&blue&blue&blue}

edefcolorfaces{}%
multido{i=0+1}{57}{%
checkcolors(i)
xdefcolorfaces{colorfacesispace(cachedata)space}}
%
deffigure#1#2{%
psset{viewpoint=120 50 30 rtp2xyz,Decran=50}
begin{pspicture}(-3,-3)(3,3)
psSolid[a=8,object=cube,ngrid=3,%
fcol=colorfaces%
,Rot#2=-#1space]%
end{pspicture}
}
multido{iA=0+10}{36}{figure{iA}{X}}
multido{iA=0+10}{36}{figure{iA}{Y}}
multido{iA=0+10}{36}{figure{iA}{Z}}
end{document}


enter image description here



Question:




  1. Is there an another way without using the package arrayjob?


  2. How to get the random color for it?



Thanks.










share|improve this question




















  • 1





    As for 2.: you are already loading pgf, so you have already a built in way to get a random item. Just add pgfmathdeclarerandomlist{colors}{{red}{red}{red}{red}{red}{red}{red}{red}{yellow}{yellow}{yellow}{yellow}{yellow}{yellow}{yellow}{yellow}{yellow}{orange}{orange}{orange}{orange}{orange}{orange}{orange}{orange}{orange}{green}{green}{green}{green}{green}{green}{green}{green}{green}{blue}{blue}{blue}{blue}{blue}{blue}{blue}{blue}{blue}} pgfmathrandomitem{c}{colors} typeout{c} to your code.

    – marmot
    12 hours ago











  • It occurred to me that random colors may not be a good idea. There are six colors, eight corners and eight edges. Each edge has a unique combination of 2 colors, and each corner has a unique combination of 3 colors, of which each color is used in precisely 4 corners and 4 edges. And each of 6 centers has a different color. What you really need is a random sort of the different components.

    – John Kormylo
    3 hours ago













  • Because the colors are not freely randomized but they must follow some rules, I think I need to change the title to be more specific.

    – Artificial Stupidity
    11 mins ago














5












5








5








documentclass[pstricks,border=10pt]{standalone}
usepackage{pst-solides3d}
usepackage{arrayjob}
begin{document}

newarraycolors
readarray{colors}{red&red&red&red&red&red&red&red&yellow&yellow&yellow&yellow&yellow&yellow&yellow&yellow&yellow&orange&orange&orange&orange&orange&orange&orange&orange&orange&green&green&green&green&green&green&green&green&green&blue&blue&blue&blue&blue&blue&blue&blue&blue}

edefcolorfaces{}%
multido{i=0+1}{57}{%
checkcolors(i)
xdefcolorfaces{colorfacesispace(cachedata)space}}
%
deffigure#1#2{%
psset{viewpoint=120 50 30 rtp2xyz,Decran=50}
begin{pspicture}(-3,-3)(3,3)
psSolid[a=8,object=cube,ngrid=3,%
fcol=colorfaces%
,Rot#2=-#1space]%
end{pspicture}
}
multido{iA=0+10}{36}{figure{iA}{X}}
multido{iA=0+10}{36}{figure{iA}{Y}}
multido{iA=0+10}{36}{figure{iA}{Z}}
end{document}


enter image description here



Question:




  1. Is there an another way without using the package arrayjob?


  2. How to get the random color for it?



Thanks.










share|improve this question
















documentclass[pstricks,border=10pt]{standalone}
usepackage{pst-solides3d}
usepackage{arrayjob}
begin{document}

newarraycolors
readarray{colors}{red&red&red&red&red&red&red&red&yellow&yellow&yellow&yellow&yellow&yellow&yellow&yellow&yellow&orange&orange&orange&orange&orange&orange&orange&orange&orange&green&green&green&green&green&green&green&green&green&blue&blue&blue&blue&blue&blue&blue&blue&blue}

edefcolorfaces{}%
multido{i=0+1}{57}{%
checkcolors(i)
xdefcolorfaces{colorfacesispace(cachedata)space}}
%
deffigure#1#2{%
psset{viewpoint=120 50 30 rtp2xyz,Decran=50}
begin{pspicture}(-3,-3)(3,3)
psSolid[a=8,object=cube,ngrid=3,%
fcol=colorfaces%
,Rot#2=-#1space]%
end{pspicture}
}
multido{iA=0+10}{36}{figure{iA}{X}}
multido{iA=0+10}{36}{figure{iA}{Y}}
multido{iA=0+10}{36}{figure{iA}{Z}}
end{document}


enter image description here



Question:




  1. Is there an another way without using the package arrayjob?


  2. How to get the random color for it?



Thanks.







pstricks pst-solides3d






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 13 mins ago









Artificial Stupidity

5,35711041




5,35711041










asked 14 hours ago









chishimutojichishimutoji

7141320




7141320








  • 1





    As for 2.: you are already loading pgf, so you have already a built in way to get a random item. Just add pgfmathdeclarerandomlist{colors}{{red}{red}{red}{red}{red}{red}{red}{red}{yellow}{yellow}{yellow}{yellow}{yellow}{yellow}{yellow}{yellow}{yellow}{orange}{orange}{orange}{orange}{orange}{orange}{orange}{orange}{orange}{green}{green}{green}{green}{green}{green}{green}{green}{green}{blue}{blue}{blue}{blue}{blue}{blue}{blue}{blue}{blue}} pgfmathrandomitem{c}{colors} typeout{c} to your code.

    – marmot
    12 hours ago











  • It occurred to me that random colors may not be a good idea. There are six colors, eight corners and eight edges. Each edge has a unique combination of 2 colors, and each corner has a unique combination of 3 colors, of which each color is used in precisely 4 corners and 4 edges. And each of 6 centers has a different color. What you really need is a random sort of the different components.

    – John Kormylo
    3 hours ago













  • Because the colors are not freely randomized but they must follow some rules, I think I need to change the title to be more specific.

    – Artificial Stupidity
    11 mins ago














  • 1





    As for 2.: you are already loading pgf, so you have already a built in way to get a random item. Just add pgfmathdeclarerandomlist{colors}{{red}{red}{red}{red}{red}{red}{red}{red}{yellow}{yellow}{yellow}{yellow}{yellow}{yellow}{yellow}{yellow}{yellow}{orange}{orange}{orange}{orange}{orange}{orange}{orange}{orange}{orange}{green}{green}{green}{green}{green}{green}{green}{green}{green}{blue}{blue}{blue}{blue}{blue}{blue}{blue}{blue}{blue}} pgfmathrandomitem{c}{colors} typeout{c} to your code.

    – marmot
    12 hours ago











  • It occurred to me that random colors may not be a good idea. There are six colors, eight corners and eight edges. Each edge has a unique combination of 2 colors, and each corner has a unique combination of 3 colors, of which each color is used in precisely 4 corners and 4 edges. And each of 6 centers has a different color. What you really need is a random sort of the different components.

    – John Kormylo
    3 hours ago













  • Because the colors are not freely randomized but they must follow some rules, I think I need to change the title to be more specific.

    – Artificial Stupidity
    11 mins ago








1




1





As for 2.: you are already loading pgf, so you have already a built in way to get a random item. Just add pgfmathdeclarerandomlist{colors}{{red}{red}{red}{red}{red}{red}{red}{red}{yellow}{yellow}{yellow}{yellow}{yellow}{yellow}{yellow}{yellow}{yellow}{orange}{orange}{orange}{orange}{orange}{orange}{orange}{orange}{orange}{green}{green}{green}{green}{green}{green}{green}{green}{green}{blue}{blue}{blue}{blue}{blue}{blue}{blue}{blue}{blue}} pgfmathrandomitem{c}{colors} typeout{c} to your code.

– marmot
12 hours ago





As for 2.: you are already loading pgf, so you have already a built in way to get a random item. Just add pgfmathdeclarerandomlist{colors}{{red}{red}{red}{red}{red}{red}{red}{red}{yellow}{yellow}{yellow}{yellow}{yellow}{yellow}{yellow}{yellow}{yellow}{orange}{orange}{orange}{orange}{orange}{orange}{orange}{orange}{orange}{green}{green}{green}{green}{green}{green}{green}{green}{green}{blue}{blue}{blue}{blue}{blue}{blue}{blue}{blue}{blue}} pgfmathrandomitem{c}{colors} typeout{c} to your code.

– marmot
12 hours ago













It occurred to me that random colors may not be a good idea. There are six colors, eight corners and eight edges. Each edge has a unique combination of 2 colors, and each corner has a unique combination of 3 colors, of which each color is used in precisely 4 corners and 4 edges. And each of 6 centers has a different color. What you really need is a random sort of the different components.

– John Kormylo
3 hours ago







It occurred to me that random colors may not be a good idea. There are six colors, eight corners and eight edges. Each edge has a unique combination of 2 colors, and each corner has a unique combination of 3 colors, of which each color is used in precisely 4 corners and 4 edges. And each of 6 centers has a different color. What you really need is a random sort of the different components.

– John Kormylo
3 hours ago















Because the colors are not freely randomized but they must follow some rules, I think I need to change the title to be more specific.

– Artificial Stupidity
11 mins ago





Because the colors are not freely randomized but they must follow some rules, I think I need to change the title to be more specific.

– Artificial Stupidity
11 mins ago










1 Answer
1






active

oldest

votes


















4














documentclass[pstricks,border=10pt]{standalone}
usepackage{pst-solides3d}
begin{document}

psset{viewpoint=120 50 30 rtp2xyz,Decran=50}
pstVerb{/Colors [(red)(yellow)(orange)(green)(blue)] def }
deffigure#1#2{%
begin{pspicture}(-3,-3)(3,3)
psSolid[a=8,object=cube,ngrid=3,%
fcol=
0 1 8 { Colors Rand 4.5 mul cvi get } for
9 1 17 { Colors Rand 4.5 mul cvi get } for
18 1 26 { Colors Rand 4.5 mul cvi get } for
27 1 35 { Colors Rand 4.5 mul cvi get } for
36 1 44 { Colors Rand 4.5 mul cvi get } for
45 1 53 { Colors Rand 4.5 mul cvi get } for,
Rot#2=-#1space]%
end{pspicture}
}
multido{iA=0+10}{36}{figure{iA}{X}}
multido{iA=0+10}{36}{figure{iA}{Y}}
multido{iA=0+10}{36}{figure{iA}{Z}}
end{document}


enter image description here



 0 1 8 {      from 0 to 8 with step 1 do
put the loop variable on the stack
Colors. Load Color array
Rand get a random number between 0 and 1
4.5 mul between 0 and 4.5
cvi between 0 and 4
get load color with random number
} for. end of for loop


Every square has a corresponding number 0 .. 53 which can be used
for color setting: 0 (red) 1 (green) ... and so on. see pages 38 ff of
the documentation.



The same for complete faces:



documentclass[pstricks,border=10pt]{standalone}

usepackage{pst-solides3d}
begin{document}

psset{viewpoint=120 50 30 rtp2xyz,Decran=50}
pstVerb{/Colors [(red)(yellow)(orange)(green)(blue)] def }
deffigure#1#2{%
begin{pspicture}(-3,-3)(3,3)
psSolid[a=8,object=cube,ngrid=3,%
fcol=
0 1 8 { (red) } for
9 1 17 { (green) } for
18 1 26 { (blue) } for
27 1 35 { (orange) } for
36 1 44 { (yellow) } for
45 1 53 { (cyan) } for,
Rot#2=-#1space]%
end{pspicture}
}
multido{iA=0+10}{36}{figure{iA}{X}}
multido{iA=0+10}{36}{figure{iA}{Y}}
multido{iA=0+10}{36}{figure{iA}{Z}}
end{document}


enter image description here






share|improve this answer


























  • Please to answer the first question. Your code(PostScript language) is new with me...

    – chishimutoji
    10 hours ago













  • see edited answer ...

    – Herbert
    10 hours ago











  • Oh, you misunderstood me. I mean that you can rewrite my code as the smart way.( my figure only 6 colors). The second question is not important. :-) And of course thanks for your expansion..

    – chishimutoji
    10 hours ago













  • And I just check pages 38 of the documentation BUT there is no anything as you can see. :-)

    – chishimutoji
    10 hours ago











  • I see only 5 colors. pages 38ff show anything about colors.

    – Herbert
    10 hours ago











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f475995%2fhow-to-shuffle-a-rubiks-cube%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









4














documentclass[pstricks,border=10pt]{standalone}
usepackage{pst-solides3d}
begin{document}

psset{viewpoint=120 50 30 rtp2xyz,Decran=50}
pstVerb{/Colors [(red)(yellow)(orange)(green)(blue)] def }
deffigure#1#2{%
begin{pspicture}(-3,-3)(3,3)
psSolid[a=8,object=cube,ngrid=3,%
fcol=
0 1 8 { Colors Rand 4.5 mul cvi get } for
9 1 17 { Colors Rand 4.5 mul cvi get } for
18 1 26 { Colors Rand 4.5 mul cvi get } for
27 1 35 { Colors Rand 4.5 mul cvi get } for
36 1 44 { Colors Rand 4.5 mul cvi get } for
45 1 53 { Colors Rand 4.5 mul cvi get } for,
Rot#2=-#1space]%
end{pspicture}
}
multido{iA=0+10}{36}{figure{iA}{X}}
multido{iA=0+10}{36}{figure{iA}{Y}}
multido{iA=0+10}{36}{figure{iA}{Z}}
end{document}


enter image description here



 0 1 8 {      from 0 to 8 with step 1 do
put the loop variable on the stack
Colors. Load Color array
Rand get a random number between 0 and 1
4.5 mul between 0 and 4.5
cvi between 0 and 4
get load color with random number
} for. end of for loop


Every square has a corresponding number 0 .. 53 which can be used
for color setting: 0 (red) 1 (green) ... and so on. see pages 38 ff of
the documentation.



The same for complete faces:



documentclass[pstricks,border=10pt]{standalone}

usepackage{pst-solides3d}
begin{document}

psset{viewpoint=120 50 30 rtp2xyz,Decran=50}
pstVerb{/Colors [(red)(yellow)(orange)(green)(blue)] def }
deffigure#1#2{%
begin{pspicture}(-3,-3)(3,3)
psSolid[a=8,object=cube,ngrid=3,%
fcol=
0 1 8 { (red) } for
9 1 17 { (green) } for
18 1 26 { (blue) } for
27 1 35 { (orange) } for
36 1 44 { (yellow) } for
45 1 53 { (cyan) } for,
Rot#2=-#1space]%
end{pspicture}
}
multido{iA=0+10}{36}{figure{iA}{X}}
multido{iA=0+10}{36}{figure{iA}{Y}}
multido{iA=0+10}{36}{figure{iA}{Z}}
end{document}


enter image description here






share|improve this answer


























  • Please to answer the first question. Your code(PostScript language) is new with me...

    – chishimutoji
    10 hours ago













  • see edited answer ...

    – Herbert
    10 hours ago











  • Oh, you misunderstood me. I mean that you can rewrite my code as the smart way.( my figure only 6 colors). The second question is not important. :-) And of course thanks for your expansion..

    – chishimutoji
    10 hours ago













  • And I just check pages 38 of the documentation BUT there is no anything as you can see. :-)

    – chishimutoji
    10 hours ago











  • I see only 5 colors. pages 38ff show anything about colors.

    – Herbert
    10 hours ago
















4














documentclass[pstricks,border=10pt]{standalone}
usepackage{pst-solides3d}
begin{document}

psset{viewpoint=120 50 30 rtp2xyz,Decran=50}
pstVerb{/Colors [(red)(yellow)(orange)(green)(blue)] def }
deffigure#1#2{%
begin{pspicture}(-3,-3)(3,3)
psSolid[a=8,object=cube,ngrid=3,%
fcol=
0 1 8 { Colors Rand 4.5 mul cvi get } for
9 1 17 { Colors Rand 4.5 mul cvi get } for
18 1 26 { Colors Rand 4.5 mul cvi get } for
27 1 35 { Colors Rand 4.5 mul cvi get } for
36 1 44 { Colors Rand 4.5 mul cvi get } for
45 1 53 { Colors Rand 4.5 mul cvi get } for,
Rot#2=-#1space]%
end{pspicture}
}
multido{iA=0+10}{36}{figure{iA}{X}}
multido{iA=0+10}{36}{figure{iA}{Y}}
multido{iA=0+10}{36}{figure{iA}{Z}}
end{document}


enter image description here



 0 1 8 {      from 0 to 8 with step 1 do
put the loop variable on the stack
Colors. Load Color array
Rand get a random number between 0 and 1
4.5 mul between 0 and 4.5
cvi between 0 and 4
get load color with random number
} for. end of for loop


Every square has a corresponding number 0 .. 53 which can be used
for color setting: 0 (red) 1 (green) ... and so on. see pages 38 ff of
the documentation.



The same for complete faces:



documentclass[pstricks,border=10pt]{standalone}

usepackage{pst-solides3d}
begin{document}

psset{viewpoint=120 50 30 rtp2xyz,Decran=50}
pstVerb{/Colors [(red)(yellow)(orange)(green)(blue)] def }
deffigure#1#2{%
begin{pspicture}(-3,-3)(3,3)
psSolid[a=8,object=cube,ngrid=3,%
fcol=
0 1 8 { (red) } for
9 1 17 { (green) } for
18 1 26 { (blue) } for
27 1 35 { (orange) } for
36 1 44 { (yellow) } for
45 1 53 { (cyan) } for,
Rot#2=-#1space]%
end{pspicture}
}
multido{iA=0+10}{36}{figure{iA}{X}}
multido{iA=0+10}{36}{figure{iA}{Y}}
multido{iA=0+10}{36}{figure{iA}{Z}}
end{document}


enter image description here






share|improve this answer


























  • Please to answer the first question. Your code(PostScript language) is new with me...

    – chishimutoji
    10 hours ago













  • see edited answer ...

    – Herbert
    10 hours ago











  • Oh, you misunderstood me. I mean that you can rewrite my code as the smart way.( my figure only 6 colors). The second question is not important. :-) And of course thanks for your expansion..

    – chishimutoji
    10 hours ago













  • And I just check pages 38 of the documentation BUT there is no anything as you can see. :-)

    – chishimutoji
    10 hours ago











  • I see only 5 colors. pages 38ff show anything about colors.

    – Herbert
    10 hours ago














4












4








4







documentclass[pstricks,border=10pt]{standalone}
usepackage{pst-solides3d}
begin{document}

psset{viewpoint=120 50 30 rtp2xyz,Decran=50}
pstVerb{/Colors [(red)(yellow)(orange)(green)(blue)] def }
deffigure#1#2{%
begin{pspicture}(-3,-3)(3,3)
psSolid[a=8,object=cube,ngrid=3,%
fcol=
0 1 8 { Colors Rand 4.5 mul cvi get } for
9 1 17 { Colors Rand 4.5 mul cvi get } for
18 1 26 { Colors Rand 4.5 mul cvi get } for
27 1 35 { Colors Rand 4.5 mul cvi get } for
36 1 44 { Colors Rand 4.5 mul cvi get } for
45 1 53 { Colors Rand 4.5 mul cvi get } for,
Rot#2=-#1space]%
end{pspicture}
}
multido{iA=0+10}{36}{figure{iA}{X}}
multido{iA=0+10}{36}{figure{iA}{Y}}
multido{iA=0+10}{36}{figure{iA}{Z}}
end{document}


enter image description here



 0 1 8 {      from 0 to 8 with step 1 do
put the loop variable on the stack
Colors. Load Color array
Rand get a random number between 0 and 1
4.5 mul between 0 and 4.5
cvi between 0 and 4
get load color with random number
} for. end of for loop


Every square has a corresponding number 0 .. 53 which can be used
for color setting: 0 (red) 1 (green) ... and so on. see pages 38 ff of
the documentation.



The same for complete faces:



documentclass[pstricks,border=10pt]{standalone}

usepackage{pst-solides3d}
begin{document}

psset{viewpoint=120 50 30 rtp2xyz,Decran=50}
pstVerb{/Colors [(red)(yellow)(orange)(green)(blue)] def }
deffigure#1#2{%
begin{pspicture}(-3,-3)(3,3)
psSolid[a=8,object=cube,ngrid=3,%
fcol=
0 1 8 { (red) } for
9 1 17 { (green) } for
18 1 26 { (blue) } for
27 1 35 { (orange) } for
36 1 44 { (yellow) } for
45 1 53 { (cyan) } for,
Rot#2=-#1space]%
end{pspicture}
}
multido{iA=0+10}{36}{figure{iA}{X}}
multido{iA=0+10}{36}{figure{iA}{Y}}
multido{iA=0+10}{36}{figure{iA}{Z}}
end{document}


enter image description here






share|improve this answer















documentclass[pstricks,border=10pt]{standalone}
usepackage{pst-solides3d}
begin{document}

psset{viewpoint=120 50 30 rtp2xyz,Decran=50}
pstVerb{/Colors [(red)(yellow)(orange)(green)(blue)] def }
deffigure#1#2{%
begin{pspicture}(-3,-3)(3,3)
psSolid[a=8,object=cube,ngrid=3,%
fcol=
0 1 8 { Colors Rand 4.5 mul cvi get } for
9 1 17 { Colors Rand 4.5 mul cvi get } for
18 1 26 { Colors Rand 4.5 mul cvi get } for
27 1 35 { Colors Rand 4.5 mul cvi get } for
36 1 44 { Colors Rand 4.5 mul cvi get } for
45 1 53 { Colors Rand 4.5 mul cvi get } for,
Rot#2=-#1space]%
end{pspicture}
}
multido{iA=0+10}{36}{figure{iA}{X}}
multido{iA=0+10}{36}{figure{iA}{Y}}
multido{iA=0+10}{36}{figure{iA}{Z}}
end{document}


enter image description here



 0 1 8 {      from 0 to 8 with step 1 do
put the loop variable on the stack
Colors. Load Color array
Rand get a random number between 0 and 1
4.5 mul between 0 and 4.5
cvi between 0 and 4
get load color with random number
} for. end of for loop


Every square has a corresponding number 0 .. 53 which can be used
for color setting: 0 (red) 1 (green) ... and so on. see pages 38 ff of
the documentation.



The same for complete faces:



documentclass[pstricks,border=10pt]{standalone}

usepackage{pst-solides3d}
begin{document}

psset{viewpoint=120 50 30 rtp2xyz,Decran=50}
pstVerb{/Colors [(red)(yellow)(orange)(green)(blue)] def }
deffigure#1#2{%
begin{pspicture}(-3,-3)(3,3)
psSolid[a=8,object=cube,ngrid=3,%
fcol=
0 1 8 { (red) } for
9 1 17 { (green) } for
18 1 26 { (blue) } for
27 1 35 { (orange) } for
36 1 44 { (yellow) } for
45 1 53 { (cyan) } for,
Rot#2=-#1space]%
end{pspicture}
}
multido{iA=0+10}{36}{figure{iA}{X}}
multido{iA=0+10}{36}{figure{iA}{Y}}
multido{iA=0+10}{36}{figure{iA}{Z}}
end{document}


enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited 10 hours ago

























answered 11 hours ago









HerbertHerbert

274k24417730




274k24417730













  • Please to answer the first question. Your code(PostScript language) is new with me...

    – chishimutoji
    10 hours ago













  • see edited answer ...

    – Herbert
    10 hours ago











  • Oh, you misunderstood me. I mean that you can rewrite my code as the smart way.( my figure only 6 colors). The second question is not important. :-) And of course thanks for your expansion..

    – chishimutoji
    10 hours ago













  • And I just check pages 38 of the documentation BUT there is no anything as you can see. :-)

    – chishimutoji
    10 hours ago











  • I see only 5 colors. pages 38ff show anything about colors.

    – Herbert
    10 hours ago



















  • Please to answer the first question. Your code(PostScript language) is new with me...

    – chishimutoji
    10 hours ago













  • see edited answer ...

    – Herbert
    10 hours ago











  • Oh, you misunderstood me. I mean that you can rewrite my code as the smart way.( my figure only 6 colors). The second question is not important. :-) And of course thanks for your expansion..

    – chishimutoji
    10 hours ago













  • And I just check pages 38 of the documentation BUT there is no anything as you can see. :-)

    – chishimutoji
    10 hours ago











  • I see only 5 colors. pages 38ff show anything about colors.

    – Herbert
    10 hours ago

















Please to answer the first question. Your code(PostScript language) is new with me...

– chishimutoji
10 hours ago







Please to answer the first question. Your code(PostScript language) is new with me...

– chishimutoji
10 hours ago















see edited answer ...

– Herbert
10 hours ago





see edited answer ...

– Herbert
10 hours ago













Oh, you misunderstood me. I mean that you can rewrite my code as the smart way.( my figure only 6 colors). The second question is not important. :-) And of course thanks for your expansion..

– chishimutoji
10 hours ago







Oh, you misunderstood me. I mean that you can rewrite my code as the smart way.( my figure only 6 colors). The second question is not important. :-) And of course thanks for your expansion..

– chishimutoji
10 hours ago















And I just check pages 38 of the documentation BUT there is no anything as you can see. :-)

– chishimutoji
10 hours ago





And I just check pages 38 of the documentation BUT there is no anything as you can see. :-)

– chishimutoji
10 hours ago













I see only 5 colors. pages 38ff show anything about colors.

– Herbert
10 hours ago





I see only 5 colors. pages 38ff show anything about colors.

– Herbert
10 hours ago


















draft saved

draft discarded




















































Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f475995%2fhow-to-shuffle-a-rubiks-cube%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

サソリ

広島県道265号伴広島線

Accessing regular linux commands in Huawei's Dopra Linux