Moving in the matrix

1 回表示 (過去 30 日間)
ni david
ni david 2017 年 10 月 28 日
回答済み: Walter Roberson 2017 年 10 月 28 日
Imagine I have a 4x4 chess board. How can I define the movements of the knight in this board?

採用された回答

Walter Roberson
Walter Roberson 2017 年 10 月 28 日
(I,J) ->
(I-1,J-2)
(I-1,J+2)
(I+1,J-2)
(I+1,J+2)
(I-2,J-1)
(I-2,J+1)
(I+2,J-1)
(I+2,J+1)
and then filter out the ones that went out of bounds.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by