package knights_tour

  1. Overview
  2. Docs
Solves the Knight's tour puzzle; and others

Install

dune-project
 Dependency

Authors

Maintainers

Sources

knights_tour-0.0.3.tbz
sha256=4c693ffd5554cdbb064b0aa2ec104ec1831d3abd077ea2cec0a52922ebdc2212
sha512=f3cd71b81c7e44e7186e43c407ee679a2fede799a8aa07c495932a1a7469c5cc80a32f28eaa0b2868d195e64896802baf7959bae5b3466f777279fa1500f3e60

doc/src/knights_tour.pentominos/randomize.ml.html

Source file randomize.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
let rnd = Random.State.make_self_init ()

let list els =
  let arr = Array.of_list els in
  let sz = Array.length arr in
  for i = 0 to sz - 1 do
    let choices = sz - i in
    let pick = Random.State.int rnd choices in
    let tgt = sz - pick - 1 in
    let tmp = arr.(pick) in
    arr.(pick) <- arr.(tgt);
    arr.(tgt) <- tmp
  done;
  Array.to_list arr
OCaml

Innovation. Community. Security.