Moving in the matrix

2 Ansichten (letzte 30 Tage)
ni david
ni david am 28 Okt. 2017
Beantwortet: Walter Roberson am 28 Okt. 2017
Imagine I have a 4x4 chess board. How can I define the movements of the knight in this board?

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 28 Okt. 2017
(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.

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by