King: This is clunky and can be simplified as many of the statements are repeated.

Knight: For the knight, restricting the number values and the i values allows the piece to move in an L formation, just like chess in real life. We also had to give the i and number values minimum values and maximum values as to make sure that the knight cannot move off the board, which would have broken the code. This was an issue that we struggled with a lot but we eventually figured it out through console.log functions to help us see the problem.