Problem 91

Another famous problem is The Knight's Tour. The challenge is to find a path for a knight jump on an NxN chessboard such that it visits every square exactly once.

Represent the squares by pairs of integer coordinates between 1 and N and the solution as a list of positions.

import Html exposing (text)

knightsTour : Int ->  List (Int, Int)
knightsTour n = 
  -- your implementation here

main = text <| toString <| knightsTour 8

Possible result:



A solution is offered on Rosetta Code and can be viewed here.

results matching ""

    No results matching ""