Copyright | Copyright (C) 2024 Yoo Chung |
---|---|

License | GPL-3.0-or-later |

Maintainer | dev@chungyc.org |

Safe Haskell | Safe-Inferred |

Language | GHC2021 |

Some solutions to Problems.P91 of Ninety-Nine Haskell Problems.

# Documentation

knightsTour :: Int -> (Int, Int) -> Maybe [(Int, Int)] Source #

Returns a knight's tour ending at a particular square. Represents the squares by their coordinates with the tuple \((x,y)\), where \(1 \leq x \leq N\) and \(1 \leq y \leq N\). A tour will be a list of these tuples of length \(N \times N\).

closedKnightsTour :: Int -> Maybe [(Int, Int)] Source #

The same as `knightsTour`

, except return a circular tour.
I.e., the knight must be able to jump from the last position in the tour to the first position in the tour.
Starts the tour from \((1,1)\).