Module pacai.ui

The pacai.ui package contains the all of the user interfaces for the pacai package.

At the core of all our UIs are the concepts of a view (AbstractView) and a frame (Frame). A view knows how to convert the state of a game (AbstractGameState) into an abstract visual representation of the state and then convert that abstract visual representation into a concrete one. A frame is the abstract visual representation of the game state.

There are typically three types of graphics:

AbstractGUIView: This view uses tkinter to open a window and display graphics. Requires tk to be installed: https://tkdocs.com/tutorial/install.html .

AbstractTextView: This view outputs textual graphics directly to stdout.

AbstractNullView: This view outputs nothing. This is especially useful when you need to script multiple games.

All children of AbstractView support the ability to generate gifs of the game they are rendering (even if the view does not output graphics). The pacman-sprites.png file in this package contains the default sprites used for this project. Users can modify this sprite sheet or supply a different on through command-line options. All sprites are 50x50 pixels.

Expand source code
"""
The `pacai.ui` package contains the all of the user interfaces for the `pacai` package.

At the core of all our UIs are the concepts of a view (`pacai.ui.view.AbstractView`)
and a frame (`pacai.ui.frame.Frame`).
A view knows how to convert the state of a game (`pacai.core.gamestate.AbstractGameState`)
into an abstract visual representation of the state
and then convert that abstract visual representation into a concrete one.
A frame is the abstract visual representation of the game state.

There are typically three types of graphics:

`pacai.ui.gui.AbstractGUIView`:
This view uses tkinter to open a window and display graphics.
Requires tk to be installed: https://tkdocs.com/tutorial/install.html .

`pacai.ui.text.AbstractTextView`:
This view outputs textual graphics directly to stdout.

`pacai.ui.null.AbstractNullView`:
This view outputs nothing.
This is especially useful when you need to script multiple games.

All children of `pacai.ui.view.AbstractView` support the ability to generate gifs of the game
they are rendering (even if the view does not output graphics).
The `pacman-sprites.png` file in this package contains the default sprites used for this project.
Users can modify this sprite sheet or supply a different on through command-line options.
All sprites are 50x50 pixels.
"""

Sub-modules

pacai.ui.capture

The pacai.ui.capture package contains the UI elements for the capture game.

pacai.ui.crawler

The pacai.ui.crawler package contains the UI elements for the crawler demonstration.

pacai.ui.frame

A Frame is the base unit of a View. Frames hold all the information necessary to draw the game in whatever medium the view chooses.

pacai.ui.gridworld

The pacai.ui.gridworld package contains the UI elements for the gridworld simulation.

pacai.ui.gui
pacai.ui.keyboard
pacai.ui.null
pacai.ui.pacman

The pacai.ui.pacman package contains the UI elements for the pacman game.

pacai.ui.spritesheet

The graphics for pacman are held in a spritesheet. This file knows how to read a spritesheet and map sprites to tokens.

pacai.ui.text
pacai.ui.token

Tokens are the atomic unit of frames. A token represents any object that can be on a pacman board (including the walls). A frame really consists of a …

pacai.ui.view