Array resets after deliberately changing it and i dont want it to

1 回表示 (過去 30 日間)
James Lee
James Lee 2017 年 4 月 26 日
回答済み: Will Nitsch 2017 年 5 月 1 日
Im trying to use matlab to solve a Rubiks Cube by basically checking what colour a piece is and then doing the appropriate moves to position it correctly, however my cube resets to its original scramble after every move, how do I stop this. Heres my code:
if RC(6,5)==3 && RC(7,5)==1 %if one piece is in (6,5) and one piece is in (7,5)
D2(RC) %Rotate down face twice
pause(n) %(Resets here to original scramble)
BA(RC) %Rotate back face anticlockwise
pause(n) %(Resets here to original scramble)
L2(RC) %Rotate left face twice
end

回答 (1 件)

Will Nitsch
Will Nitsch 2017 年 5 月 1 日
Are you able to provide some more information about the functions you are using ('D2','BA','L2', etc.)? It seems unlikely that the 'pause' function would be causing your 'RC' variable to reset each time it is called, as that should only insert a delay in your script's execution.

カテゴリ

Help Center および File ExchangeRubik's Cube についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by