38.0k views
3 votes
Move a knight Its name is move_knight

It takes three arguments: the board list, the position (index) of the player to move, and a direction (either LEFT or RIGHT)
It changes the position of the moving knight in the board list A knight can move either left or right A knight moves two locations If the moving knight lands on a space that another piece occupies,
then it kills that piece Knights can jump over other pieces
If the moving knight cannot move due to the ending position of the move being out-of-bounds of the board, the knight should stay in its place

User Itaysk
by
8.9k points

1 Answer

5 votes

Final answer:

The student is asking how to move a knight in a game, represented by a board list, and the function move_knight is used to accomplish this.

Step-by-step explanation:

The subject of this question is Computers and Technology.

The student is asking how to move a knight in a game, represented by a board list. The move_knight function takes three arguments: the board list, the position of the knight to move, and a direction (either LEFT or RIGHT). The function changes the position of the moving knight in the board list. The knight can move two locations and can jump over other pieces. If the desired move is out-of-bounds, the knight stays in its place.

User Retendo
by
8.6k points