Skip to content

Commit

Permalink
Fix Python issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Epicpkmn11 committed Mar 3, 2023
1 parent 37f3516 commit d13a466
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 2 additions & 3 deletions resources/update-words-cpp.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python3

from argparse import ArgumentParser, FileType
from datetime import datetime, timezone
from requests import get
from bs4 import BeautifulSoup

Expand All @@ -24,14 +23,14 @@ def update_words(output):
choices = json.loads("[" + re.findall(r'"cigar"(?:,"\w{5}")*\]', js)[0])

# Then grab the known word order
words = get("https://wordle.xn--rck9c.xn--tckwe/words.php?date=2021-06-19&limit=10000").json()
words = get("https://wordle.xn--rck9c.xn--tckwe/words.php?date=2021-06-19&limit=10000&include=id").json()

# Now let's make the file, first inclues
output.write('#include "words.hpp"\n\n')

# Then the known word order
output.write("std::vector<int> Words::order = {")
output.write(", ".join([word["id"] for word in words]))
output.write(", ".join([str(word) for word in words]))
output.write("};\n\n")

# The choice words
Expand Down
6 changes: 2 additions & 4 deletions resources/update-words.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#!/usr/bin/env python3

from argparse import ArgumentParser, FileType
from datetime import datetime, timezone
from argparse import ArgumentParser
from requests import get
from os import path

import json
import re


def update_words(mod_json):
Expand All @@ -21,7 +19,7 @@ def update_words(mod_json):

# Ensure the structure exists
if "words" not in j:
j["words"] = {}
j["words"] = {}

# Get all of the known word order
j["words"]["order"] = get("https://wordle.xn--rck9c.xn--tckwe/words.php?date=2021-06-19&limit=10000&include=id").json()
Expand Down

0 comments on commit d13a466

Please # to comment.