Skip to content

Game

progature.engine.components.game.Game

Game(file_name, name, skill=None, chapters=None, is_complete=False)

Game component contains all the game data in single obj, This Class is universal interface for Games all over the app. We just work with this class when we intract with our Games.

Parameters:

Name Type Description Default
file_name str

The path of "".json"" file of the game.

required
name string

The name of game.

required
skill Skill or None

Skill of each game.

None
chapters Pot[Chapter] or None

Chapters of each game.

None
is_complete bool

Status of game completion

False

file_name instance-attribute

file_name = file_name

name instance-attribute

name = name

is_complete instance-attribute

is_complete = is_complete

skill property writable

skill

Skill property

Returns:

Type Description
Skill or None

Returns the Skill object of the Game or None.

chapters property writable

chapters

chapters property

Returns:

Type Description
Pot[Chapter] or None

Returns the Pot object that contains Chapter's of the Game or None.

as_dict

as_dict()

Returns the dict representation of Game object.

Returns:

Type Description
dict

The representation of the Game.

Examples:

>>> g = Game("FILE_NAME", "NAME", "SKILL", "IS_COMPLETE", "CHAPTERS")
>>> g.as_dict()
{
    "file_name": FILE_NAME,
    "name": NAME,
    "skill": SKILL,
    "is_complete": IS_COMPLETE,
    "chapters": CHAPTERS,
}