File size: 610 Bytes
1532c35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
09c334f
 
 
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
from dataclasses import dataclass
from functools import partial
from typing import Iterator


@dataclass
class ReducerParams:
    """
    Dataclass that contains the current
    program state
    """

    prompt_text: str
    player_points: int
    lm_points: int
    current_guesses: str
    lm_guesses: str
    remaining_attempts: int
    guess_field: str
    button_label: str
    bottom_html: str
    word_number: int

    def __iter__(self) -> Iterator:
        return map(partial(getattr, self), self.__dataclass_fields__)

    def __getitem__(self, index) -> str | int:
        return list(self)[index]