This commit is contained in:
Auric Vente 2024-07-20 10:35:28 -06:00
parent 9aa043ad59
commit c2e2303f05
5 changed files with 271 additions and 2 deletions

View File

@ -52,6 +52,7 @@ class Config:
input_border_color: str = "rgb(120, 120, 120)" input_border_color: str = "rgb(120, 120, 120)"
input_caret_color: str = "rgb(18, 18, 18)" input_caret_color: str = "rgb(18, 18, 18)"
settings_json: Path settings_json: Path
countries_json: Path
@staticmethod @staticmethod
def prepare() -> None: def prepare() -> None:
@ -70,11 +71,12 @@ class Config:
Config.settings_json.parent.mkdir(parents=True, exist_ok=True) Config.settings_json.parent.mkdir(parents=True, exist_ok=True)
Config.settings_json.write_text("{}") Config.settings_json.write_text("{}")
Config.names_json = Config.here / "data" / "names.json"
Config.countries_json = Config.here / "data" / "countries.json"
Config.icon_path = Config.here / "img" / "icon_1.jpg" Config.icon_path = Config.here / "img" / "icon_1.jpg"
Config.status_image_path = Config.here / "img" / "icon_2.jpg" Config.status_image_path = Config.here / "img" / "icon_2.jpg"
Config.terminated_image_path = Config.here / "img" / "icon_3.jpg" Config.terminated_image_path = Config.here / "img" / "icon_3.jpg"
Config.hatched_image_path = Config.here / "img" / "icon_4.jpg" Config.hatched_image_path = Config.here / "img" / "icon_4.jpg"
Config.names_json = Config.here / "data" / "names.json"
Config.font_path = Config.here / "fonts" / "NotoSans-Regular.ttf" Config.font_path = Config.here / "fonts" / "NotoSans-Regular.ttf"
Config.emoji_font_path = Config.here / "fonts" / "NotoEmoji-Regular.ttf" Config.emoji_font_path = Config.here / "fonts" / "NotoEmoji-Regular.ttf"
Config.song_path = Config.here / "audio" / "March of the Cyber Ants.mp3" Config.song_path = Config.here / "audio" / "March of the Cyber Ants.mp3"

View File

@ -0,0 +1,250 @@
[
"Afghanistan",
"Albania",
"Algeria",
"American Samoa",
"Andorra",
"Angola",
"Anguilla",
"Antarctica",
"Antigua and Barbuda",
"Argentina",
"Armenia",
"Aruba",
"Australia",
"Austria",
"Azerbaijan",
"Bahamas",
"Bahrain",
"Bangladesh",
"Barbados",
"Belarus",
"Belgium",
"Belize",
"Benin",
"Bermuda",
"Bhutan",
"Bolivia",
"Bosnia and Herzegovina",
"Botswana",
"Bouvet Island",
"Brazil",
"British Indian Ocean Territory",
"Brunei",
"Bulgaria",
"Burkina Faso",
"Burundi",
"Cambodia",
"Cameroon",
"Canada",
"Cape Verde",
"Cayman Islands",
"Central African Republic",
"Chad",
"Chile",
"China",
"Christmas Island",
"Cocos (Keeling) Islands",
"Colombia",
"Comoros",
"Congo",
"The Democratic Republic of Congo",
"Cook Islands",
"Costa Rica",
"Ivory Coast",
"Croatia",
"Cuba",
"Cyprus",
"Czech Republic",
"Denmark",
"Djibouti",
"Dominica",
"Dominican Republic",
"East Timor",
"Ecuador",
"Egypt",
"England",
"El Salvador",
"Equatorial Guinea",
"Eritrea",
"Estonia",
"Eswatini",
"Ethiopia",
"Falkland Islands",
"Faroe Islands",
"Fiji Islands",
"Finland",
"France",
"French Guiana",
"French Polynesia",
"French Southern territories",
"Gabon",
"Gambia",
"Georgia",
"Germany",
"Ghana",
"Gibraltar",
"Greece",
"Greenland",
"Grenada",
"Guadeloupe",
"Guam",
"Guatemala",
"Guernsey",
"Guinea",
"Guinea-Bissau",
"Guyana",
"Haiti",
"Heard Island and McDonald Islands",
"Holy See (Vatican City State)",
"Honduras",
"Hong Kong",
"Hungary",
"Iceland",
"India",
"Indonesia",
"Iran",
"Iraq",
"Ireland",
"Israel",
"Isle of Man",
"Italy",
"Jamaica",
"Japan",
"Jersey",
"Jordan",
"Kazakhstan",
"Kenya",
"Kiribati",
"Kuwait",
"Kyrgyzstan",
"Laos",
"Latvia",
"Lebanon",
"Lesotho",
"Liberia",
"Libya",
"Liechtenstein",
"Lithuania",
"Luxembourg",
"Macao",
"North Macedonia",
"Madagascar",
"Malawi",
"Malaysia",
"Maldives",
"Mali",
"Malta",
"Marshall Islands",
"Martinique",
"Mauritania",
"Mauritius",
"Mayotte",
"Mexico",
"Micronesia, Federated States of",
"Moldova",
"Monaco",
"Mongolia",
"Montserrat",
"Montenegro",
"Morocco",
"Mozambique",
"Myanmar",
"Namibia",
"Nauru",
"Nepal",
"Netherlands",
"Netherlands Antilles",
"New Caledonia",
"New Zealand",
"Nicaragua",
"Niger",
"Nigeria",
"Niue",
"Norfolk Island",
"North Korea",
"Northern Ireland",
"Northern Mariana Islands",
"Norway",
"Oman",
"Pakistan",
"Palau",
"Palestine",
"Panama",
"Papua New Guinea",
"Paraguay",
"Peru",
"Philippines",
"Pitcairn",
"Poland",
"Portugal",
"Puerto Rico",
"Qatar",
"Reunion",
"Romania",
"Russia",
"Rwanda",
"Saint Helena",
"Saint Kitts and Nevis",
"Saint Lucia",
"Saint Pierre and Miquelon",
"Saint Vincent and the Grenadines",
"Samoa",
"San Marino",
"Sao Tome and Principe",
"Saudi Arabia",
"Scotland",
"Senegal",
"Serbia",
"Seychelles",
"Sierra Leone",
"Singapore",
"Slovakia",
"Slovenia",
"Solomon Islands",
"Somalia",
"South Africa",
"South Georgia and the South Sandwich Islands",
"South Korea",
"South Sudan",
"Spain",
"Sri Lanka",
"Sudan",
"Suriname",
"Svalbard and Jan Mayen",
"Sweden",
"Switzerland",
"Syria",
"Tajikistan",
"Tanzania",
"Thailand",
"Timor-Leste",
"Togo",
"Tokelau",
"Tonga",
"Trinidad and Tobago",
"Tunisia",
"Turkey",
"Turkmenistan",
"Turks and Caicos Islands",
"Tuvalu",
"Uganda",
"Ukraine",
"United Arab Emirates",
"United Kingdom",
"United States",
"United States Minor Outlying Islands",
"Uruguay",
"Uzbekistan",
"Vanuatu",
"Venezuela",
"Vietnam",
"Virgin Islands, British",
"Virgin Islands, U.S.",
"Wales",
"Wallis and Futuna",
"Western Sahara",
"Yemen",
"Zambia",
"Zimbabwe"
]

