Module pacai.ui.capture.text
Expand source code
from pacai.ui import token
from pacai.ui.capture.view import CaptureAbstractView
from pacai.ui.text import AbstractTextView
class CaptureTextView(CaptureAbstractView, AbstractTextView):
"""
A text view for capture.
"""
def __init__(self, **kwargs):
super().__init__(**kwargs)
def _convertToken(self, objectToken):
if (token.isPacman(objectToken)):
if (int((objectToken - token.PACMAN_START) / 100) % 2 == 0):
return 'P'
else:
return 'p'
elif (token.isGhost(objectToken)):
if (int((objectToken - token.GHOST_START) / 100) % 2 == 0):
return 'g'
else:
return 'G'
else:
return super()._convertToken(objectToken)
Classes
class CaptureTextView (**kwargs)
-
A text view for capture.
Expand source code
class CaptureTextView(CaptureAbstractView, AbstractTextView): """ A text view for capture. """ def __init__(self, **kwargs): super().__init__(**kwargs) def _convertToken(self, objectToken): if (token.isPacman(objectToken)): if (int((objectToken - token.PACMAN_START) / 100) % 2 == 0): return 'P' else: return 'p' elif (token.isGhost(objectToken)): if (int((objectToken - token.GHOST_START) / 100) % 2 == 0): return 'g' else: return 'G' else: return super()._convertToken(objectToken)
Ancestors
Methods
def finish(self)
-
Inherited from:
CaptureAbstractView
.finish
Signal that the game is over and the UI should cleanup.
def getKeyboard(self)
-
Inherited from:
CaptureAbstractView
.getKeyboard
For views that support keyboards, get an instance of a pacai.ui.keyboard.Keyboard.
def initialize(self, state)
-
Inherited from:
CaptureAbstractView
.initialize
Perform an initial drawing of the view.
def update(self, state, forceDraw=False)
-
Inherited from:
CaptureAbstractView
.update
Materialize the view, given a state.