Started data loading
This commit is contained in:
parent
17a112ba70
commit
af3721009a
19
library.py
19
library.py
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
import json
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from game import Game
|
from game import Game
|
||||||
|
|
@ -12,13 +13,23 @@ if TYPE_CHECKING:
|
||||||
class Library:
|
class Library:
|
||||||
|
|
||||||
__verses: dict
|
__verses: dict
|
||||||
__games: Game
|
__games: list[Game]
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
with open("data/scripture-frequencies.json", encoding='utf-8') as file:
|
||||||
|
self.__verses = json.load(file)
|
||||||
|
self.__games = []
|
||||||
|
|
||||||
def join_game(self, name: str):
|
def join_game(self, name: str, game_num: int = -1):
|
||||||
pass
|
if game_num == -1:
|
||||||
|
for i, game in enumerate(self.__games):
|
||||||
|
if not game.active:
|
||||||
|
game_num = i
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
self.__games.append(Game())
|
||||||
|
game_num = len(self.__games) - 1
|
||||||
|
self.__games[game_num].add_player(name)
|
||||||
|
|
||||||
def get_verse(self, difficulty: int):
|
def get_verse(self, difficulty: int):
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue