Skip to content

Instantly share code, notes, and snippets.

@aloisdg
Created March 15, 2021 08:48
Show Gist options
  • Save aloisdg/02749bd03745bd7962c2ebf97969ab38 to your computer and use it in GitHub Desktop.
Save aloisdg/02749bd03745bd7962c2ebf97969ab38 to your computer and use it in GitHub Desktop.
A script to generate checker board
let buildCell j i =
if j % 2 = 0 && i % 2 = 0 || j % 2 = 1 && i % 2 = 1
then
"0"
else
"1"
let buildRow j n =
[0 .. n]
|> List.map (fun i -> buildCell j i)
|> String.concat ""
let checkers n =
[0 .. n]
|> List.map(fun j -> buildRow j n)
|> String.concat "\n"
checkers 3 |> printfn "%s"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment