forked from lordcris/wordle-bg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathselect5.nim
53 lines (45 loc) · 1.09 KB
/
select5.nim
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import sequtils, strutils
var
word_list: seq[string]
puzzle_list: seq[string]
const
alphabet = toSeq("abcdefghijklmnopqrstuvwxyz")
endings = toSeq("aeio")
# word list is taken from bigger file (dictionary.txt)
var add: bool
for line in "dictionary.txt".lines:
add = true
if line.len == 5 and '\'' notIn line:
for c in line:
if c notin alphabet:
add = false
break
if line[4] notin endings:
add = false
if add:
word_list.add line
# puzzle list is taken from smaller file (more reasonable words)
for line in "60_000_parole.txt".lines:
add = true
if line.len == 5 and '\'' notIn line:
for c in line:
if c notin alphabet:
add = false
break
if line[4] notin endings:
add = false
if add:
puzzle_list.add line
writeFile("big5.txt"): word_list.join("\n")
writeFile("small5.txt"): puzzle_list.join("\n")
echo len word_list
echo puzzle_list.len
# check where is placed yesterday's word
when defined(findOncia):
var i = 0
for word in puzzle_list:
if word == "oncia":
echo i
inc i
# 7910
# 2510