BoardItem

class gamelib.BoardItem.BoardItem(**kwargs)

Base class for any item that will be placed on a Board.

Parameters:
  • type (str) – A type you want to give your item. It can be any string. You can then use the type for sorting or grouping for example.
  • name (str) – A name for this item. For identification purpose.
  • pos (array) – the position of this item. When the item is managed by the Board and Game engine this member hold the last updated position of the item. It is not updated if you manually move the item. It must be an array of 2 integers [row,column]
  • model (str) – The model to use to display this item on the Board. Be mindful of the space it will require. Default value is ‘*’.
  • parent – The parent object of the board item. Usually a Board or Game object.
__init__(**kwargs)

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(**kwargs) Initialize self.
can_move() This is a virtual method that must be implemented in deriving classes.
debug_info() Return a string with the list of the attributes and their current value.
display() Print the model WITHOUT carriage return.
overlappable() This is a virtual method that must be implemented in deriving class.
pickable() This is a virtual method that must be implemented in deriving class.
size() This is a virtual method that must be implemented in deriving class.
store_position(row, column) Store the BoardItem position for self access.