GameEngine module¶
This class is the GameEngine class. It contains the object repository and the logic that the game follows so that the Katan players can experience the functionality of the game itself.
-
class
GameEngine.
GameEngine
(player_array)[source]¶ Bases:
object
-
build
(build_info)[source]¶ The Game_Engine uses this method in order to determine which action, if said action is valid, and to complete the instantiation of the object.
- Args:
- build_info (BuildInfo): Object with relevant information to dynamically determine what and where the object to instantiate in the game_state.
- Returns:
- True (bool): Returns a True boolean value if the game_state was modified and the item determined from the passed info was built. False (bool): Returns a False boolean value if the game_state was not modified for any reason.
-
build_item
(object_to_build_on)[source]¶ The Game_Engine uses this method in order to instantiate the object that the build() method has determined as the valid object to instantiate after previous checks, check_location() and player_inventory() methods, have returned a True boolean value. Args:
object_to_build_on (object): An object argument that is passed to this method to determine which object that the build() method, that invoked this method, is attempting to instantiate.- Returns:
- None
-
check_location
(object_to_build_on)[source]¶ The Game_Engine uses this method in order to check if the object_to_build_on value is a valid object to proceed with the build() method that initially invoked this method.
- Args:
- object_to_build_on (object): An object argument that is passed to this method to determine whether or not the object is a valid value that in order to proceed with the build() method that invoked this method.
- Returns:
- True (bool): Returns a True boolean value if the object_to_build_on value is valid in order to proceed with the build() method that invoked this method. False (bool): Returns a False boolean value if the object_to_build_on value is not a valid value in order to proceed with the build() method that invoked this method.
-
check_player_inventory
(build_type)[source]¶ The Game_Engine uses this method in order to check if the current_player has the appropriate attributes in order to proceed with the build() method that invoked this method.
- Args:
- build_type (str): A string argument that is passed to this method to determine which object the build() method is to try and instantiate and check whether or not the current_player has the appropriate attributes to actually instantiate the type of object that the build() method is trying to instantiate.
- Returns:
- True (bool): Returns a True boolean value if the current_player has the appropriate attributes to instantiate the type of object the build() method is attempting to instantiate. False (bool): Returns a False boolean value if the current_player does not have the appropriate attributes to instantiate the type of object the build() method is attempting to instantiate.
-
dice_roll
()[source]¶ This rolls the dice and updates player inventories accordingly.
- Args:
- None
- Returns:
- None
-