Added valid_move function

Checks if move is a valid knight move. Also created test() to clean up
code.