mastermind.ui.menu package

class mastermind.ui.menu.base_menu.BaseMenu[source]

Bases: ABC

The abstract base class for all menu-based user interfaces.

Provides common functionality for displaying menus, including printing headers, content, and separators.

display() None[source]

Displays the menu by printing the header, content, and separator.

menu = {}
abstract property name: str

Returns the name of the menu.

This is an abstract property that must be implemented by subclasses.

property width: int

Returns the width of the menu, based on the maximum length of the menu items.

class mastermind.ui.menu.data_menu.DataDisplayMenu[source]

Bases: BaseMenu

An abstract base class for menus that display data.

Provides common functionality for fetching, rendering, and displaying data.

class mastermind.ui.menu.game_history_menu.GameHistoryMenu[source]

Bases: DataDisplayMenu

The menu for displaying the game history.

display() None[source]

Displays the game history menu and waits for user input to continue.

name = 'Game History'
width = 25
class mastermind.ui.menu.main_menu.MainMenu[source]

Bases: OptionMenu

The main menu of the application.

menu = {'0': 'Save and Exit', '1': 'Start New Game', '2': 'Load Saved Game', '3': 'Game History'}
name = 'Main Menu'
class mastermind.ui.menu.new_game_menu.NewGameMenu[source]

Bases: OptionMenu

The menu for starting a new game.

menu = {'0': 'Return to Main Menu', '1': 'You vs Someone Else', '2': 'You vs AI', '3': 'AI vs You', '4': 'Solve External Game'}
name = 'New Game Menu'
class mastermind.ui.menu.option_menu.OptionMenu[source]

Bases: BaseMenu

A concrete implementation of the BaseMenu class for menus with selectable options.

Provides functionality for displaying the menu options and processing the user’s selection.

get_option() str[source]

Displays the menu, prompts the user for an option, and processes the selected option.

Returns:

The processed option.

Return type:

str

class mastermind.ui.menu.resume_game_menu.ResumeGameMenu[source]

Bases: DataDisplayMenu

The menu for resuming a saved game.

get_option() str | int[source]

Displays the menu and returns the selected option.

name = 'Resume Game'
width = 27