フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Problem rearranging vector (a column of a matrix)

1 回表示 (過去 30 日間)
Jon
Jon 2014 年 4 月 20 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hi, similar to the 2048 game, on a 4x4 board with 1's, 2's, 4's and the following power of 2's, I'd like to write a slightly different game to it. The only problem I have is rearranging a vector such that by selecting 'up', c = [1, 1, 0, 4]' turns into c = [2, 4, 0, 0]'. I could use loops but can you think of a way to do it using logical ops?
  1 件のコメント
Image Analyst
Image Analyst 2014 年 4 月 20 日
You assume everyone knows the rules and algorithm for the 2048 game. I don't. http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer

回答 (1 件)

Walter Roberson
Walter Roberson 2014 年 4 月 20 日
c = mod(c .^ 2, 8);

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by