From e4b2529a1c76cdf21d9e746537b44ed5f24628f9 Mon Sep 17 00:00:00 2001 From: apu <62154933+ApurvR20@users.noreply.github.com> Date: Wed, 11 Oct 2023 11:57:34 +0530 Subject: [PATCH] Updated examples for knight travails project. --- javascript/computer_science/project_knights_travails.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/javascript/computer_science/project_knights_travails.md b/javascript/computer_science/project_knights_travails.md index c927fd37887..c993a0f7563 100644 --- a/javascript/computer_science/project_knights_travails.md +++ b/javascript/computer_science/project_knights_travails.md @@ -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]]`
1. Put together a script that creates a game board and a knight.