Skip to content

Commit

Permalink
Updated examples for knight travails project.
Browse files Browse the repository at this point in the history
  • Loading branch information
ApurvR20 committed Oct 11, 2023
1 parent 06dd314 commit e4b2529
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions javascript/computer_science/project_knights_travails.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ Your task is to build a function `knightMoves` that shows the shortest possible
You can think of the board as having 2-dimensional coordinates. Your function would therefore look like:

* `knightMoves([0,0],[1,2]) == [[0,0],[1,2]]`
* `knightMoves([0,0],[3,3]) == [[0,0],[1,2],[3,3]]`
* `knightMoves([3,3],[0,0]) == [[3,3],[1,2],[0,0]]`

Note: Sometimes _there is more than one fastest path_, an example of this is shown below. Either answer will work.

* `knightMoves([0,0],[3,3]) == [[0,0],[2,1],[3,3]]` or `knightMoves([0,0],[3,3]) == [[0,0],[1,2],[3,3]]`
* `knightMoves([3,3],[0,0]) == [[3,3],[2,1],[0,0]]` or `knightMoves([3,3],[0,0]) == [[3,3],[1,2],[0,0]]`
* `knightMoves([0,0],[7,7]) == [[0,0],[2,1],[4,2],[6,3],[4,4],[6,5],[7,7]]` or `knightMoves([0,0],[7,7]) == [[0,0],[2,1],[4,2],[6,3],[7,5],[5,6],[7,7]]`

<div class="lesson-content__panel" markdown="1">
1. Put together a script that creates a game board and a knight.
Expand Down

0 comments on commit e4b2529

Please sign in to comment.