Develop a data structure similar to a binary tree. Using a standard 8 X 8 chessboard, show the
knight’s movements in a game. As you may know, a knight’s basic move in chess is two forward
steps and one sidestep. Facing in any direction and given enough turns, it can move from any
square on the board to any other square.
If you want to know the simplest way your knight can move from one square (or node) to
another in a two-dimensional setup, you will first have to build a function like the one below.
knight plays ([0,0], [1,2]) == [[0,0], [1,2]]
knight plays ([0,0], [3,3]) == [[0,0], [1,2], [3,3]]
knight plays ([3,3], [0,0]) == [[3,3], [1,2], [0,0]]
a.create a script for a board game and a knight.
Comments
Leave a comment