View File

@ -46,6 +46,8 @@ class Game:
color = Config.hit_color color = Config.hit_color
elif ant.method == "thinking": elif ant.method == "thinking":
status = f"Thinking about {status}" status = f"Thinking about {status}"
elif ant.method == "travel":
status = f"Traveling to {status}"
tooltip = "" tooltip = ""
tooltip += f"Updated: {Utils.to_date(ant.updated)}" tooltip += f"Updated: {Utils.to_date(ant.updated)}"
@ -178,7 +180,7 @@ class Game:
ant.hits += 1 ant.hits += 1
method = "hit" method = "hit"
elif num == 3: elif num == 3:
status = Utils.random_name([ant.name]) status = Utils.random_name([])
method = "thinking" method = "thinking"
elif num == 4: elif num == 4:
status = s.simple_sentence() status = s.simple_sentence()
@ -189,6 +191,9 @@ class Game:
elif num == 7: elif num == 7:
status = Utils.random_emoji(3) status = Utils.random_emoji(3)
method = "thinking" method = "thinking"
elif num == 8:
status = Utils.random_country([])
method = "travel"
else: else:
status = s.sentence() status = s.sentence()

View File

@ -36,3 +36,8 @@ class Storage:
def save_settings(settings: dict[str, Any]) -> None: def save_settings(settings: dict[str, Any]) -> None:
with Config.settings_json.open("w") as file: with Config.settings_json.open("w") as file:
json.dump(settings, file) json.dump(settings, file)
@staticmethod
def get_countries() -> Any:
with Config.countries_json.open() as file:
return json.load(file)

View File

@ -14,10 +14,12 @@ from .storage import Storage
class Utils: class Utils:
names: ClassVar[list[str]] = [] names: ClassVar[list[str]] = []
countries: ClassVar[list[str]] = []
@staticmethod @staticmethod
def prepare() -> None: def prepare() -> None:
Utils.names = Storage.get_names() Utils.names = Storage.get_names()
Utils.countries = Storage.get_countries()
@staticmethod @staticmethod
def now() -> float: def now() -> float:
@ -132,3 +134,8 @@ class Utils:
return "1 minute" return "1 minute"
return f"{minutes} minutes" return f"{minutes} minutes"
@staticmethod
def random_country(ignore: list[str]) -> str:
filtered = [country for country in Utils.countries if country not in ignore]
return random.choice(filtered)