-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.fs
34 lines (24 loc) · 811 Bytes
/
Program.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
open Solver
let isLength len (word: string) = word.Length = len
let ofLength len words = words |> Seq.filter (isLength len)
module English =
let wordList =
System.IO.File.ReadLines "words_alpha.txt"
|> ofLength 5
module Japanese =
let wordList =
let a = System.IO.File.ReadLines "gcanna.t"
let b = System.IO.File.ReadLines "gcannaf.t"
Seq.concat [ a; b ]
|> Seq.map (fun x -> (x.Split('#')[0]).Trim())
|> ofLength 4
// TODO: actually handle error cases
let args = System.Environment.GetCommandLineArgs()
let wordList =
match args[1] with
| "en" -> English.wordList
| "jp" -> Japanese.wordList
| _ -> []
let state = StateParser.parse args[2]
let words = solve wordList state
words |> Seq.iter (fun x -> printfn "%s" x)