![]() |
BitBully 0.0.56-a6
|
Public Member Functions | |
| None | __init__ (self) |
| AppLayout | get_widget (self) |
| None | destroy (self) |
Public Attributes | |
| m_logger = logging.getLogger(self.__class__.__name__) | |
| dict | m_png |
| m_n_row | |
| int | m_n_col = 6, 7 |
| m_height = np.zeros(7, dtype=np.int32) | |
| float | m_board_size = 3.5 |
| bool | is_busy = False |
| last_event_time = time.time() | |
| list | m_movelist = [] |
| list | m_redolist = [] |
| bool | m_gameover = False |
| bitbully_agent = bitbully_core.BitBullyCore(db_path) | |
| list | ims |
| dict | m_control_buttons = {} |
| output = Output() | |
| m_fig = fig | |
| m_axs = axs | |
| list | m_insert_buttons |
Static Public Attributes | |
| widgets | notify_output = widgets.Output() |
Protected Member Functions | |
| None | _reset (self) |
| npt.NDArray[np.float64] | _get_fig_size_px (self) |
| None | _create_control_buttons (self) |
| None | _computer_move (self) |
| None | _create_board (self) |
| None | _popup (self, str text) |
| bool | _is_legal_move (self, int col) |
| None | _insert_token (self, int col, bool reset_redo_list=True) |
| None | _redo_move (self) |
| None | _undo_move (self) |
| None | _update_insert_buttons (self) |
| int | _get_img_idx (self, int col, int row) |
| None | _paint_token (self) |
| None | _create_buttons (self) |
| HBox | _create_column_labels (self) |
| None | _on_field_click (self, mpl_backend_bases.Event event) |
| None | _check_winner (self, bitbully_core.BoardCore board) |
A class which allows to create an interactive Connect-4 widget.
GuiC4 is an interactive Connect-4 graphical user interface (GUI) implemented using
Matplotlib, IPython widgets, and a backend agent from the BitBully engine. It
provides the following main features:
- Interactive Game Board: Presents a dynamic 6-row by 7-column
Connect-4 board with clickable board cells.
- Matplotlib Integration: Utilizes Matplotlib figures
to render high-quality game visuals directly within Jupyter notebook environments.
- User Interaction: Captures and processes mouse clicks and button events, enabling
intuitive gameplay via either direct board interaction or button controls.
- Undo/Redo Moves: Supports undo and redo functionalities, allowing users to
navigate through their move history during gameplay.
- Automated Agent Moves: Incorporates BitBully, a Connect-4 backend engine, enabling
computer-generated moves and board evaluations.
- Game State Handling: Detects game-over scenarios, including win/draw conditions,
and provides immediate user feedback through popup alerts.
Attributes:
notify_output (widgets.Output): Output widget for notifications and popups.
Examples:
Generally, you should this method to retreive and display the widget.
```pycon
>>> %matplotlib ipympl
>>> c4gui = GuiC4()
>>> display(c4gui.get_widget())
```
| None bitbully.gui_c4.GuiC4.__init__ | ( | self | ) |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
| None bitbully.gui_c4.GuiC4.destroy | ( | self | ) |
| AppLayout bitbully.gui_c4.GuiC4.get_widget | ( | self | ) |
| bitbully.gui_c4.GuiC4.bitbully_agent = bitbully_core.BitBullyCore(db_path) |
| bitbully.gui_c4.GuiC4.m_height = np.zeros(7, dtype=np.int32) |
| bitbully.gui_c4.GuiC4.m_logger = logging.getLogger(self.__class__.__name__) |
| dict bitbully.gui_c4.GuiC4.m_png |
|
static |