diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml
index 4c683c9..821c30b 100644
--- a/.github/workflows/python-app.yml
+++ b/.github/workflows/python-app.yml
@@ -5,9 +5,9 @@ name: Python application
on:
push:
- branches: [ "master" ]
+ branches: [ "master", "Visualizer" ]
pull_request:
- branches: [ "master" ]
+ branches: [ "master", "Visualizer" ]
permissions:
contents: read
@@ -19,10 +19,10 @@ jobs:
steps:
- uses: actions/checkout@v3
- - name: Set up Python 3.10
+ - name: Set up Python 3.11
uses: actions/setup-python@v3
with:
- python-version: "3.10"
+ python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
diff --git a/README.md b/README.md
index 4f3865b..b12273c 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,192 @@
-# byte_le_engine
-Base game engine for use in NDACM Byte-le Royale games.
+# Byte Engine
+
+Revamped base game engine for use in NDACM Byte-le Royale games.
+Changes made in 2023.
+
+## Important Changes
+
+* Overall Change
+ * Every file is now type hinted to facilitate the coding process. For future development,
+ type hint any changes made for the same reason.
+
+
+* Item Class
+ * The item class has many parameters that can be used in a few different ways to allow
+ for flexibility.
+
+ * Value:
+ * This allows for an item to have a value of some sort. This can be used to determine
+ points gained for collecting the item, or its sell price. The meaning can change depending
+ on the project.
+
+ * Durability:
+ * Durability can represent how many uses an item has. What happens after is determined by
+ the development team.
+
+ * Quantity:
+ * This allows for consolidating and representing multiple items in a single item object.
+
+ * Stack Size:
+ * Stack Size determines how many item objects can be consolidated together into a single
+ object at once. This can be thought of as a denominator in a fraction.
+
+ * Reference the Item class for further documentation.
+
+
+* GameBoard Class
+ * GameBoard Seed Parameter
+ * There is a new parameter in the GameBoard class that allows
+ a specific seed to be set. This can be used to help with testing during game development.
+
+ * Map Size Parameter
+ * This is a Vector object that is not used as a coordinate, but the dimensions of the
+ entire game map. Vectors are explained later.
+
+ * Locations Parameter
+ * This parameter allows for user-defined specifications of where to put certain GameObjects
+ on the game map. It is an extensive system used to do this, so refer to the file for
+ further documentation.
+
+ * Walled Parameter
+ * This is a boolean that determines whether to place Wall objects on the border of the game
+ map.
+
+
+* Occupiable Class
+ * A new class was implemented called Occupiable. This class inherits from GameObject and
+ allows for other GameObjects to "stack" on top of one another. As long as an object inherits
+ this class, it can allow for many objects to be located on the same Tile.
+
+
+* Tile Class
+ * The Tile class inherits from Occupiable, allowing for other GameObjects to stack on top of
+ it. A Tile can be used to represent the floor or any other basic object in the game.
+
+
+* Wall Class
+ * The Wall class is a GameObject that represent an impassable object. Use this object to help
+ define the borders of the game map.
+
+
+* Stations
+ * Station Class
+ * The Station represents a basic Station. They can contain items and be interacted with.
+
+ * Occupiable Station
+ * Occupiable Stations represent basic Station objects that can be occupied by another
+ GameObject.
+
+ * Example Classes
+ * The occupiable_station_example, station_example, and station_receiver_example classes
+ are provided to show how their respective files can be used. These can be deleted or used
+ as templates on how to expand on their functionality.
+
+
+* Action Class
+ * This is a class to represent the actions a player takes each turn in object form. This is
+ not implemented in this version of the engine since enums are primarily used.
+
+
+* Avatar Class
+ * The Avatar class is newly implemented in this version of the byte-engine and includes
+ many new features.
+
+ * Position:
+ * The Avatar class has a parameter called "position" which is a Vector object (explained
+ later in this document). This simply stores the Avatar's coordinate on the game map.
+
+ * Inventory:
+ * There is an inventory system implemented in the Avatar class now. You are able to specify
+ the max size of it, and there are methods that are used to pick up items, take items from
+ other objects, and drop the Avatar's held item.
+
+ * Held Item:
+ * The held item of an Avatar is an item that the Avatar has in their inventory. This is done
+ by using enums. Reference the enums.py file for more information.
+
+ * These changes are provided to allow for development to go smoothly. Developers are not obliged
+ to use nor keep any of these changes. The inventory system and any other aspect of the class may be
+ modified or removed as necessary for game development.
+
+
+* Enums File
+ * This file has every significant object being represented as an enum. There are also enums
+ that help with the avatar's inventory system. Refer to the file for a note on this.
+
+
+* Player Class
+ * The player class now receives a list of ActionType enums to allow for multiple actions
+ to happen in one turn. The enum representation can be replaced with the Action object
+ if needed.
+
+
+* Avatar VS Player Classes
+ * These two classes are often confused with each other. Here are their differences.
+ * Avatar:
+ * The Avatar class represents the character that is in the game. The Avatar is
+ what moves around, interacts with other GameObjects, gains points, and whatever else
+ the developers implement.
+
+ * Player:
+ * The Player object encapsulates the Avatar class and represents the physical
+ people competing in the competition. This is why it has parameters such as team_name.
+ It is also why the controllers take a Player object as a parameter and not an Avatar
+ object; it helps manage the information gathered for the individual competitors/teams for
+ the final results.
+
+
+* Controllers
+ * Interact Controller Class
+ * This class controls how players interact with the environment and other GameObjects.
+
+ * Inventory Controller Class
+ * This class controls how players select a certain item in their inventory to then
+ become their held item.
+
+ * Master Controller Class
+ * This controller is used to manage what happens in each turn and update the
+ overarching information of the game's state.
+
+ * Movement Controller Class
+ * This class manages moving the player through the game board by using the given enums.
+
+
+* Generate Game File
+ * This file has a single method that's used to generate the game map. The
+ generation is slow, so call the method when needed. Change the initialized
+ GameBoard object's parameters as necessary for the project.
+
+
+* Vector Class
+ * The Vector class is used to simplify handling coordinates.
+ Some new implementations include ways to increase the values of an already existing Vector,
+ adding two Vectors to create a new one, and returning the Vector's information as
+ a tuple.
+
+
+* Config File
+ * The most notable change in this file is MAX_NUMBER_OF_ACTIONS_PER_TURN. It is used for
+ allowing multiple actions to be taken in one turn. Adjust as necessary.
+
+
+## Development Notes
+
+* Type Hinting
+ * Type hinting is very useful in Python because it prevents any confusion on
+ what type an object is supposed to be, what value a method returns, etc. Make
+ sure to type hint any and everything to eliminate any confusion.
+* Planning
+ * When planning, it's suggested to write out pseudocode, create UMLs, and any
+ other documentation that will help with the process. It is easy to forget what
+ is discussed between meetings without a plan.
+ * Write everything that should be implemented,
+ what files need to be created, their purpose in the project, and more. UML diagrams
+ help see how classes will interact and inherit from each other.
+ * Lastly, documentation is a great method to stay organized too. Having someone to
+ write what is discussed in meetings can be useful; you won't easily lose track of
+ what's discussed.
+
+
## How to run
@@ -11,6 +198,10 @@ python .\launcher.pyz g - will generate a map
python .\launcher.pyz r - will run the game
```
+## Required Python Version
+
+- Requires Python 3.11 due to type of Self
+
## Test Suite Commands:
```bash
diff --git a/base_client.py b/base_client.py
index f60f1ba..3041faf 100644
--- a/base_client.py
+++ b/base_client.py
@@ -12,10 +12,10 @@ def team_name(self):
Allows the team to set a team name.
:return: Your team name
"""
- return 'Team Name'
+ return 'Team 1'
# This is where your AI will decide what to do
- def take_turn(self, turn, actions, world):
+ def take_turn(self, turn, actions, world, avatar):
"""
This is where your AI will decide what to do.
:param turn: The current turn of the game.
diff --git a/base_client_2.py b/base_client_2.py
index f60f1ba..39c4892 100644
--- a/base_client_2.py
+++ b/base_client_2.py
@@ -12,10 +12,10 @@ def team_name(self):
Allows the team to set a team name.
:return: Your team name
"""
- return 'Team Name'
+ return 'Team 2'
# This is where your AI will decide what to do
- def take_turn(self, turn, actions, world):
+ def take_turn(self, turn, actions, world, avatar):
"""
This is where your AI will decide what to do.
:param turn: The current turn of the game.
diff --git a/build.bat b/build.bat
index ee97495..9978a18 100644
--- a/build.bat
+++ b/build.bat
@@ -2,5 +2,7 @@
del /q *.pyz
xcopy /s/e/i "game" "wrapper/game"
+xcopy /s/e/i "visualizer" "wrapper/visualizer"
python -m zipapp "wrapper" -o "launcher.pyz" -c
-del /q/s "wrapper/game"
\ No newline at end of file
+del /q/s "wrapper/game"
+del /q/s "wrapper/visualizer"
\ No newline at end of file
diff --git a/docs/.buildinfo b/docs/.buildinfo
new file mode 100644
index 0000000..944cf7c
--- /dev/null
+++ b/docs/.buildinfo
@@ -0,0 +1,4 @@
+# Sphinx build info version 1
+# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
+config: d3fc67b9478e6fe61af671b363636ca5
+tags: 645f666f9bcd5a90fca523b33c5a78b7
diff --git a/docs/.nojekyll b/docs/.nojekyll
new file mode 100644
index 0000000..e69de29
diff --git a/docs/_modules/base_client.html b/docs/_modules/base_client.html
new file mode 100644
index 0000000..f3ed3cb
--- /dev/null
+++ b/docs/_modules/base_client.html
@@ -0,0 +1,262 @@
+
+
+
+
+
+
+
+ base_client - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for base_client
+from game.client.user_client import UserClient
+from game.common.enums import *
+
+
+[docs] class Client ( UserClient ):
+
# Variables and info you want to save between turns go here
+
def __init__ ( self ):
+
super () . __init__ ()
+
+
[docs] def team_name ( self ):
+
"""
+
Allows the team to set a team name.
+
:return: Your team name
+
"""
+
return 'Team 1'
+
+
# This is where your AI will decide what to do
+
[docs] def take_turn ( self , turn , actions , world , avatar ):
+
"""
+
This is where your AI will decide what to do.
+
:param turn: The current turn of the game.
+
:param actions: This is the actions object that you will add effort allocations or decrees to.
+
:param world: Generic world information
+
"""
+
pass
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/base_client_2.html b/docs/_modules/base_client_2.html
new file mode 100644
index 0000000..c758ada
--- /dev/null
+++ b/docs/_modules/base_client_2.html
@@ -0,0 +1,262 @@
+
+
+
+
+
+
+
+ base_client_2 - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for base_client_2
+from game.client.user_client import UserClient
+from game.common.enums import *
+
+
+[docs] class Client ( UserClient ):
+
# Variables and info you want to save between turns go here
+
def __init__ ( self ):
+
super () . __init__ ()
+
+
[docs] def team_name ( self ):
+
"""
+
Allows the team to set a team name.
+
:return: Your team name
+
"""
+
return 'Team 2'
+
+
# This is where your AI will decide what to do
+
[docs] def take_turn ( self , turn , actions , world , avatar ):
+
"""
+
This is where your AI will decide what to do.
+
:param turn: The current turn of the game.
+
:param actions: This is the actions object that you will add effort allocations or decrees to.
+
:param world: Generic world information
+
"""
+
pass
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/client/user_client.html b/docs/_modules/game/client/user_client.html
new file mode 100644
index 0000000..8f523a7
--- /dev/null
+++ b/docs/_modules/game/client/user_client.html
@@ -0,0 +1,258 @@
+
+
+
+
+
+
+
+ game.client.user_client - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.client.user_client
+from game.common.enums import *
+from game.config import Debug
+import logging
+
+
+[docs] class UserClient :
+
def __init__ ( self ):
+
self . debug_level = DebugLevel . CLIENT
+
self . debug = True
+
+
[docs] def debug ( self , * args ):
+
if self . debug and Debug . level >= self . debug_level :
+
logging . basicConfig ( level = logging . DEBUG )
+
for arg in args :
+
logging . debug ( f ' { self . __class__ . __name__ } : { arg } ' )
+
+
[docs] def team_name ( self ):
+
return "No_Team_Name_Available"
+
+
[docs] def take_turn ( self , turn , actions , world , avatar ):
+
raise NotImplementedError ( "Implement this in subclass" )
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/common/action.html b/docs/_modules/game/common/action.html
new file mode 100644
index 0000000..c5b420e
--- /dev/null
+++ b/docs/_modules/game/common/action.html
@@ -0,0 +1,287 @@
+
+
+
+
+
+
+
+ game.common.action - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.common.action
+from game.common.enums import *
+
+
+[docs] class Action :
+
"""
+
`Action Class:`
+
+
This class encapsulates the different actions a player can execute while playing the game.
+
+
**NOTE**: This is not currently implemented in this version of the Byte Engine. If you want more complex
+
actions, you can use this class for Objects instead of the enums.
+
"""
+
+
def __init__ ( self ):
+
self . object_type = ObjectType . ACTION
+
self . _example_action = None
+
+
def set_action ( self , action ):
+
self . _example_action = action
+
+
def to_json ( self ):
+
data = dict ()
+
+
data [ 'object_type' ] = self . object_type
+
data [ 'example_action' ] = self . _example_action
+
+
return data
+
+
def from_json ( self , data ):
+
self . object_type = data [ 'object_type' ]
+
self . _example_action = data [ 'example_action' ]
+
+
def __str__ ( self ):
+
outstring = ''
+
outstring += f 'Example Action: { self . _example_action } \n '
+
+
return outstring
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/common/avatar.html b/docs/_modules/game/common/avatar.html
new file mode 100644
index 0000000..9ec9a73
--- /dev/null
+++ b/docs/_modules/game/common/avatar.html
@@ -0,0 +1,572 @@
+
+
+
+
+
+
+
+ game.common.avatar - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.common.avatar
+from typing import Self
+
+from game.common.enums import ObjectType
+from game.common.game_object import GameObject
+from game.common.items.item import Item
+from game.utils.vector import Vector
+
+
+[docs] class Avatar ( GameObject ):
+
"""
+
`Avatar Inventory Notes:`
+
+
The avatar's inventory is a list of items. Each item has a quantity and a stack_size (the max amount of an
+
item that can be held in a stack. Think of the Minecraft inventory).
+
+
This upcoming example is just to facilitate understanding the concept. The Dispensing Station concept that will
+
be mentioned is completely optional to implement if you desire. The Dispensing Station is used to help with the
+
explanation.
+
+
----
+
+
**Items:**
+
Every Item has a quantity and a stack_size. The quantity is how much of the Item the player *currently* has.
+
The stack_size is the max of that Item that can be in a stack. For example, if the quantity is 5, and the
+
stack_size is 5 (5/5), the item cannot be added to that stack
+
+
-----
+
+
**Picking up items:**
+
+
Example 1:
+
When you pick up an item (which will now be referred to as picked_up_item), picked_up_item has a given
+
quantity. In this case, let's say the quantity of picked_up_item is 2.
+
+
Imagine you already have this item in your inventory (which will now be referred to as inventory_item),
+
and inventory_item has a quantity of 1 and a stack_size of 10 (think of this as a fraction: 1/10).
+
+
When you pick up picked_up_item, inventory_item will be checked.
+
If picked_up_item's quantity + inventory_item < stack_size, it'll be added without issue.
+
Remember, for this example: picked_up_item quantity is 2, and inventory_item quantity is 1, and
+
stack_size is 10.
+
+
Inventory_item quantity before picking up: 1/10
+
::
+
2 + 1 < 10 --> True
+
Inventory_item quantity after picking up: 3/10
+
+
----
+
+
Example 2:
+
For the next two examples, the total inventory size will be considered.
+
+
Let's say inventory_item has quantity 4 and a stack_size of 5. Now say that picked_up_item has
+
quantity 3.
+
+
Recall: if picked_up_item's quantity + inventory_item < stack_size, it will be added without issue
+
+
Inventory_item quantity before picking up: 4/5
+
::
+
3 + 4 < 5 --> False
+
+
What do we do in this situation? If you want to add picked_up_item to inventory_item and there is an
+
overflow of quantity, that is handled for you.
+
+
Let's say that your inventory size (which will now be referred to as max_inventory_size) is 5. You
+
already have inventory_item in there that has a quantity of 4 and a stack_size of 5. An image of the
+
inventory is below. 'None' is used to help show the max_inventory_size. Inventory_item quantity and
+
stack_size will be listed in parentheses as a fraction.
+
::
+
Inventory:
+
[
+
inventory_item (4/5),
+
None,
+
None,
+
None,
+
None
+
]
+
+
Now we will add picked_up_item and its quantity of 3:
+
::
+
Inventory before:
+
[
+
inventory_item (4/5),
+
None,
+
None,
+
None,
+
None
+
]
+
+
3 + 4 < 5 --> False
+
+
inventory_item (4/5) will now be inventory_item (5/5)
+
picked_up_item now has a quantity of 2 instead of 3
+
Since we have a surplus, we will append the same item with a quantity of 2 in the inventory.
+
::
+
The result is:
+
[
+
inventory_item (5/5),
+
inventory_item (2/5),
+
None,
+
None,
+
None
+
]
+
+
----
+
+
Example 3:
+
For this last example, assume your inventory looks like this:
+
::
+
[
+
inventory_item (5/5),
+
inventory_item (5/5),
+
inventory_item (5/5),
+
inventory_item (5/5),
+
inventory_item (4/5)
+
]
+
+
You can only fit one more inventory_item into the last stack before the inventory is full.
+
Let's say that picked_up_item has quantity of 3 again.
+
::
+
Inventory before:
+
[
+
inventory_item (5/5),
+
inventory_item (5/5),
+
inventory_item (5/5),
+
inventory_item (5/5),
+
inventory_item (4/5)
+
]
+
+
3 + 4 < 5 --> False
+
+
inventory_item (4/5) will now be inventory_item (5/5)
+
picked_up_item now has a quantity of 2
+
However, despite the surplus, we cannot add it into our inventory, so the remaining quantity of
+
picked_up_item is left where it was first found.
+
::
+
Inventory after:
+
[
+
inventory_item (5/5),
+
inventory_item (5/5),
+
inventory_item (5/5),
+
inventory_item (5/5),
+
inventory_item (5/5)
+
]
+
"""
+
+
def __init__ ( self , position : Vector | None = None , max_inventory_size : int = 10 ):
+
super () . __init__ ()
+
self . object_type : ObjectType = ObjectType . AVATAR
+
self . score : int = 0
+
self . position : Vector | None = position
+
self . max_inventory_size : int = max_inventory_size
+
self . inventory : list [ Item | None ] = [ None ] * max_inventory_size
+
self . held_item : Item | None = self . inventory [ 0 ]
+
self . __held_index : int = 0
+
+
@property
+
def held_item ( self ) -> Item | None :
+
self . __clean_inventory ()
+
return self . inventory [ self . __held_index ]
+
+
@property
+
def score ( self ) -> int :
+
return self . __score
+
+
@property
+
def position ( self ) -> Vector | None :
+
return self . __position
+
+
@property
+
def inventory ( self ) -> list [ Item | None ]:
+
return self . __inventory
+
+
@property
+
def max_inventory_size ( self ) -> int :
+
return self . __max_inventory_size
+
+
@held_item . setter
+
def held_item ( self , item : Item | None ) -> None :
+
self . __clean_inventory ()
+
+
# If it's not an item, and it's not None, raise the error
+
if item is not None and not isinstance ( item , Item ):
+
raise ValueError ( f ' { self . __class__ . __name__ } .held_item must be an Item or None.' )
+
+
# If the item is not contained in the inventory, the error will be raised.
+
if not self . inventory . __contains__ ( item ):
+
raise ValueError ( f ' { self . __class__ . __name__ } .held_item must be set to an item that already exists'
+
f ' in the inventory.' )
+
+
# If the item is contained in the inventory, set the held_index to that item's index
+
self . __held_index = self . inventory . index ( item )
+
+
@score . setter
+
def score ( self , score : int ) -> None :
+
if score is None or not isinstance ( score , int ):
+
raise ValueError ( f ' { self . __class__ . __name__ } .score must be an int.' )
+
self . __score : int = score
+
+
@position . setter
+
def position ( self , position : Vector | None ) -> None :
+
if position is not None and not isinstance ( position , Vector ):
+
raise ValueError ( f ' { self . __class__ . __name__ } .position must be a Vector or None.' )
+
self . __position : Vector | None = position
+
+
@inventory . setter
+
def inventory ( self , inventory : list [ Item | None ]) -> None :
+
# If every item in the inventory is not of type None or Item, throw an error
+
if inventory is None or not isinstance ( inventory , list ) \
+
or ( len ( inventory ) > 0 and any ( map ( lambda item : item is not None and not
+
isinstance ( item , Item ), inventory ))):
+
raise ValueError ( f ' { self . __class__ . __name__ } .inventory must be a list of Items.' )
+
if len ( inventory ) > self . max_inventory_size :
+
raise ValueError ( f ' { self . __class__ . __name__ } .inventory size must be less than or equal to '
+
f 'max_inventory_size' )
+
self . __inventory : list [ Item ] = inventory
+
+
@max_inventory_size . setter
+
def max_inventory_size ( self , size : int ) -> None :
+
if size is None or not isinstance ( size , int ):
+
raise ValueError ( f ' { self . __class__ . __name__ } .max_inventory_size must be an int.' )
+
self . __max_inventory_size : int = size
+
+
# Private helper method that cleans the inventory of items that have a quantity of 0. This is a safety check
+
def __clean_inventory ( self ) -> None :
+
"""
+
This method is used to manage the inventory. Whenever an item has a quantity of 0, it will set that item object
+
to None since it doesn't exist in the inventory anymore. Otherwise, if there are multiple instances of an
+
item in the inventory, and they can be consolidated, this method does that.
+
+
Example: In inventory[0], there is a stack of gold with a quantity and stack_size of 5. In inventory[1], there
+
is another stack of gold with quantity of 3, stack size of 5. If you want to take away 4 gold, inventory[0]
+
will have quantity 1, and inventory[1] will have quantity 3. Then, when clean_inventory is called, it will
+
consolidate the two. This mean that inventory[0] will have quantity 4 and inventory[1] will be set to None.
+
:return: None
+
"""
+
+
# This condenses the inventory if there are duplicate items and combines them together
+
for i , item in enumerate ( self . inventory ):
+
[ j . pick_up ( item ) for j in self . inventory [: i ] if j is not None ]
+
+
# This removes any items in the inventory that have a quantity of 0 and replaces them with None
+
remove : [ int ] = [ x [ 0 ] for x in enumerate ( self . inventory ) if x [ 1 ] is not None and x [ 1 ] . quantity == 0 ]
+
for i in remove :
+
self . inventory [ i ] = None
+
+
[docs] def drop_held_item ( self ) -> Item | None :
+
"""
+
Call this method when a station is taking the held item from the avatar.
+
+
This method can be modified more for different scenarios where the held item would be dropped
+
(e.g., you make a game where being attacked forces you to drop your held item).
+
+
If you want the held item to go somewhere specifically and not become None, that can be changed too.
+
+
Make sure to keep clean_inventory() in this method.
+
"""
+
# The held item will be taken from the avatar will be replaced with None in the inventory
+
held_item = self . held_item
+
self . inventory [ self . __held_index ] = None
+
+
self . __clean_inventory ()
+
+
return held_item
+
+
[docs] def take ( self , item : Item | None ) -> Item | None :
+
"""
+
To use this method, pass in an item object. Whatever this item's quantity is will be the amount subtracted from
+
the avatar's inventory. For example, if the item in the inventory is has a quantity of 5 and this method is
+
called with the parameter having a quantity of 2, the item in the inventory will have a quantity of 3.
+
+
Furthermore, when this method is called and the potential item is taken away, the clean_inventory method is
+
called. It will consolidate all similar items together to ensure that the inventory is clean.
+
+
Reference test_avatar_inventory.py and the clean_inventory method for further documentation on this method and
+
how the inventory is managed.
+
+
:param item:
+
:return: Item or None
+
"""
+
# Calls the take method on every index on the inventory. If i isn't None, call the method
+
# NOTE: If the list is full of None (i.e., no Item objects are in it), nothing will happen
+
[ item := i . take ( item ) for i in self . inventory if i is not None ]
+
self . __clean_inventory ()
+
return item
+
+
def pick_up ( self , item : Item | None ) -> Item | None :
+
self . __clean_inventory ()
+
+
# Calls the pick_up method on every index on the inventory. If i isn't None, call the method
+
[ item := i . pick_up ( item ) for i in self . inventory if i is not None ]
+
+
# If the inventory has a slot with None, it will replace that None value with the item
+
if self . inventory . __contains__ ( None ):
+
index = self . inventory . index ( None )
+
self . inventory . pop ( index )
+
self . inventory . insert ( index , item )
+
# Nothing is then returned
+
return None
+
+
# If the item can't be in the inventory, return it
+
return item
+
+
def to_json ( self ) -> dict :
+
data : dict = super () . to_json ()
+
data [ 'held_index' ] = self . __held_index
+
data [ 'held_item' ] = self . held_item . to_json () if self . held_item is not None else None
+
data [ 'score' ] = self . score
+
data [ 'position' ] = self . position . to_json () if self . position is not None else None
+
data [ 'inventory' ] = self . inventory
+
data [ 'max_inventory_size' ] = self . max_inventory_size
+
return data
+
+
def from_json ( self , data : dict ) -> Self :
+
super () . from_json ( data )
+
self . score : int = data [ 'score' ]
+
self . position : Vector | None = None if data [ 'position' ] is None else Vector () . from_json ( data [ 'position' ])
+
self . inventory : list [ Item ] = data [ 'inventory' ]
+
self . max_inventory_size : int = data [ 'max_inventory_size' ]
+
self . held_item : Item | None = self . inventory [ data [ 'held_index' ]]
+
+
return self
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/common/enums.html b/docs/_modules/game/common/enums.html
new file mode 100644
index 0000000..b30e1d8
--- /dev/null
+++ b/docs/_modules/game/common/enums.html
@@ -0,0 +1,308 @@
+
+
+
+
+
+
+
+ game.common.enums - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.common.enums
+from enum import Enum , auto
+
+"""
+**NOTE:** The use of the enum structure is to make is easier to execute certain tasks. It also helps with
+identifying types of Objects throughout the project.
+
+When developing the game, add any extra enums as necessary.
+"""
+
+[docs] class DebugLevel ( Enum ):
+
NONE = auto ()
+
CLIENT = auto ()
+
CONTROLLER = auto ()
+
ENGINE = auto ()
+
+[docs] class ObjectType ( Enum ):
+
NONE = auto ()
+
ACTION = auto ()
+
PLAYER = auto ()
+
AVATAR = auto ()
+
GAMEBOARD = auto ()
+
VECTOR = auto ()
+
TILE = auto ()
+
WALL = auto ()
+
ITEM = auto ()
+
OCCUPIABLE = auto ()
+
STATION = auto ()
+
OCCUPIABLE_STATION = auto ()
+
STATION_EXAMPLE = auto ()
+
STATION_RECEIVER_EXAMPLE = auto ()
+
OCCUPIABLE_STATION_EXAMPLE = auto ()
+
+
+[docs] class ActionType ( Enum ):
+
NONE = auto ()
+
MOVE_UP = auto ()
+
MOVE_DOWN = auto ()
+
MOVE_LEFT = auto ()
+
MOVE_RIGHT = auto ()
+
INTERACT_UP = auto ()
+
INTERACT_DOWN = auto ()
+
INTERACT_LEFT = auto ()
+
INTERACT_RIGHT = auto ()
+
INTERACT_CENTER = auto ()
+
SELECT_SLOT_0 = auto ()
+
SELECT_SLOT_1 = auto ()
+
SELECT_SLOT_2 = auto ()
+
SELECT_SLOT_3 = auto ()
+
SELECT_SLOT_4 = auto ()
+
SELECT_SLOT_5 = auto ()
+
SELECT_SLOT_6 = auto ()
+
SELECT_SLOT_7 = auto ()
+
SELECT_SLOT_8 = auto ()
+
SELECT_SLOT_9 = auto ()
+
"""
+
These last 10 enums are for selecting a slot from the Avatar class' inventory.
+
You can add/remove these as needed for the purposes of your game.
+
"""
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/common/game_object.html b/docs/_modules/game/common/game_object.html
new file mode 100644
index 0000000..da90eff
--- /dev/null
+++ b/docs/_modules/game/common/game_object.html
@@ -0,0 +1,288 @@
+
+
+
+
+
+
+
+ game.common.game_object - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.common.game_object
+import uuid
+
+from game.common.enums import ObjectType
+from typing import Self
+
+
+[docs] class GameObject :
+
"""
+
`GameObject Class Notes:`
+
+
This class is widely used throughout the project to represent different types of Objects that are interacted
+
with in the game. If a new class is created and needs to be logged to the JSON files, make sure it inherits
+
from GameObject.
+
"""
+
def __init__ ( self , ** kwargs ):
+
self . id = str ( uuid . uuid4 ())
+
self . object_type = ObjectType . NONE
+
self . state = "idle"
+
+
def to_json ( self ) -> dict :
+
# It is recommended call this using super() in child implementations
+
data = dict ()
+
+
data [ 'id' ] = self . id
+
data [ 'object_type' ] = self . object_type . value
+
data [ 'state' ] = self . state
+
+
return data
+
+
def from_json ( self , data : dict ) -> Self :
+
# It is recommended call this using super() in child implementations
+
self . id = data [ 'id' ]
+
self . object_type = ObjectType ( data [ 'object_type' ])
+
self . state = data [ 'state' ]
+
return self
+
+
def obfuscate ( self ):
+
pass
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/common/items/item.html b/docs/_modules/game/common/items/item.html
new file mode 100644
index 0000000..a06112e
--- /dev/null
+++ b/docs/_modules/game/common/items/item.html
@@ -0,0 +1,445 @@
+
+
+
+
+
+
+
+ game.common.items.item - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.common.items.item
+from game.common.enums import ObjectType
+from game.common.game_object import GameObject
+from typing import Self
+
+
+[docs] class Item ( GameObject ):
+
"""
+
`Item Class Notes:`
+
+
Items have 4 different attributes: value, durability, quantity, stack-size.
+
+
-----
+
+
Value:
+
The value of an item can be anything depending on the purpose of the game. For example, if a player can
+
sell an item to a shop for monetary value, the value attribute would be used. However, this value may be
+
used for anything to better fit the purpose of the game being created.
+
+
-----
+
+
Durability:
+
The value of an item's durability can be either None or an integer.
+
If durability is an integer, the stack size *must* be 1. Think of Minecraft and the mechanics of tools. You
+
can only have one sword with a durability (they don't stack).
+
+
If the durability is equal to None, it represents the item having infinite durability. The item can now be
+
stacked with others of the same type. In the case the game being created needs items without durability,
+
set this attribute to None to prevent any difficulties.
+
+
-----
+
+
Quantity and Stack Size:
+
These two work in tandem. Fractions (x/y) will be used to better explain the concept.
+
+
Quantity simply refers to the amount of the current item the player has. For example, having 5 gold, 10
+
gold, or 0 gold all work for representing the quantity.
+
+
The stack_size represents how *much* of an item can be in a stack. Think of this like the Minecraft inventory
+
system. For example, you can have 64 blocks of dirt, and if you were to gain one more, you would have a new
+
stack starting at 1.
+
+
In the case of items here, it works with the avatar.py file's inventory system (refer to those notes on how
+
the inventory works in depth). The Minecraft analogy should help understand the concept.
+
+
To better show this, quantity and stack size work like the following fraction model: quantity/stack_size.
+
+
The quantity can never be 0 and must always be a minimum of 1. Furthermore, quantity cannot be greater than
+
the stack_size. So 65/64 will not be possible.
+
+
-----
+
+
Pick Up Method:
+
When picking up an item, it will first check the item's ObjectType. If the Object interacted with is not of
+
the ObjectType ITEM enum, an error will be thrown.
+
+
Otherwise, the method will check if the picked up item will be able to fit in the inventory. If some of the
+
item's quantity can be picked up and a surplus will be left over, the player will be pick up what they can.
+
+
Then, the same item they picked up will have its quantity modified to be what is left over. That surplus of
+
the item is then returned to allow for it to be placed back where it was found on the map.
+
+
If the player can pick up an item without any inventory issues, the entire item and its quantity will be added.
+
+
**Refer to avatar.py for a more in-depth explanation of how picking up items work with examples.**
+
"""
+
+
def __init__ ( self , value : int = 1 , durability : int | None = None , quantity : int = 1 , stack_size : int = 1 ):
+
super () . __init__ ()
+
self . __quantity = None # This is here to prevent an error
+
self . __durability = None # This is here to prevent an error
+
self . object_type : ObjectType = ObjectType . ITEM
+
self . value : int = value # Value can more specified based on purpose (e.g., the sell price)
+
self . stack_size : int = stack_size # the max quantity this item can contain
+
self . durability : int | None = durability # durability can be None to represent infinite durability
+
self . quantity : int = quantity # the current amount of this item
+
+
@property
+
def durability ( self ) -> int | None :
+
return self . __durability
+
+
@property
+
def value ( self ) -> int :
+
return self . __value
+
+
@property
+
def quantity ( self ) -> int :
+
return self . __quantity
+
+
@property
+
def stack_size ( self ) -> int :
+
return self . __stack_size
+
+
@durability . setter
+
def durability ( self , durability : int | None ) -> None :
+
if durability is not None and not isinstance ( durability , int ):
+
raise ValueError ( f ' { self . __class__ . __name__ } .durability must be an int or None.' )
+
if durability is not None and self . stack_size != 1 :
+
raise ValueError (
+
f ' { self . __class__ . __name__ } .durability must be set to None if stack_size is not equal to 1.' )
+
self . __durability = durability
+
+
@value . setter
+
def value ( self , value : int ) -> None :
+
if value is None or not isinstance ( value , int ):
+
raise ValueError ( f ' { self . __class__ . __name__ } .value must be an int.' )
+
self . __value : int = value
+
+
@quantity . setter
+
def quantity ( self , quantity : int ) -> None :
+
if quantity is None or not isinstance ( quantity , int ):
+
raise ValueError ( f ' { self . __class__ . __name__ } .quantity must be an int.' )
+
if quantity < 0 :
+
raise ValueError ( f ' { self . __class__ . __name__ } .quantity must be greater than or equal to 0.' )
+
+
# The self.quantity is set to the lower value between stack_size and the given quantity
+
# The remaining given quantity is returned if it's larger than self.quantity
+
if quantity > self . stack_size :
+
raise ValueError ( f ' { self . __class__ . __name__ } .quantity cannot be greater than '
+
f ' { self . __class__ . __name__ } .stack_size' )
+
self . __quantity : int = quantity
+
+
@stack_size . setter
+
def stack_size ( self , stack_size : int ) -> None :
+
if stack_size is None or not isinstance ( stack_size , int ):
+
raise ValueError ( f ' { self . __class__ . __name__ } .stack_size must be an int.' )
+
if self . durability is not None and stack_size != 1 :
+
raise ValueError ( f ' { self . __class__ . __name__ } .stack_size must be 1 if { self . __class__ . __name__ } .durability '
+
f 'is not None.' )
+
if self . __quantity is not None and stack_size < self . __quantity :
+
raise ValueError ( f ' { self . __class__ . __name__ } .stack_size must be greater than or equal to the quantity.' )
+
self . __stack_size : int = stack_size
+
+
def take ( self , item : Self ) -> Self | None :
+
if item is not None and not isinstance ( item , Item ):
+
raise ValueError ( f ' { item . __class__ . __name__ } is not of type Item.' )
+
+
# If the item is None, just return None
+
if item is None :
+
return None
+
+
# If the items don't match, return the given item without modifications
+
if self . object_type != item . object_type :
+
return item
+
+
# If subtracting the given item's quantity from self's quantity is less than 0, raise an error
+
if self . quantity - item . quantity < 0 :
+
item . quantity -= self . quantity
+
self . quantity = 0
+
return item
+
+
# Reduce self.quantity
+
self . quantity -= item . quantity
+
item . quantity = 0
+
+
return None
+
+
def pick_up ( self , item : Self ) -> Self | None :
+
if item is not None and not isinstance ( item , Item ):
+
raise ValueError ( f ' { item . __class__ . __name__ } is not of type Item.' )
+
+
# If the item is None, just return None
+
if item is None :
+
return None
+
+
# If the items don't match, return the given item without modifications
+
if self . object_type != item . object_type :
+
return item
+
+
# If the picked up quantity goes over the stack_size, add to make the quantity equal the stack_size
+
if self . quantity + item . quantity > self . stack_size :
+
item . quantity -= self . stack_size - self . quantity
+
self . quantity : int = self . stack_size
+
return item
+
+
# Add the given item's quantity to the self item
+
self . quantity += item . quantity
+
item . quantity = 0
+
+
return None
+
+
def to_json ( self ) -> dict :
+
data : dict = super () . to_json ()
+
data [ 'stack_size' ] = self . stack_size
+
data [ 'durability' ] = self . durability
+
data [ 'value' ] = self . value
+
data [ 'quantity' ] = self . quantity
+
return data
+
+
def from_json ( self , data : dict ) -> Self :
+
super () . from_json ( data )
+
self . durability : int | None = data [ 'durability' ]
+
self . stack_size : int = data [ 'stack_size' ]
+
self . quantity : int = data [ 'quantity' ]
+
self . value : int = data [ 'value' ]
+
return self
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/common/map/game_board.html b/docs/_modules/game/common/map/game_board.html
new file mode 100644
index 0000000..97be07c
--- /dev/null
+++ b/docs/_modules/game/common/map/game_board.html
@@ -0,0 +1,596 @@
+
+
+
+
+
+
+
+ game.common.map.game_board - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.common.map.game_board
+import random
+from typing import Self , Callable
+
+from game.common.avatar import Avatar
+from game.common.enums import *
+from game.common.game_object import GameObject
+from game.common.map.tile import Tile
+from game.common.map.wall import Wall
+from game.common.stations.occupiable_station import OccupiableStation
+from game.common.stations.station import Station
+from game.utils.vector import Vector
+
+
+[docs] class GameBoard ( GameObject ):
+
"""
+
`GameBoard Class Notes:`
+
+
Map Size:
+
---------
+
map_size is a Vector object, allowing you to specify the size of the (x, y) plane of the game board.
+
For example, a Vector object with an 'x' of 5 and a 'y' of 7 will create a board 5 tiles wide and
+
7 tiles long.
+
+
Example:
+
::
+
_ _ _ _ _ y = 0
+
| |
+
| |
+
| |
+
| |
+
| |
+
| |
+
_ _ _ _ _ y = 6
+
+
-----
+
+
Locations:
+
----------
+
This is the bulkiest part of the generation.
+
+
The locations field is a dictionary with a key of a tuple of Vectors, and the value being a list of
+
GameObjects (the key **must** be a tuple instead of a list because Python requires dictionary keys to be
+
immutable).
+
+
This is used to assign the given GameObjects the given coordinates via the Vectors. This is done in two ways:
+
+
Statically:
+
If you want a GameObject to be at a specific coordinate, ensure that the key-value pair is
+
*ONE* Vector and *ONE* GameObject.
+
An example of this would be the following:
+
::
+
locations = { (vector_2_4) : [station_0] }
+
+
In this example, vector_2_4 contains the coordinates (2, 4). (Note that this naming convention
+
isn't necessary, but was used to help with the concept). Furthermore, station_0 is the
+
GameObject that will be at coordinates (2, 4).
+
+
Dynamically:
+
If you want to assign multiple GameObjects to different coordinates, use a key-value
+
pair of any length.
+
+
**NOTE**: The length of the tuple and list *MUST* be equal, otherwise it will not
+
work. In this case, the assignments will be random. An example of this would be the following:
+
::
+
locations =
+
{
+
(vector_0_0, vector_1_1, vector_2_2) : [station_0, station_1, station_2]
+
}
+
+
(Note that the tuple and list both have a length of 3).
+
+
When this is passed in, the three different vectors containing coordinates (0, 0), (1, 1), or
+
(2, 2) will be randomly assigned station_0, station_1, or station_2.
+
+
If station_0 is randomly assigned at (1, 1), station_1 could be at (2, 2), then station_2 will be at (0, 0).
+
This is just one case of what could happen.
+
+
Lastly, another example will be shown to explain that you can combine both static and
+
dynamic assignments in the same dictionary:
+
::
+
locations =
+
{
+
(vector_0_0) : [station_0],
+
(vector_0_1) : [station_1],
+
(vector_1_1, vector_1_2, vector_1_3) : [station_2, station_3, station_4]
+
}
+
+
In this example, station_0 will be at vector_0_0 without interference. The same applies to
+
station_1 and vector_0_1. However, for vector_1_1, vector_1_2, and vector_1_3, they will randomly
+
be assigned station_2, station_3, and station_4.
+
+
-----
+
+
Walled:
+
-------
+
This is simply a bool value that will create a wall barrier on the boundary of the game_board. If
+
walled is True, the wall will be created for you.
+
+
For example, let the dimensions of the map be (5, 7). There will be wall Objects horizontally across
+
x = 0 and x = 4. There will also be wall Objects vertically at y = 0 and y = 6
+
+
Below is a visual example of this, with 'x' being where the wall Objects are.
+
+
Example:
+
::
+
x x x x x y = 0
+
x x
+
x x
+
x x
+
x x
+
x x
+
x x x x x y = 6
+
"""
+
+
def __init__ ( self , seed : int | None = None , map_size : Vector = Vector (),
+
locations : dict [ tuple [ Vector ]: list [ GameObject ]] | None = None , walled : bool = False ):
+
+
super () . __init__ ()
+
# game_map is initially going to be None. Since generation is slow, call generate_map() as needed
+
self . game_map : list [ list [ Tile ]] | None = None
+
self . seed : int | None = seed
+
random . seed ( seed )
+
self . object_type : ObjectType = ObjectType . GAMEBOARD
+
self . event_active : int | None = None
+
self . map_size : Vector = map_size
+
# when passing Vectors as a tuple, end the tuple of Vectors with a comma so it is recognized as a tuple
+
self . locations : dict | None = locations
+
self . walled : bool = walled
+
+
@property
+
def seed ( self ) -> int :
+
return self . __seed
+
+
@seed . setter
+
def seed ( self , seed : int | None ) -> None :
+
if self . game_map is not None :
+
raise RuntimeError ( f ' { self . __class__ . __name__ } variables cannot be changed once generate_map is run.' )
+
if seed is not None and not isinstance ( seed , int ):
+
raise ValueError ( f ' { self . __class__ . __name__ } .seed must be an integer or None.' )
+
self . __seed = seed
+
+
@property
+
def game_map ( self ) -> list [ list [ Tile ]] | None :
+
return self . __game_map
+
+
@game_map . setter
+
def game_map ( self , game_map : list [ list [ Tile ]]) -> None :
+
if game_map is not None and ( not isinstance ( game_map , list ) or
+
any ( map ( lambda l : not isinstance ( l , list ), game_map )) or
+
any ([ any ( map ( lambda g : not isinstance ( g , Tile ), tile_list ))
+
for tile_list in game_map ])):
+
raise ValueError ( f ' { self . __class__ . __name__ } .game_map must be a list[list[Tile]].' )
+
self . __game_map = game_map
+
+
@property
+
def map_size ( self ) -> Vector :
+
return self . __map_size
+
+
@map_size . setter
+
def map_size ( self , map_size : Vector ) -> None :
+
if self . game_map is not None :
+
raise RuntimeError ( f ' { self . __class__ . __name__ } variables cannot be changed once generate_map is run.' )
+
if map_size is None or not isinstance ( map_size , Vector ):
+
raise ValueError ( f ' { self . __class__ . __name__ } .map_size must be a Vector.' )
+
self . __map_size = map_size
+
+
@property
+
def locations ( self ) -> dict :
+
return self . __locations
+
+
@locations . setter
+
def locations ( self , locations : dict [ tuple [ Vector ]: list [ GameObject ]] | None ) -> None :
+
if self . game_map is not None :
+
raise RuntimeError ( f ' { self . __class__ . __name__ } variables cannot be changed once generate_map is run.' )
+
if locations is not None and not isinstance ( locations , dict ):
+
raise ValueError ( "Locations must be a dict. The key must be a tuple of Vector Objects, and the "
+
"value a list of GameObject." )
+
# if locations is not None:
+
# for k, v in locations.items():
+
# if len(k) != len(v):
+
# raise ValueError("Cannot set the locations for the game_board. A key has a different "
+
# "length than its key.")
+
+
self . __locations = locations
+
+
@property
+
def walled ( self ) -> bool :
+
return self . __walled
+
+
@walled . setter
+
def walled ( self , walled : bool ) -> None :
+
if self . game_map is not None :
+
raise RuntimeError ( f ' { self . __class__ . __name__ } variables cannot be changed once generate_map is run.' )
+
if walled is None or not isinstance ( walled , bool ):
+
raise ValueError ( f ' { self . __class__ . __name__ } .walled must be a bool.' )
+
+
self . __walled = walled
+
+
def generate_map ( self ) -> None :
+
# generate map
+
self . game_map = [[ Tile () for _ in range ( self . map_size . x )] for _ in range ( self . map_size . y )]
+
+
if self . walled :
+
for x in range ( self . map_size . x ):
+
if x == 0 or x == self . map_size . x - 1 :
+
for y in range ( self . map_size . y ):
+
self . game_map [ y ][ x ] . occupied_by = Wall ()
+
self . game_map [ 0 ][ x ] . occupied_by = Wall ()
+
self . game_map [ self . map_size . y - 1 ][ x ] . occupied_by = Wall ()
+
+
self . __populate_map ()
+
+
def __populate_map ( self ) -> None :
+
for k , v in self . locations . items ():
+
if len ( k ) == 0 or len ( v ) == 0 : # Key-Value lengths must be > 0 and equal
+
raise ValueError ( "A key-value pair from game_board.locations has a length of 0. " )
+
+
# random.sample returns a randomized list which is used in __help_populate()
+
j = random . sample ( k , k = len ( k ))
+
self . __help_populate ( j , v )
+
+
def __occupied_filter ( self , game_object_list : list [ GameObject ]) -> list [ GameObject ]:
+
"""
+
A helper method that returns a list of game objects that have the 'occupied_by' attribute.
+
:param game_object_list:
+
:return: a list of game object
+
"""
+
return [ game_object for game_object in game_object_list if hasattr ( game_object , 'occupied_by' )]
+
+
def __help_populate ( self , vector_list : list [ Vector ], game_object_list : list [ GameObject ]) -> None :
+
"""
+
A helper method that helps populate the game map.
+
:param vector_list:
+
:param game_object_list:
+
:return: None
+
"""
+
+
zipped_list : [ tuple [ list [ Vector ], list [ GameObject ]]] = list ( zip ( vector_list , game_object_list ))
+
last_vec : Vector = zipped_list [ - 1 ][ 0 ]
+
+
remaining_objects : list [ GameObject ] | None = self . __occupied_filter ( game_object_list [ len ( zipped_list ):]) \
+
if len ( self . __occupied_filter ( game_object_list )) > len ( zipped_list ) \
+
else None
+
+
# Will cap at smallest list when zipping two together
+
for vector , game_object in zipped_list :
+
if isinstance ( game_object , Avatar ): # If the GameObject is an Avatar, assign it the coordinate position
+
game_object . position = vector
+
+
temp_tile : GameObject = self . game_map [ vector . y ][ vector . x ]
+
+
while hasattr ( temp_tile . occupied_by , 'occupied_by' ):
+
temp_tile = temp_tile . occupied_by
+
+
if temp_tile is None :
+
raise ValueError ( "Last item on the given tile doesn't have the 'occupied_by' attribute." )
+
+
temp_tile . occupied_by = game_object
+
+
if remaining_objects is None :
+
return
+
+
# stack remaining game_objects on last vector
+
temp_tile : GameObject = self . game_map [ last_vec . y ][ last_vec . x ]
+
+
while hasattr ( temp_tile . occupied_by , 'occupied_by' ):
+
temp_tile = temp_tile . occupied_by
+
+
for game_object in remaining_objects :
+
if temp_tile is None :
+
raise ValueError ( "Last item on the given tile doesn't have the 'occupied_by' attribute." )
+
+
temp_tile . occupied_by = game_object
+
temp_tile = temp_tile . occupied_by
+
+
def get_objects ( self , look_for : ObjectType ) -> list [ tuple [ Vector , list [ GameObject ]]]:
+
to_return : list [ tuple [ Vector , list [ GameObject ]]] = list ()
+
+
for y , row in enumerate ( self . game_map ):
+
for x , object_in_row in enumerate ( row ):
+
go_list : list [ GameObject ] = []
+
temp : GameObject = object_in_row
+
self . __get_objects_help ( look_for , temp , go_list )
+
if len ( go_list ) > 0 :
+
to_return . append (( Vector ( x = x , y = y ), [ * go_list , ]))
+
+
return to_return
+
+
def __get_objects_help ( self , look_for : ObjectType , temp : GameObject | Tile , to_return : list [ GameObject ]):
+
while hasattr ( temp , 'occupied_by' ):
+
if temp . object_type is look_for :
+
to_return . append ( temp )
+
+
# The final temp is the last occupied by option which is either an Avatar, Station, or None
+
temp = temp . occupied_by
+
+
if temp is not None and temp . object_type is look_for :
+
to_return . append ( temp )
+
+
def to_json ( self ) -> dict :
+
data : dict [ str , object ] = super () . to_json ()
+
temp : list [ list [ Tile ]] = list (
+
list ( map ( lambda tile : tile . to_json (), y )) for y in self . game_map ) if self . game_map is not None else None
+
data [ "game_map" ] = temp
+
data [ "seed" ] = self . seed
+
data [ "map_size" ] = self . map_size . to_json ()
+
data [ "location_vectors" ] = [[ vec . to_json () for vec in k ] for k in
+
self . locations . keys ()] if self . locations is not None else None
+
data [ "location_objects" ] = [[ obj . to_json () for obj in v ] for v in
+
self . locations . values ()] if self . locations is not None else None
+
data [ "walled" ] = self . walled
+
data [ 'event_active' ] = self . event_active
+
return data
+
+
def generate_event ( self , start : int , end : int ) -> None :
+
self . event_active = random . randint ( start , end )
+
+
def __from_json_helper ( self , data : dict ) -> GameObject :
+
temp : ObjectType = ObjectType ( data [ 'object_type' ])
+
match temp :
+
case ObjectType . WALL :
+
return Wall () . from_json ( data )
+
case ObjectType . OCCUPIABLE_STATION :
+
return OccupiableStation () . from_json ( data )
+
case ObjectType . STATION :
+
return Station () . from_json ( data )
+
case ObjectType . AVATAR :
+
return Avatar () . from_json ( data )
+
# If adding more ObjectTypes that can be placed on the game_board, specify here
+
case _ :
+
raise ValueError ( f 'The location (dict) must have a valid key (tuple of vectors) and a valid value ('
+
f 'list of GameObjects).' )
+
+
def from_json ( self , data : dict ) -> Self :
+
super () . from_json ( data )
+
temp = data [ "game_map" ]
+
self . seed : int | None = data [ "seed" ]
+
self . map_size : Vector = Vector () . from_json ( data [ "map_size" ])
+
self . locations : dict [ tuple [ Vector ]: list [ GameObject ]] = {
+
tuple ( map ( lambda vec : Vector () . from_json ( vec ), k )): [ self . __from_json_helper ( obj ) for obj in v ] for k , v in
+
zip ( data [ "location_vectors" ], data [ "location_objects" ])} if data [ "location_vectors" ] is not None else None
+
self . walled : bool = data [ "walled" ]
+
self . event_active : int = data [ 'event_active' ]
+
self . game_map : list [ list [ Tile ]] = [
+
[ Tile () . from_json ( tile ) for tile in y ] for y in temp ] if temp is not None else None
+
return self
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/common/map/occupiable.html b/docs/_modules/game/common/map/occupiable.html
new file mode 100644
index 0000000..8be149d
--- /dev/null
+++ b/docs/_modules/game/common/map/occupiable.html
@@ -0,0 +1,293 @@
+
+
+
+
+
+
+
+ game.common.map.occupiable - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.common.map.occupiable
+from game.common.enums import ObjectType
+from game.common.game_object import GameObject
+from game.common.items.item import Item
+from typing import Self
+
+
+[docs] class Occupiable ( GameObject ):
+
"""
+
`Occupiable Class Notes:`
+
+
Occupiable objects exist to encapsulate all objects that could be placed on the gameboard.
+
+
These objects can only be occupied by GameObjects, so inheritance is important. The ``None`` value is
+
acceptable for this too, showing that nothing is occupying the object.
+
+
Note: The class Item inherits from GameObject, but it is not allowed to be on an Occupiable object.
+
"""
+
+
def __init__ ( self , occupied_by : GameObject = None , ** kwargs ):
+
super () . __init__ ()
+
self . object_type : ObjectType = ObjectType . OCCUPIABLE
+
self . occupied_by : GameObject | None = occupied_by
+
+
@property
+
def occupied_by ( self ) -> GameObject | None :
+
return self . __occupied_by
+
+
@occupied_by . setter
+
def occupied_by ( self , occupied_by : GameObject | None ) -> None :
+
if occupied_by is not None and isinstance ( occupied_by , Item ):
+
raise ValueError ( f ' { self . __class__ . __name__ } .occupied_by cannot be an Item.' )
+
if occupied_by is not None and not isinstance ( occupied_by , GameObject ):
+
raise ValueError ( f ' { self . __class__ . __name__ } .occupied_by must be None or an instance of GameObject.' )
+
self . __occupied_by = occupied_by
+
+
def to_json ( self ) -> dict :
+
data : dict = super () . to_json ()
+
data [ 'occupied_by' ] = self . occupied_by . to_json () if self . occupied_by is not None else None
+
return data
+
+
def from_json ( self , data : dict ) -> Self :
+
super () . from_json ( data )
+
return self
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/common/map/tile.html b/docs/_modules/game/common/map/tile.html
new file mode 100644
index 0000000..a2d10d5
--- /dev/null
+++ b/docs/_modules/game/common/map/tile.html
@@ -0,0 +1,295 @@
+
+
+
+
+
+
+
+ game.common.map.tile - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.common.map.tile
+from game.common.map.occupiable import Occupiable
+from game.common.enums import ObjectType
+from game.common.game_object import GameObject
+from game.common.avatar import Avatar
+from game.common.stations.occupiable_station import OccupiableStation
+from game.common.stations.station import Station
+from game.common.map.wall import Wall
+from typing import Self
+
+
+[docs] class Tile ( Occupiable ):
+
"""
+
`Tile Class Notes:`
+
+
The Tile class exists to encapsulate all objects that could be placed on the gameboard.
+
+
Tiles will represent things like the floor in the game. They inherit from Occupiable, which allows for tiles to
+
have certain GameObjects and the avatar on it.
+
+
If the game being developed requires different tiles with special properties, future classes may be added and
+
inherit from this class.
+
"""
+
def __init__ ( self , occupied_by : GameObject = None ):
+
super () . __init__ ()
+
self . object_type : ObjectType = ObjectType . TILE
+
+
def from_json ( self , data : dict ) -> Self :
+
super () . from_json ( data )
+
occupied_by : dict | None = data [ 'occupied_by' ]
+
if occupied_by is None :
+
self . occupied_by = None
+
return self
+
# Add all possible game objects that can occupy a tile here (requires python 3.10)
+
match ObjectType ( occupied_by [ 'object_type' ]):
+
case ObjectType . AVATAR :
+
self . occupied_by : Avatar = Avatar () . from_json ( occupied_by )
+
case ObjectType . OCCUPIABLE_STATION :
+
self . occupied_by : OccupiableStation = OccupiableStation () . from_json ( occupied_by )
+
case ObjectType . STATION :
+
self . occupied_by : Station = Station () . from_json ( occupied_by )
+
case ObjectType . WALL :
+
self . occupied_by : Wall = Wall () . from_json ( occupied_by )
+
case _ :
+
raise Exception ( f 'Could not parse occupied_by: { occupied_by } ' )
+
return self
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/common/map/wall.html b/docs/_modules/game/common/map/wall.html
new file mode 100644
index 0000000..dc3dff3
--- /dev/null
+++ b/docs/_modules/game/common/map/wall.html
@@ -0,0 +1,264 @@
+
+
+
+
+
+
+
+ game.common.map.wall - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.common.map.wall
+from game.common.enums import ObjectType
+from game.common.game_object import GameObject
+
+
+[docs] class Wall ( GameObject ):
+
"""
+
`Wall Class Note:`
+
+
The Wall class is used for creating objects that border the map. These are impassable.
+
"""
+
def __init__ ( self ):
+
super () . __init__ ()
+
self . object_type = ObjectType . WALL
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/common/player.html b/docs/_modules/game/common/player.html
new file mode 100644
index 0000000..de1f551
--- /dev/null
+++ b/docs/_modules/game/common/player.html
@@ -0,0 +1,388 @@
+
+
+
+
+
+
+
+ game.common.player - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.common.player
+from game.common.action import Action
+from game.common.game_object import GameObject
+from game.common.avatar import Avatar
+from game.common.enums import *
+from game.client.user_client import UserClient
+
+
+[docs] class Player ( GameObject ):
+
"""
+
`Player Class Notes:`
+
+
-----
+
+
The Player class is what represents the team that's competing. The player can contain a list of Actions to
+
execute each turn. The avatar is what's used to execute actions (e.g., interacting with stations, picking up
+
items, etc.). For more details on the difference between the Player and Avatar classes, refer to the README
+
document.
+
"""
+
def __init__ ( self , code : object | None = None , team_name : str | None = None , actions : list [ ActionType ] = [],
+
avatar : Avatar | None = None ):
+
super () . __init__ ()
+
self . object_type : ObjectType = ObjectType . PLAYER
+
self . functional : bool = True
+
# self.error: object | None = None # error is not used
+
self . team_name : str | None = team_name
+
self . code : UserClient | None = code
+
# self.action: Action = action
+
self . actions : list [ ActionType ] = actions
+
self . avatar : Avatar | None = avatar
+
+
@property
+
def actions ( self ) -> list [ ActionType ] | list : # change to Action if you want to use the action object
+
return self . __actions
+
+
@actions . setter
+
def actions ( self , actions : list [ ActionType ] | list ) -> None : # showing it returns nothing(like void in java)
+
# if it's (not none = and) if its (none = or)
+
# going across all action types and making it a boolean, if any are true this will be true\/
+
if actions is None or not isinstance ( actions , list ) \
+
or ( len ( actions ) > 0
+
and any ( map ( lambda action_type : not isinstance ( action_type , ActionType ), actions ))):
+
raise ValueError ( f ' { self . __class__ . __name__ } .action must be an empty list or a list of action types' )
+
# ^if it's not either throw an error
+
self . __actions = actions
+
+
@property
+
def functional ( self ) -> bool :
+
return self . __functional
+
+
@functional . setter # do this for all the setters
+
def functional ( self , functional : bool ) -> None : # this enforces the type hinting
+
if functional is None or not isinstance ( functional , bool ): # if this statement is true throw an error
+
raise ValueError ( f ' { self . __class__ . __name__ } .functional must be a boolean' )
+
self . __functional = functional
+
+
@property
+
def team_name ( self ) -> str :
+
return self . __team_name
+
+
@team_name . setter
+
def team_name ( self , team_name : str ) -> None :
+
if team_name is not None and not isinstance ( team_name , str ):
+
raise ValueError ( f ' { self . __class__ . __name__ } .team_name must be a String or None' )
+
self . __team_name = team_name
+
+
@property
+
def avatar ( self ) -> Avatar :
+
return self . __avatar
+
+
@avatar . setter
+
def avatar ( self , avatar : Avatar ) -> None :
+
if avatar is not None and not isinstance ( avatar , Avatar ):
+
raise ValueError ( f ' { self . __class__ . __name__ } .avatar must be Avatar or None' )
+
self . __avatar = avatar
+
+
@property
+
def object_type ( self ) -> ObjectType :
+
return self . __object_type
+
+
@object_type . setter
+
def object_type ( self , object_type : ObjectType ) -> None :
+
if object_type is None or not isinstance ( object_type , ObjectType ):
+
raise ValueError ( f ' { self . __class__ . __name__ } .object_type must be ObjectType' )
+
self . __object_type = object_type
+
+
def to_json ( self ):
+
data = super () . to_json ()
+
+
data [ 'functional' ] = self . functional
+
# data['error'] = self.error # .to_json() if self.error is not None else None
+
data [ 'team_name' ] = self . team_name
+
data [ 'actions' ] = [ act . value for act in self . actions ]
+
data [ 'avatar' ] = self . avatar . to_json () if self . avatar is not None else None
+
+
return data
+
+
def from_json ( self , data ):
+
super () . from_json ( data )
+
+
self . functional = data [ 'functional' ]
+
# self.error = data['error'] # .from_json(data['action']) if data['action'] is not None else None
+
self . team_name = data [ 'team_name' ]
+
+
self . actions : list [ ActionType ] = [ ObjectType ( action ) for action in data [ 'actions' ]]
+
avatar : Avatar | None = data [ 'avatar' ]
+
if avatar is None :
+
self . avatar = None
+
return self
+
# match case for action
+
# match action['object_type']:
+
# case ObjectType.ACTION:
+
# self.action = Action().from_json(data['action'])
+
# case None:
+
# self.action = None
+
# case _: # checks if it is anything else
+
# raise Exception(f'Could not parse action: {self.action}')
+
+
# match case for avatar
+
match ObjectType ( avatar [ 'object_type' ]):
+
case ObjectType . AVATAR :
+
self . avatar = Avatar () . from_json ( data [ 'avatar' ])
+
case None :
+
self . avatar = None
+
case _ :
+
raise Exception ( f 'Could not parse avatar: { self . avatar } ' )
+
return self
+
# self.action = Action().from_json(data['action']) if data['action'] is not None else None
+
# self.avatar = Avatar().from_json(data['avatar']) if data['avatar'] is not None else None
+
+
# to String
+
def __str__ ( self ):
+
p = f """ID: { self . id }
+
Team name: { self . team_name }
+
Actions:
+
"""
+
# This concatenates every action from the list of actions to the string
+
[ p := p + action for action in self . actions ]
+
return p
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/common/stations/occupiable_station.html b/docs/_modules/game/common/stations/occupiable_station.html
new file mode 100644
index 0000000..04f2f93
--- /dev/null
+++ b/docs/_modules/game/common/stations/occupiable_station.html
@@ -0,0 +1,296 @@
+
+
+
+
+
+
+
+ game.common.stations.occupiable_station - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.common.stations.occupiable_station
+from game.common.avatar import Avatar
+from game.common.map.occupiable import Occupiable
+from game.common.enums import ObjectType
+from game.common.items.item import Item
+from game.common.stations.station import Station
+from game.common.game_object import GameObject
+from typing import Self
+
+
+# create station object that contains occupied_by
+[docs] class OccupiableStation ( Occupiable , Station ):
+
"""
+
`OccupiableStation Class Notes:`
+
+
Occupiable Station objects inherit from both the Occupiable and Station classes. This allows for other objects to
+
be "on top" of the Occupiable Station. For example, an Avatar object can be on top of this object. Since Stations
+
can contain items, items can be stored in this object too.
+
+
Any GameObject or Item can be in an Occupiable Station.
+
+
Occupiable Station Example is a small file that shows an example of how this class can be
+
used. The example class can be deleted or expanded upon if necessary.
+
"""
+
def __init__ ( self , held_item : Item | None = None , occupied_by : GameObject | None = None ):
+
super () . __init__ ( occupied_by = occupied_by , held_item = held_item )
+
self . object_type : ObjectType = ObjectType . OCCUPIABLE_STATION
+
self . held_item = held_item
+
self . occupied_by = occupied_by
+
+
def from_json ( self , data : dict ) -> Self :
+
super () . from_json ( data )
+
occupied_by = data [ 'occupied_by' ]
+
if occupied_by is None :
+
self . occupied_by = None
+
return self
+
# Add all possible game objects that can occupy a tile here (requires python 3.10)
+
match ObjectType ( occupied_by [ 'object_type' ]):
+
case ObjectType . AVATAR :
+
self . occupied_by : Avatar = Avatar () . from_json ( occupied_by )
+
case ObjectType . OCCUPIABLE_STATION :
+
self . occupied_by : OccupiableStation = OccupiableStation () . from_json ( occupied_by )
+
case ObjectType . STATION :
+
self . occupied_by : Station = Station () . from_json ( occupied_by )
+
case _ :
+
raise Exception ( f 'Could not parse occupied_by: { occupied_by } ' )
+
return self
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/common/stations/occupiable_station_example.html b/docs/_modules/game/common/stations/occupiable_station_example.html
new file mode 100644
index 0000000..26a00a3
--- /dev/null
+++ b/docs/_modules/game/common/stations/occupiable_station_example.html
@@ -0,0 +1,270 @@
+
+
+
+
+
+
+
+ game.common.stations.occupiable_station_example - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.common.stations.occupiable_station_example
+from game.common.avatar import Avatar
+from game.common.enums import ObjectType
+from game.common.items.item import Item
+from game.common.stations.occupiable_station import OccupiableStation
+
+
+# create example of occupiable_station that gives item
+[docs] class OccupiableStationExample ( OccupiableStation ):
+
def __init__ ( self , held_item : Item | None = None ):
+
super () . __init__ ( held_item = held_item )
+
self . object_type = ObjectType . STATION_EXAMPLE
+
+
[docs] def take_action ( self , avatar : Avatar ) -> Item | None :
+
"""
+
In this example of what an occupiable station could do, the avatar picks up the item from this station to
+
show the station's purpose.
+
:param avatar:
+
:return:
+
"""
+
avatar . pick_up ( self . held_item )
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/common/stations/station.html b/docs/_modules/game/common/stations/station.html
new file mode 100644
index 0000000..48bcc1f
--- /dev/null
+++ b/docs/_modules/game/common/stations/station.html
@@ -0,0 +1,314 @@
+
+
+
+
+
+
+
+ game.common.stations.station - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.common.stations.station
+from game.common.avatar import Avatar
+from game.common.game_object import GameObject
+from game.common.enums import ObjectType
+from game.common.items.item import Item
+from typing import Self
+
+
+# create Station object from GameObject that allows item to be contained in it
+[docs] class Station ( GameObject ):
+
"""
+
`Station Class Notes:`
+
+
Station objects inherit from GameObject and can contain Item objects in them.
+
+
Players can interact with Stations in different ways by using the ``take_action()`` method. Whatever is specified
+
in this method will control how players interact with the station. The Avatar and Item classes have methods that
+
go through this process. Refer to them for more details.
+
+
The Occupiable Station Example class demonstrates an avatar object receiving the station's stored item. The
+
Station Receiver Example class demonstrates an avatar depositing its held item into a station. These are simple
+
ideas for how stations can be used. These can be heavily added onto for more creative uses!
+
"""
+
+
def __init__ ( self , held_item : Item | None = None , ** kwargs ):
+
super () . __init__ ()
+
self . object_type : ObjectType = ObjectType . STATION
+
self . held_item : Item | None = held_item
+
+
# held_item getter and setter methods
+
@property
+
def held_item ( self ) -> Item | None :
+
return self . __item
+
+
@held_item . setter
+
def held_item ( self , held_item : Item ) -> None :
+
if held_item is not None and not isinstance ( held_item , Item ):
+
raise ValueError ( f ' { self . __class__ . __name__ } .held_item must be an Item or None, not { held_item } .' )
+
self . __item = held_item
+
+
# base of take action method, defined in classes that extend Station (StationExample demonstrates this)
+
def take_action ( self , avatar : Avatar ) -> Item | None :
+
pass
+
+
# json methods
+
def to_json ( self ) -> dict :
+
data : dict = super () . to_json ()
+
data [ 'held_item' ] = self . held_item . to_json () if self . held_item is not None else None
+
+
return data
+
+
def from_json ( self , data : dict ) -> Self :
+
super () . from_json ( data )
+
held_item : dict = data [ 'held_item' ]
+
if held_item is None :
+
self . held_item = None
+
return self
+
+
# framework match case for from json, can add more object types that can be item
+
match ObjectType ( held_item [ 'object_type' ]):
+
case ObjectType . ITEM :
+
self . held_item = Item () . from_json ( held_item )
+
case _ :
+
raise Exception ( f 'Could not parse held_item: { held_item } ' )
+
return self
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/common/stations/station_example.html b/docs/_modules/game/common/stations/station_example.html
new file mode 100644
index 0000000..852800d
--- /dev/null
+++ b/docs/_modules/game/common/stations/station_example.html
@@ -0,0 +1,270 @@
+
+
+
+
+
+
+
+ game.common.stations.station_example - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.common.stations.station_example
+from game.common.avatar import Avatar
+from game.common.enums import ObjectType
+from game.common.items.item import Item
+from game.common.stations.station import Station
+
+
+# create example of station that gives item to avatar
+[docs] class StationExample ( Station ):
+
def __init__ ( self , held_item : Item | None = None ):
+
super () . __init__ ( held_item = held_item )
+
self . object_type = ObjectType . STATION_EXAMPLE
+
+
[docs] def take_action ( self , avatar : Avatar ) -> Item | None :
+
"""
+
In this example of what a station could do, the avatar picks up the item from this station to show the
+
station's purpose.
+
:param avatar:
+
:return:
+
"""
+
avatar . pick_up ( self . held_item )
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/common/stations/station_receiver_example.html b/docs/_modules/game/common/stations/station_receiver_example.html
new file mode 100644
index 0000000..5642edd
--- /dev/null
+++ b/docs/_modules/game/common/stations/station_receiver_example.html
@@ -0,0 +1,270 @@
+
+
+
+
+
+
+
+ game.common.stations.station_receiver_example - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.common.stations.station_receiver_example
+from game.common.avatar import Avatar
+from game.common.enums import ObjectType
+from game.common.items.item import Item
+from game.common.stations.station import Station
+
+
+# create example of station that takes held_item from avatar at inventory slot 0
+[docs] class StationReceiverExample ( Station ):
+
def __init__ ( self , held_item : Item | None = None ):
+
super () . __init__ ( held_item = held_item )
+
self . object_type = ObjectType . STATION_RECEIVER_EXAMPLE
+
+
[docs] def take_action ( self , avatar : Avatar ) -> None :
+
"""
+
In this example of what a type of station could do, the station takes the avatars held item and takes it for
+
its own.
+
:param avatar:
+
:return:
+
"""
+
self . held_item = avatar . drop_held_item ()
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/config.html b/docs/_modules/game/config.html
new file mode 100644
index 0000000..6b4e4c7
--- /dev/null
+++ b/docs/_modules/game/config.html
@@ -0,0 +1,306 @@
+
+
+
+
+
+
+
+ game.config - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.config
+import os
+
+from game.common.enums import *
+
+"""
+This file is important for configuring settings for the project. All parameters in this file have comments to explain
+what they do already. Refer to this file to clear any confusion, and make any changes as necessary.
+"""
+
+# Runtime settings / Restrictions --------------------------------------------------------------------------------------
+# The engine requires these to operate
+MAX_TICKS = 500 # max number of ticks the server will run regardless of game state
+TQDM_BAR_FORMAT = "Game running at {rate_fmt} " # how TQDM displays the bar
+TQDM_UNITS = " turns" # units TQDM takes in the bar
+
+MAX_SECONDS_PER_TURN = 0.1 # max number of basic operations clients have for their turns
+
+MAX_NUMBER_OF_ACTIONS_PER_TURN = 2 # max number of actions per turn is currently set to 2
+
+MIN_CLIENTS_START = None # minimum number of clients required to start running the game; should be None when SET_NUMBER_OF_CLIENTS is used
+MAX_CLIENTS_START = None # maximum number of clients required to start running the game; should be None when SET_NUMBER_OF_CLIENTS is used
+SET_NUMBER_OF_CLIENTS_START = 2 # required number of clients to start running the game; should be None when MIN_CLIENTS or MAX_CLIENTS are used
+CLIENT_KEYWORD = "client" # string required to be in the name of every client file, not found otherwise
+CLIENT_DIRECTORY = "./" # location where client code will be found
+
+MIN_CLIENTS_CONTINUE = None # minimum number of clients required to continue running the game; should be None when SET_NUMBER_OF_CLIENTS is used
+MAX_CLIENTS_CONTINUE = None # maximum number of clients required to continue running the game; should be None when SET_NUMBER_OF_CLIENTS is used
+SET_NUMBER_OF_CLIENTS_CONTINUE = 2 # required number of clients to continue running the game; should be None when MIN_CLIENTS or MAX_CLIENTS are used
+
+ALLOWED_MODULES = [ "game.client.user_client" , # modules that clients are specifically allowed to access
+ "game.common.enums" ,
+ "numpy" ,
+ "scipy" ,
+ "pandas" ,
+ "itertools" ,
+ "functools" ,
+ ]
+
+RESULTS_FILE_NAME = "results.json" # Name and extension of results file
+RESULTS_DIR = os . path . join ( os . getcwd (), "logs" ) # Location of the results file
+RESULTS_FILE = os . path . join ( RESULTS_DIR , RESULTS_FILE_NAME ) # Results directory combined with file name
+
+LOGS_FILE_NAME = 'turn_logs.json'
+LOGS_DIR = os . path . join ( os . getcwd (), "logs" ) # Directory for game log files
+LOGS_FILE = os . path . join ( LOGS_DIR , LOGS_FILE_NAME )
+
+GAME_MAP_FILE_NAME = "game_map.json" # Name and extension of game file that holds generated world
+GAME_MAP_DIR = os . path . join ( os . getcwd (), "logs" ) # Location of game map file
+GAME_MAP_FILE = os . path . join ( GAME_MAP_DIR , GAME_MAP_FILE_NAME ) # Filepath for game map file
+
+
+[docs] class Debug : # Keeps track of the current debug level of the game
+
level = DebugLevel . NONE
+
+# Other Settings Here --------------------------------------------------------------------------------------------------
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/controllers/controller.html b/docs/_modules/game/controllers/controller.html
new file mode 100644
index 0000000..842b999
--- /dev/null
+++ b/docs/_modules/game/controllers/controller.html
@@ -0,0 +1,282 @@
+
+
+
+
+
+
+
+ game.controllers.controller - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.controllers.controller
+from game.common.enums import DebugLevel , ActionType
+from game.config import Debug
+from game.common.player import Player
+from game.common.map.game_board import GameBoard
+import logging
+
+
+[docs] class Controller :
+
"""
+
`Controller Class Notes:`
+
+
This is a super class for every controller type that is necessary for inheritance. Think of it as the GameObject
+
class for Controllers.
+
+
The handle_actions method is important and will specify what each controller does when interacting with the
+
Player object's avatar.
+
+
Refer to the other controller files for a more detailed description on how they work.
+
If more controllers are ever needed, add them to facilitate the flow of the game.
+
"""
+
def __init__ ( self ):
+
self . debug_level = DebugLevel . CONTROLLER
+
self . debug = False
+
+
def handle_actions ( self , action : ActionType , client : Player , world : GameBoard ):
+
return
+
+
def debug ( self , * args ):
+
if self . debug and Debug . level >= self . debug_level :
+
logging . basicConfig ( level = logging . DEBUGs )
+
for arg in args :
+
logging . debug ( f ' { self . __class__ . __name__ } : { arg } ' )
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/controllers/interact_controller.html b/docs/_modules/game/controllers/interact_controller.html
new file mode 100644
index 0000000..c5566b2
--- /dev/null
+++ b/docs/_modules/game/controllers/interact_controller.html
@@ -0,0 +1,316 @@
+
+
+
+
+
+
+
+ game.controllers.interact_controller - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.controllers.interact_controller
+from game.common.enums import *
+from game.controllers.controller import Controller
+from game.common.player import Player
+from game.common.stations.station import Station
+from game.common.items.item import Item
+from game.common.map.game_board import GameBoard
+from game.utils.vector import Vector
+
+
+[docs] class InteractController ( Controller ):
+
"""
+
`Interact Controller Notes:`
+
+
The Interact Controller manages the actions the player tries to execute. As the game is played, a player can
+
interact with surrounding, adjacent stations and the space they're currently standing on.
+
+
Example:
+
::
+
x x x x x x
+
x x
+
x O x
+
x O A O x
+
x O x
+
x x x x x x
+
+
The given visual shows what players can interact with. "A" represents the avatar; "O" represents the spaces
+
that can be interacted with (including where the "A" is); and "x" represents the walls and map border.
+
+
These interactions are managed by using the provided ActionType enums in the enums.py file.
+
"""
+
+
def __init__ ( self ):
+
super () . __init__ ()
+
+
[docs] def handle_actions ( self , action : ActionType , client : Player , world : GameBoard ) -> None :
+
"""
+
Given the ActionType for interacting in a direction, the Player's avatar will engage with the object.
+
:param action:
+
:param client:
+
:param world:
+
:return: None
+
"""
+
+
# match interaction type with x and y
+
vector : Vector
+
match action :
+
case ActionType . INTERACT_UP :
+
vector = Vector ( x = 0 , y =- 1 )
+
case ActionType . INTERACT_DOWN :
+
vector = Vector ( x = 0 , y = 1 )
+
case ActionType . INTERACT_LEFT :
+
vector = Vector ( x =- 1 , y = 0 )
+
case ActionType . INTERACT_RIGHT :
+
vector = Vector ( x = 1 , y = 0 )
+
case ActionType . INTERACT_CENTER :
+
vector = Vector ( 0 , 0 )
+
case _ :
+
return
+
+
# find result in interaction
+
vector . x += client . avatar . position . x
+
vector . y += client . avatar . position . y
+
stat : Station = world . game_map [ vector . y ][ vector . x ] . occupied_by
+
+
if stat is not None and isinstance ( stat , Station ):
+
stat . take_action ( client . avatar )
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/controllers/inventory_controller.html b/docs/_modules/game/controllers/inventory_controller.html
new file mode 100644
index 0000000..f611673
--- /dev/null
+++ b/docs/_modules/game/controllers/inventory_controller.html
@@ -0,0 +1,287 @@
+
+
+
+
+
+
+
+ game.controllers.inventory_controller - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.controllers.inventory_controller
+from game.common.enums import *
+from game.common.avatar import Avatar
+from game.common.player import Player
+from game.controllers.controller import Controller
+from game.common.map.game_board import GameBoard
+
+
+[docs] class InventoryController ( Controller ):
+
"""
+
`Interact Controller Notes:`
+
+
The Inventory Controller is how player's can manage and interact with their inventory. When given the enum to
+
select an item from a slot in the inventory, that will then become the held item.
+
+
If an enum is passed in that is not within the range of the inventory size, an error will be thrown.
+
"""
+
+
def __init__ ( self ):
+
super () . __init__ ()
+
+
def handle_actions ( self , action : ActionType , client : Player , world : GameBoard ) -> None :
+
# If a larger inventory is created, create more enums and add them here as needed
+
avatar : Avatar = client . avatar
+
+
# If there are more than 10 slots in the inventory, change "ActionType.SELECT_SLOT_9"
+
# This checks if the given action isn't one of the select slot enums
+
if action . value < ActionType . SELECT_SLOT_0 . value or action . value > ActionType . SELECT_SLOT_9 . value :
+
return
+
+
index : int = action . value - ActionType . SELECT_SLOT_0 . value
+
+
try :
+
avatar . held_item = avatar . inventory [ index ]
+
except IndexError :
+
raise IndexError ( f 'The given action type, { action . name } , is not within bounds of the given inventory of '
+
f 'size { len ( avatar . inventory ) } . Select an ActionType enum that will be within the '
+
f 'inventory \' s bounds.' )
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/controllers/master_controller.html b/docs/_modules/game/controllers/master_controller.html
new file mode 100644
index 0000000..3fc5f60
--- /dev/null
+++ b/docs/_modules/game/controllers/master_controller.html
@@ -0,0 +1,394 @@
+
+
+
+
+
+
+
+ game.controllers.master_controller - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.controllers.master_controller
+from copy import deepcopy
+import random
+
+from game.common.action import Action
+from game.common.avatar import Avatar
+from game.common.enums import *
+from game.common.player import Player
+import game.config as config # this is for turns
+from game.utils.thread import CommunicationThread
+from game.controllers.movement_controller import MovementController
+from game.controllers.controller import Controller
+from game.controllers.interact_controller import InteractController
+from game.common.map.game_board import GameBoard
+from game.config import MAX_NUMBER_OF_ACTIONS_PER_TURN
+from game.utils.vector import Vector
+
+
+[docs] class MasterController ( Controller ):
+
"""
+
`Master Controller Notes:`
+
+
Give Client Objects:
+
Takes a list of Player objects and places each one in the game world.
+
+
Game Loop Logic:
+
Increments the turn count as the game plays (look at the engine to see how it's controlled more).
+
+
Interpret Current Turn Data:
+
This accesses the gameboard in the first turn of the game and generates the game's seed.
+
+
Client Turn Arguments:
+
There are lines of code commented out that create Action Objects instead of using the enum. If your project
+
needs Actions Objects instead of the enums, comment out the enums and use Objects as necessary.
+
+
Turn Logic:
+
This method executes every movement and interact behavior from every client in the game. This is done by
+
using every other type of Controller object that was created in the project that needs to be managed
+
here (InteractController, MovementController, other game-specific controllers, etc.).
+
+
Create Turn Log:
+
This method creates a dictionary that stores the turn, all client objects, and the gameboard's JSON file to
+
be used as the turn log.
+
+
Return Final Results:
+
This method creates a dictionary that stores a list of the clients' JSON files. This represents the final
+
results of the game.
+
"""
+
def __init__ ( self ):
+
super () . __init__ ()
+
self . game_over : bool = False
+
# self.event_timer = GameStats.event_timer # anything related to events are commented it out until made
+
# self.event_times: tuple[int, int] | None = None
+
self . turn : int = 1
+
self . current_world_data : dict = None
+
self . movement_controller : MovementController = MovementController ()
+
self . interact_controller : InteractController = InteractController ()
+
+
# Receives all clients for the purpose of giving them the objects they will control
+
def give_clients_objects ( self , clients : list [ Player ], world : dict ):
+
# starting_positions = [[3, 3], [3, 9]] # would be done in generate game
+
gb : GameBoard = world [ 'game_board' ]
+
avatars : list [ tuple [ Vector , list [ Avatar ]]] = gb . get_objects ( ObjectType . AVATAR )
+
for avatar , client in zip ( avatars , clients ):
+
avatar [ 1 ][ 0 ] . position = avatar [ 0 ]
+
client . avatar = avatar [ 1 ][ 0 ]
+
+
+
# Generator function. Given a key:value pair where the key is the identifier for the current world and the value is
+
# the state of the world, returns the key that will give the appropriate world information
+
def game_loop_logic ( self , start = 1 ):
+
self . turn = start
+
+
# Basic loop from 1 to max turns
+
while True :
+
# Wait until the next call to give the number
+
yield str ( self . turn )
+
# Increment the turn counter by 1
+
self . turn += 1
+
+
# Receives world data from the generated game log and is responsible for interpreting it
+
def interpret_current_turn_data ( self , clients : list [ Player ], world : dict , turn ):
+
self . current_world_data = world
+
+
if turn == 1 :
+
random . seed ( world [ 'game_board' ] . seed )
+
# self.event_times = random.randrange(162, 172), random.randrange(329, 339)
+
+
# Receive a specific client and send them what they get per turn. Also obfuscates necessary objects.
+
def client_turn_arguments ( self , client : Player , turn ):
+
# turn_action: Action = Action()
+
# client.action: Action = turn_action
+
# ^if you want to use action as an object instead of an enum
+
+
turn_actions : list [ ActionType ] = []
+
client . actions = turn_actions
+
+
# Create deep copies of all objects sent to the player
+
current_world = deepcopy ( self . current_world_data [ "game_board" ]) # what is current world and copy avatar
+
copy_avatar = deepcopy ( client . avatar )
+
# Obfuscate data in objects that that player should not be able to see
+
# Currently world data isn't obfuscated at all
+
args = ( self . turn , turn_actions , current_world , copy_avatar )
+
return args
+
+
# Perform the main logic that happens per turn
+
def turn_logic ( self , clients : list [ Player ], turn ):
+
for client in clients :
+
for i in range ( MAX_NUMBER_OF_ACTIONS_PER_TURN ):
+
try :
+
self . movement_controller . handle_actions ( client . actions [ i ], client , self . current_world_data [ "game_board" ])
+
self . interact_controller . handle_actions ( client . actions [ i ], client , self . current_world_data [ "game_board" ])
+
except IndexError :
+
pass
+
+
# checks event logic at the end of round
+
# self.handle_events(clients)
+
+
# comment out for now, nothing is in place for event types yet
+
# def handle_events(self, clients):
+
# If it is time to run an event, master controller picks an event to run
+
# if self.turn == self.event_times[0] or self.turn == self.event_times[1]:
+
# self.current_world_data["game_map"].generate_event(EventType.example, EventType.example)
+
# event type.example is just a placeholder for now
+
+
# Return serialized version of game
+
def create_turn_log ( self , clients : list [ Player ], turn : int ):
+
data = dict ()
+
data [ 'tick' ] = turn
+
data [ 'clients' ] = [ client . to_json () for client in clients ]
+
# Add things that should be thrown into the turn logs here
+
data [ 'game_board' ] = self . current_world_data [ "game_board" ] . to_json ()
+
+
return data
+
+
# Gather necessary data together in results file
+
def return_final_results ( self , clients : list [ Player ], turn ):
+
data = dict ()
+
+
data [ 'players' ] = list ()
+
# Determine results
+
for client in clients :
+
data [ 'players' ] . append ( client . to_json ())
+
+
return data
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/controllers/movement_controller.html b/docs/_modules/game/controllers/movement_controller.html
new file mode 100644
index 0000000..ccbd3fd
--- /dev/null
+++ b/docs/_modules/game/controllers/movement_controller.html
@@ -0,0 +1,307 @@
+
+
+
+
+
+
+
+ game.controllers.movement_controller - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.controllers.movement_controller
+from game.common.player import Player
+from game.common.map.game_board import GameBoard
+from game.common.map.tile import Tile
+from game.common.enums import *
+from game.utils.vector import Vector
+from game.controllers.controller import Controller
+
+
+[docs] class MovementController ( Controller ):
+
"""
+
`Movement Controller Notes:`
+
+
The Movement Controller manages the movement actions the player tries to execute. Players can move up, down,
+
left, and right. If the player tries to move into a space that's impassable, they don't move.
+
+
For example, if the player attempts to move into an Occupiable Station (something the player can be on) that is
+
occupied by a Wall object (something the player can't be on), the player doesn't move; that is, if the player
+
tries to move into anything that can't be occupied by something, they won't move.
+
"""
+
+
def __init__ ( self ):
+
super () . __init__ ()
+
+
def handle_actions ( self , action : ActionType , client : Player , world : GameBoard ):
+
avatar_pos : Vector = Vector ( client . avatar . position . x , client . avatar . position . y )
+
+
pos_mod : Vector
+
match action :
+
case ActionType . MOVE_UP :
+
pos_mod = Vector ( x = 0 , y =- 1 )
+
case ActionType . MOVE_DOWN :
+
pos_mod = Vector ( x = 0 , y = 1 )
+
case ActionType . MOVE_LEFT :
+
pos_mod = Vector ( x =- 1 , y = 0 )
+
case ActionType . MOVE_RIGHT :
+
pos_mod = Vector ( x = 1 , y = 0 )
+
case _ : # default case
+
return
+
+
temp_vec : Vector = Vector . add_vectors ( avatar_pos , pos_mod )
+
# if tile is occupied return
+
temp : Tile = world . game_map [ temp_vec . y ][ temp_vec . x ]
+
while hasattr ( temp . occupied_by , 'occupied_by' ):
+
temp : Tile = temp . occupied_by
+
+
if temp . occupied_by is not None :
+
return
+
+
temp . occupied_by = client . avatar
+
+
# while the object that occupies tile has the occupied by attribute, escalate check for avatar
+
temp : Tile = world . game_map [ avatar_pos . y ][ avatar_pos . x ]
+
while hasattr ( temp . occupied_by , 'occupied_by' ):
+
temp = temp . occupied_by
+
+
temp . occupied_by = None
+
client . avatar . position = Vector ( temp_vec . x , temp_vec . y )
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/engine.html b/docs/_modules/game/engine.html
new file mode 100644
index 0000000..50724b9
--- /dev/null
+++ b/docs/_modules/game/engine.html
@@ -0,0 +1,562 @@
+
+
+
+
+
+
+
+ game.engine - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.engine
+import importlib
+import json
+import logging
+import sys
+import threading
+import traceback
+from datetime import datetime
+
+from tqdm import tqdm
+
+from game.common.map.game_board import GameBoard
+from game.common.player import Player
+from game.config import *
+from game.controllers.master_controller import MasterController
+from game.utils.helpers import write_json_file
+from game.utils.thread import Thread , CommunicationThread
+from game.utils.validation import verify_code , verify_num_clients
+from game.client.user_client import UserClient
+
+
+[docs] class Engine :
+
def __init__ ( self , quiet_mode = False , use_filenames_as_team_names = False ):
+
self . clients = list ()
+
self . master_controller = MasterController ()
+
self . tick_number = 0
+
+
self . game_logs = dict ()
+
self . world = None
+
self . current_world_key = None
+
+
self . quiet_mode = quiet_mode
+
self . use_filenames = use_filenames_as_team_names
+
+
# Starting point of the engine. Runs other methods then sits on top of a basic game loop until over
+
[docs] def loop ( self ):
+
try :
+
# If quiet mode is activated, replace stdout with devnull
+
f = sys . stdout
+
if self . quiet_mode :
+
f = open ( os . devnull , 'w' )
+
sys . stdout = f
+
self . load ()
+
self . boot ()
+
for self . current_world_key in tqdm (
+
self . master_controller . game_loop_logic (),
+
bar_format = TQDM_BAR_FORMAT ,
+
unit = TQDM_UNITS ,
+
file = f ):
+
self . pre_tick ()
+
self . tick ()
+
self . post_tick ()
+
if self . tick_number >= MAX_TICKS :
+
break
+
except Exception as e :
+
print ( f "Exception raised during runtime: { str ( e ) } " )
+
print ( f " { traceback . print_exc () } " )
+
finally :
+
self . shutdown ()
+
+
# Finds, checks, and instantiates clients
+
[docs] def boot ( self ):
+
# Insert path of where clients are expected to be inside where python will look
+
current_dir = os . getcwd ()
+
sys . path . insert ( 0 , current_dir )
+
sys . path . insert ( 0 , f ' { current_dir } / { CLIENT_DIRECTORY } ' )
+
+
# Find and load clients in
+
for filename in os . listdir ( CLIENT_DIRECTORY ):
+
try :
+
filename = filename . replace ( '.py' , '' )
+
+
# Filter out files that do not contain CLIENT_KEYWORD in their filename (located in config)
+
if CLIENT_KEYWORD . upper () not in filename . upper ():
+
continue
+
+
# Filter out folders
+
if os . path . isdir ( os . path . join ( CLIENT_DIRECTORY , filename )):
+
continue
+
+
# Otherwise, instantiate the player
+
player = Player ()
+
self . clients . append ( player )
+
+
# Verify client isn't using invalid imports or opening anything
+
imports , opening , printing = verify_code ( filename + '.py' )
+
if len ( imports ) != 0 :
+
player . functional = False
+
player . error = f 'Player has attempted illegal imports: { imports } '
+
+
if opening :
+
player . functional = False
+
player . error = PermissionError (
+
f 'Player is using "open" which is forbidden.' )
+
+
# Attempt creation of the client object
+
obj : UserClient | None = None
+
try :
+
# Import client's code
+
im = importlib . import_module ( f ' { filename } ' , CLIENT_DIRECTORY )
+
obj = im . Client ()
+
except Exception :
+
player . functional = False
+
player . error = str ( traceback . format_exc ())
+
continue
+
+
player . code = obj
+
thr = None
+
try :
+
# Retrieve team name
+
thr = CommunicationThread ( player . code . team_name , list (), str )
+
thr . start ()
+
thr . join ( 0.01 ) # Shouldn't take long to get a string
+
+
if thr . is_alive ():
+
player . functional = False
+
player . error = TimeoutError (
+
'Client failed to provide a team name in time.' )
+
+
if thr . error is not None :
+
player . functional = False
+
player . error = thr . error
+
finally :
+
# Note: I keep the above thread for both naming conventions to check for client errors
+
try :
+
if self . use_filenames :
+
player . team_name = filename
+
thr . retrieve_value ()
+
else :
+
player . team_name = thr . retrieve_value ()
+
except Exception as e :
+
player . functional = False
+
player . error = f " { str ( e ) } \n { traceback . print_exc () } "
+
except Exception as e :
+
print ( f "Bad client for { filename } : exception: { e } " )
+
print ( f " { traceback . print_exc () } " )
+
player . functional = False
+
+
# Verify correct number of clients have connected to start
+
func_clients = [ client for client in self . clients if client . functional ]
+
client_num_correct = verify_num_clients ( func_clients ,
+
SET_NUMBER_OF_CLIENTS_START ,
+
MIN_CLIENTS_START ,
+
MAX_CLIENTS_START )
+
+
if client_num_correct is not None :
+
self . shutdown ( source = 'Client_error' )
+
else :
+
# Sort clients based on name, for the client runner
+
self . clients . sort ( key = lambda clnt : clnt . team_name , reverse = True )
+
# Finally, request master controller to establish clients with basic objects
+
if SET_NUMBER_OF_CLIENTS_START == 1 :
+
self . master_controller . give_clients_objects ( self . clients [ 0 ], self . world )
+
else :
+
self . master_controller . give_clients_objects ( self . clients , self . world )
+
+
# Loads in the world
+
[docs] def load ( self ):
+
# Verify the log directory exists
+
if not os . path . exists ( LOGS_DIR ):
+
raise FileNotFoundError ( 'Log directory not found.' )
+
+
# Verify the game map exists
+
if not os . path . exists ( GAME_MAP_FILE ):
+
raise FileNotFoundError ( 'Game map not found.' )
+
+
# Delete previous logs
+
if os . path . exists ( LOGS_FILE ):
+
os . remove ( LOGS_FILE )
+
+
world = None
+
with open ( GAME_MAP_FILE ) as json_file :
+
world = json . load ( json_file )
+
world [ 'game_board' ] = GameBoard () . from_json ( world [ 'game_board' ])
+
self . world = world
+
+
# Sits on top of all actions that need to happen before the player takes their turn
+
[docs] def pre_tick ( self ):
+
# Increment the tick
+
self . tick_number += 1
+
+
# Send current world information to master controller for purposes
+
if SET_NUMBER_OF_CLIENTS_START == 1 :
+
self . master_controller . interpret_current_turn_data ( self . clients [ 0 ], self . world , self . tick_number )
+
else :
+
self . master_controller . interpret_current_turn_data ( self . clients , self . world , self . tick_number )
+
+
# Does actions like lets the player take their turn and asks master controller to perform game logic
+
[docs] def tick ( self ):
+
# Create list of threads to run client's code
+
threads = list ()
+
for client in self . clients :
+
# Skip non-functional clients
+
if not client . functional :
+
continue
+
+
# Retrieve list of arguments to pass
+
arguments = self . master_controller . client_turn_arguments ( client , self . tick_number )
+
+
# Create the thread, pass the arguments
+
thr = Thread ( func = client . code . take_turn , args = arguments )
+
threads . append ( thr )
+
+
# Start all threads
+
[ thr . start () for thr in threads ]
+
+
# Time and wait for clients to be done
+
start_time = datetime . now ()
+
for thr in threads :
+
# We only want to wait a maximum of MAX_SECONDS_PER_TURN once all of the clients have started.
+
# However, we can't simultaneously join threads without more threads or multiprocessing.
+
# Solution: join one thread at a time, keep track of total running time between each join, and reduce the
+
# join time so it is always less than MAX_SECONDS_PER_TURN.
+
# Get time elapsed in microseconds
+
time_elapsed = datetime . now () . microsecond - start_time . microsecond
+
# Convert to seconds
+
time_elapsed /= 1000000
+
# Subtract value from MAX_SECONDS_PER_TURN to get time remaining
+
time_remaining = MAX_SECONDS_PER_TURN - time_elapsed
+
# Ensure value never goes negative
+
time_remaining = max ( 0.0 , time_remaining )
+
+
thr . join ( time_remaining )
+
+
# Go through each thread and check if they are still alive
+
for client , thr in zip ( self . clients , threads ):
+
# If thread is no longer alive, mark it as non-functional, preventing it from receiving future turns
+
if thr . is_alive ():
+
client . functional = False
+
client . error = TimeoutError ( f ' { client . id } failed to reply in time and has been dropped.' )
+
print ( client . error )
+
+
# Also check to see if the client had created an error and save it
+
if thr . error is not None :
+
client . functional = False
+
client . error = thr . error
+
print ( thr . error )
+
+
# Verify there are enough clients to continue the game
+
func_clients = [ client for client in self . clients if client . functional ]
+
client_num_correct = verify_num_clients ( func_clients ,
+
SET_NUMBER_OF_CLIENTS_CONTINUE ,
+
MIN_CLIENTS_CONTINUE ,
+
MAX_CLIENTS_CONTINUE )
+
if client_num_correct is not None :
+
self . shutdown ( source = 'Client_error' )
+
+
# Finally, consult master controller for game logic
+
if SET_NUMBER_OF_CLIENTS_START == 1 :
+
self . master_controller . turn_logic ( self . clients [ 0 ], self . tick_number )
+
else :
+
self . master_controller . turn_logic ( self . clients , self . tick_number )
+
+
# Does any actions that need to happen after the game logic, then creates the game log for the turn
+
[docs] def post_tick ( self ):
+
# Add logs to logs list
+
data = None
+
if SET_NUMBER_OF_CLIENTS_START == 1 :
+
data = self . master_controller . create_turn_log ( self . clients [ 0 ], self . tick_number )
+
else :
+
data = self . master_controller . create_turn_log ( self . clients , self . tick_number )
+
+
threading . Thread ( target = write_json_file ,
+
args = ( data , os . path . join ( LOGS_DIR , f 'turn_ { self . tick_number : 04d } .json' ))) . start ()
+
+
# Perform a game over check
+
if self . master_controller . game_over :
+
self . shutdown ()
+
+
# Attempts to safely handle an engine shutdown given any game state
+
[docs] def shutdown ( self , source = None ):
+
# Write log files
+
write_json_file ( self . game_logs , LOGS_FILE )
+
+
# Retrieve and write results information
+
results_information = None
+
if SET_NUMBER_OF_CLIENTS_START == 1 :
+
results_information = self . master_controller . return_final_results ( self . clients [ 0 ], self . tick_number )
+
else :
+
results_information = self . master_controller . return_final_results ( self . clients , self . tick_number )
+
+
if source :
+
results_information [ 'reason' ] = source
+
+
write_json_file ( results_information , RESULTS_FILE )
+
+
# Exit game
+
if source :
+
output = " \n "
+
for client in self . clients :
+
if client . error != None :
+
output += client . error + " \n "
+
print ( f ' \n Game has ended due to { source } : [ { output } ].' )
+
+
# Flush standard out
+
sys . stdout . flush ()
+
+
os . _exit ( 1 )
+
else :
+
print ( f ' \n Game has successfully ended.' )
+
+
# Flush standard out
+
sys . stdout . flush ()
+
+
# os._exit(0)
+
+
# Debug print statement
+
[docs] def debug ( * args ):
+
if Debug . level >= DebugLevel . ENGINE :
+
logging . basicConfig ( level = logging . DEBUG )
+
for arg in args :
+
logging . debug ( f 'Engine: { arg } ' )
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/test_suite/tests/test_avatar.html b/docs/_modules/game/test_suite/tests/test_avatar.html
new file mode 100644
index 0000000..b85d46f
--- /dev/null
+++ b/docs/_modules/game/test_suite/tests/test_avatar.html
@@ -0,0 +1,324 @@
+
+
+
+
+
+
+
+ game.test_suite.tests.test_avatar - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.test_suite.tests.test_avatar
+import unittest
+
+from game.common.avatar import Avatar
+from game.common.items.item import Item
+from game.utils.vector import Vector
+
+
+[docs] class TestAvatar ( unittest . TestCase ):
+
"""
+
`Test Avatar Notes:`
+
+
This class tests the different methods in the Avatar class.
+
"""
+
+
[docs] def setUp ( self ) -> None :
+
self . avatar : Avatar = Avatar ( None , 1 )
+
self . item : Item = Item ( 10 , 100 , 1 , 1 )
+
+
# test set item
+
def test_avatar_set_item ( self ):
+
self . avatar . pick_up ( self . item )
+
self . assertEqual ( self . avatar . held_item , self . item )
+
+
def test_avatar_set_item_fail ( self ):
+
with self . assertRaises ( ValueError ) as e :
+
self . avatar . held_item = 3
+
self . assertEqual ( str ( e . exception ), 'Avatar.held_item must be an Item or None.' )
+
+
# test set score
+
def test_avatar_set_score ( self ):
+
self . avatar . score = 10
+
self . assertEqual ( self . avatar . score , 10 )
+
+
def test_avatar_set_score_fail ( self ):
+
with self . assertRaises ( ValueError ) as e :
+
self . avatar . score = 'wow'
+
self . assertEqual ( str ( e . exception ), 'Avatar.score must be an int.' )
+
+
# test set position
+
def test_avatar_set_position ( self ):
+
self . avatar . position = Vector ( 10 , 10 )
+
self . assertEqual ( str ( self . avatar . position ), str ( Vector ( 10 , 10 )))
+
+
def test_avatar_set_position_None ( self ):
+
self . avatar . position = None
+
self . assertEqual ( self . avatar . position , None )
+
+
def test_avatar_set_position_fail ( self ):
+
with self . assertRaises ( ValueError ) as e :
+
self . avatar . position = 10
+
self . assertEqual ( str ( e . exception ), 'Avatar.position must be a Vector or None.' )
+
+
# test json method
+
def test_avatar_json_with_none_item ( self ):
+
# held item will be None
+
self . avatar . held_item = self . avatar . inventory [ 0 ]
+
self . avatar . position = Vector ( 10 , 10 )
+
data : dict = self . avatar . to_json ()
+
avatar : Avatar = Avatar () . from_json ( data )
+
self . assertEqual ( self . avatar . object_type , avatar . object_type )
+
self . assertEqual ( self . avatar . held_item , avatar . held_item )
+
self . assertEqual ( str ( self . avatar . position ), str ( avatar . position ))
+
+
def test_avatar_json_with_item ( self ):
+
self . avatar . pick_up ( Item ( 1 , 1 ))
+
self . avatar . position = Vector ( 10 , 10 )
+
data : dict = self . avatar . to_json ()
+
avatar : Avatar = Avatar () . from_json ( data )
+
self . assertEqual ( self . avatar . object_type , avatar . object_type )
+
self . assertEqual ( self . avatar . held_item . object_type , avatar . held_item . object_type )
+
self . assertEqual ( self . avatar . held_item . value , avatar . held_item . value )
+
self . assertEqual ( self . avatar . held_item . durability , avatar . held_item . durability )
+
self . assertEqual ( self . avatar . position . object_type , avatar . position . object_type )
+
self . assertEqual ( str ( self . avatar . position ), str ( avatar . position ))
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/test_suite/tests/test_avatar_inventory.html b/docs/_modules/game/test_suite/tests/test_avatar_inventory.html
new file mode 100644
index 0000000..85c1e30
--- /dev/null
+++ b/docs/_modules/game/test_suite/tests/test_avatar_inventory.html
@@ -0,0 +1,387 @@
+
+
+
+
+
+
+
+ game.test_suite.tests.test_avatar_inventory - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.test_suite.tests.test_avatar_inventory
+import unittest
+
+from game.common.avatar import Avatar
+from game.common.items.item import Item
+
+
+[docs] class TestAvatarInventory ( unittest . TestCase ):
+
"""
+
`Test Avatar Inventory Notes:`
+
+
This class tests the different methods in the Avatar class related to the inventory system. This is its own
+
file since the inventory system has a lot of functionality. Look extensively at the different cases that are
+
tested to better understand how it works if there is still confusion.
+
"""
+
+
[docs] def setUp ( self ) -> None :
+
self . avatar : Avatar = Avatar ( None , 1 )
+
self . item : Item = Item ( 10 , 100 , 1 , 1 )
+
+
# test set inventory
+
def test_avatar_set_inventory ( self ):
+
self . avatar . inventory = [ Item ( 1 , 1 )]
+
self . assertEqual ( self . avatar . inventory [ 0 ] . value , Item ( 1 , 1 ) . value )
+
+
# fails if inventory is not a list
+
def test_avatar_set_inventory_fail_1 ( self ):
+
with self . assertRaises ( ValueError ) as e :
+
self . avatar . inventory = 'Fail'
+
self . assertEqual ( str ( e . exception ), 'Avatar.inventory must be a list of Items.' )
+
+
# fails if inventory size is greater than the max_inventory_size
+
def test_avatar_set_inventory_fail_2 ( self ):
+
with self . assertRaises ( ValueError ) as e :
+
self . avatar . inventory = [ Item ( 1 , 1 ), Item ( 4 , 2 )]
+
self . assertEqual ( str ( e . exception ), 'Avatar.inventory size must be less than or equal to max_inventory_size' )
+
+
def test_avatar_set_max_inventory_size ( self ):
+
self . avatar . max_inventory_size = 10
+
self . assertEqual ( str ( self . avatar . max_inventory_size ), str ( 10 ))
+
+
def test_avatar_set_max_inventory_size_fail ( self ):
+
with self . assertRaises ( ValueError ) as e :
+
self . avatar . max_inventory_size = 'Fail'
+
self . assertEqual ( str ( e . exception ), 'Avatar.max_inventory_size must be an int.' )
+
+
# Tests picking up an item
+
def test_avatar_pick_up ( self ):
+
self . avatar . pick_up ( self . item )
+
self . assertEqual ( self . avatar . inventory [ 0 ], self . item )
+
+
# Tests that picking up an item successfully returns None
+
def test_avatar_pick_up_return_none ( self ):
+
returned : Item | None = self . avatar . pick_up ( self . item )
+
self . assertEqual ( returned , None )
+
+
# Tests that picking up an item of one that already exists in the inventory works
+
def test_avatar_pick_up_extra ( self ):
+
item1 : Item = Item ( 10 , None , 1 , 3 )
+
item2 : Item = Item ( 10 , None , 1 , 3 )
+
item3 : Item = Item ( 10 , None , 1 , 3 )
+
self . avatar . pick_up ( item1 )
+
self . avatar . pick_up ( item2 )
+
self . avatar . pick_up ( item3 )
+
self . assertEqual ( self . avatar . held_item . quantity , 3 )
+
+
# Tests that picking up an item that would cause a surplus doesn't cause quantity to go over stack_size
+
def test_avatar_pick_up_surplus ( self ):
+
item1 : Item = Item ( 10 , None , 2 , 3 )
+
item2 : Item = Item ( 10 , None , 1 , 3 )
+
item3 : Item = Item ( 10 , None , 3 , 3 )
+
self . avatar . pick_up ( item1 )
+
self . avatar . pick_up ( item2 )
+
surplus : Item = self . avatar . pick_up ( item3 )
+
self . assertEqual ( self . avatar . held_item . quantity , 3 )
+
self . assertEqual ( surplus , item3 )
+
+
# Tests when an item is being taken away
+
[docs] def test_take ( self ):
+
"""
+
`Take method test:`
+
When this test is performed, it works properly, but because the Item class is used and is very generic, it
+
may not seem to be the case. However, it does work in the end. The first item in the inventory has its
+
quantity decrease to 2 after the take method is executed. Then, the helper method, clean_inventory,
+
consolidates all similar Items with each other. This means that inventory[1] will add its quantity to
+
inventory[0], making it have a quantity of 5; inventory[1] now has a quantity of 4 instead of 7. Then,
+
inventory[2] will add its quantity to inventory[1], making it have a quantity of 7; inventory[2] now has a
+
quantity of 7.
+
+
-----
+
+
To recap:
+
When the take method is used, it will work properly with more specific Item classes being created to
+
consolidate the same Item object types together
+
+
-----
+
+
When more subclasses of Item are created, more specific tests can be created if needed.
+
"""
+
+
self . avatar : Avatar = Avatar ( None , 3 )
+
self . avatar . inventory = [ Item ( quantity = 5 , stack_size = 5 ), Item ( quantity = 7 , stack_size = 7 ),
+
Item ( quantity = 10 , stack_size = 10 )]
+
taken = self . avatar . take ( Item ( quantity = 3 , stack_size = 3 ))
+
+
self . assertEqual ( taken , None )
+
self . assertEqual ( self . avatar . inventory [ 2 ] . quantity , 7 )
+
+
# Tests when the None value is being taken away
+
def test_take_none ( self ):
+
taken = self . avatar . take ( None )
+
self . assertEqual ( taken , None )
+
+
def test_take_fail ( self ):
+
self . avatar : Avatar = Avatar ( None , 3 )
+
self . avatar . inventory = [ Item ( quantity = 5 , stack_size = 5 ), Item ( quantity = 7 , stack_size = 7 ),
+
Item ( quantity = 10 , stack_size = 10 )]
+
with self . assertRaises ( ValueError ) as e :
+
taken = self . avatar . take ( '' )
+
self . assertEqual ( str ( e . exception ), 'str is not of type Item.' )
+
+
# Tests picking up an item and failing
+
def test_avatar_pick_up_full_inventory ( self ):
+
self . avatar . pick_up ( self . item )
+
+
# Pick up again to test
+
returned : Item | None = self . avatar . pick_up ( self . item )
+
self . assertEqual ( returned , self . item )
+
+
# Tests dropping the held item
+
def test_avatar_drop_held_item ( self ):
+
self . avatar . pick_up ( self . item )
+
held_item = self . avatar . drop_held_item ()
+
self . assertEqual ( held_item , self . item )
+
+
def test_avatar_drop_held_item_none ( self ):
+
held_item = self . avatar . drop_held_item ()
+
self . assertEqual ( held_item , None )
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/test_suite/tests/test_example.html b/docs/_modules/game/test_suite/tests/test_example.html
new file mode 100644
index 0000000..dc43d9a
--- /dev/null
+++ b/docs/_modules/game/test_suite/tests/test_example.html
@@ -0,0 +1,304 @@
+
+
+
+
+
+
+
+ game.test_suite.tests.test_example - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.test_suite.tests.test_example
+# This is a quick example test file to show you the basics.
+# Always remember to add the proper details to the __init__.py file in the 'tests' folder
+# to insure your tests are run.
+
+import unittest
+
+
+[docs] class TestExample ( unittest . TestCase ): # Your test class is a subclass of unittest.Testcase, this is important
+
"""
+
`Test Example Notes:`
+
+
This is a mock test class to model tests after.
+
The setUp method MUST be in camel-case for every test file. Everything else can be in snake_case as normal.
+
+
The command to run tests is:
+
``python -m game.test_suite.runner``
+
"""
+
+
[docs] def setUp ( self ): # This method is used to set up anything you wish to test prior to every test method below.
+
self . d = { # Here I'm just setting up a quick dictionary for example.
+
"string" : "Hello World!" ,
+
# Any changes made to anything built in setUp DO NOT carry over to later test methods
+
"array" : [ 1 , 2 , 3 , 4 , 5 ],
+
"integer" : 42 ,
+
"bool" : False
+
}
+
+
def test_dict_array ( self ): # Test methods should always start with the word 'test'
+
a = self . d [ "array" ]
+
self . assertEqual ( a , [ 1 , 2 , 3 , 4 , 5 ]) # The heart of a test method are assertions
+
self . assertEqual ( a [ 2 ], 3 ) # These methods take two arguments and compare them to one another
+
self . assertIn ( 5 , a ) # There are loads of them, and they're all very useful
+
+
def test_dict_string ( self ):
+
s = self . d [ "string" ]
+
self . assertIn ( "Hello" , s )
+
self . assertNotEqual ( "Walkin' on the Sun" , s )
+
+
def test_dict_integer ( self ):
+
i = self . d [ "integer" ]
+
self . assertGreater ( 50 , i )
+
self . assertAlmostEqual ( i , 42.00000001 ) # Checks within 7 decimal points
+
+
def test_dict_bool ( self ):
+
b = self . d [ "bool" ]
+
self . assertFalse ( b )
+
self . assertEqual ( b , False )
+
+ # This is just the very basics of how to set up a test file
+ # For more info: https://docs.python.org/3/library/unittest.html
+
+
+if __name__ == '__main__' :
+ unittest . main
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/test_suite/tests/test_game_board.html b/docs/_modules/game/test_suite/tests/test_game_board.html
new file mode 100644
index 0000000..a418bd5
--- /dev/null
+++ b/docs/_modules/game/test_suite/tests/test_game_board.html
@@ -0,0 +1,361 @@
+
+
+
+
+
+
+
+ game.test_suite.tests.test_game_board - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.test_suite.tests.test_game_board
+import unittest
+
+from game.common.enums import ObjectType
+from game.common.avatar import Avatar
+from game.common.items.item import Item
+from game.common.stations.station import Station
+from game.common.stations.occupiable_station import OccupiableStation
+from game.common.map.tile import Tile
+from game.common.map.wall import Wall
+from game.utils.vector import Vector
+from game.common.game_object import GameObject
+from game.common.map.game_board import GameBoard
+
+
+[docs] class TestGameBoard ( unittest . TestCase ):
+
"""
+
`Test Gameboard Notes:`
+
+
This class tests the different methods in the Gameboard class. This file is worthwhile to look at to understand
+
the GamebBoard class better if there is still confusion on it.
+
+
*This class tests the Gameboard specifically when the map is generated.*
+
"""
+
+
[docs] def setUp ( self ) -> None :
+
self . item : Item = Item ( 10 , None )
+
self . wall : Wall = Wall ()
+
self . avatar : Avatar = Avatar ( Vector ( 5 , 5 ))
+
self . locations : dict [ tuple [ Vector ]: list [ GameObject ]] = {
+
( Vector ( 1 , 1 ),): [ Station ( None )],
+
( Vector ( 1 , 2 ), Vector ( 1 , 3 )): [ OccupiableStation ( self . item ), Station ( None )],
+
( Vector ( 2 , 2 ), Vector ( 2 , 3 )): [ OccupiableStation ( self . item ), OccupiableStation ( self . item ), OccupiableStation ( self . item ), OccupiableStation ( self . item )],
+
( Vector ( 3 , 1 ), Vector ( 3 , 2 ), Vector ( 3 , 3 )): [ OccupiableStation ( self . item ), Station ( None )],
+
( Vector ( 5 , 5 ),): [ self . avatar ],
+
( Vector ( 5 , 6 ),): [ self . wall ]
+
}
+
self . game_board : GameBoard = GameBoard ( 1 , Vector ( 10 , 10 ), self . locations , False )
+
self . game_board . generate_map ()
+
+
# test that seed cannot be set after generate_map
+
def test_seed_fail ( self ):
+
with self . assertRaises ( RuntimeError ) as e :
+
self . game_board . seed = 20
+
self . assertEqual ( str ( e . exception ), 'GameBoard variables cannot be changed once generate_map is run.' )
+
+
# test that map_size cannot be set after generate_map
+
def test_map_size_fail ( self ):
+
with self . assertRaises ( RuntimeError ) as e :
+
self . game_board . map_size = Vector ( 1 , 1 )
+
self . assertEqual ( str ( e . exception ), 'GameBoard variables cannot be changed once generate_map is run.' )
+
+
# test that locations cannot be set after generate_map
+
def test_locations_fail ( self ):
+
with self . assertRaises ( RuntimeError ) as e :
+
self . game_board . locations = self . locations
+
self . assertEqual ( str ( e . exception ), 'GameBoard variables cannot be changed once generate_map is run.' )
+
+
# test that locations raises RuntimeError even with incorrect data type
+
def test_locations_incorrect_fail ( self ):
+
with self . assertRaises ( RuntimeError ) as e :
+
self . game_board . locations = Vector ( 1 , 1 )
+
self . assertEqual ( str ( e . exception ), 'GameBoard variables cannot be changed once generate_map is run.' )
+
+
# test that walled cannot be set after generate_map
+
def test_walled_fail ( self ):
+
with self . assertRaises ( RuntimeError ) as e :
+
self . game_board . walled = False
+
self . assertEqual ( str ( e . exception ), 'GameBoard variables cannot be changed once generate_map is run.' )
+
+
# test that get_objects works correctly with stations
+
def test_get_objects_station ( self ):
+
stations : list [ tuple [ Vector , list [ Station ]]] = self . game_board . get_objects ( ObjectType . STATION )
+
self . assertTrue ( all ( map ( lambda station : isinstance ( station [ 1 ][ 0 ], Station ), stations )))
+
self . assertEqual ( len ( stations ), 3 )
+
+
# test that get_objects works correctly with occupiable stations
+
def test_get_objects_occupiable_station ( self ):
+
occupiable_stations : list [ tuple [ Vector , list [ OccupiableStation ]]] = self . game_board . get_objects ( ObjectType . OCCUPIABLE_STATION )
+
self . assertTrue (
+
all ( map ( lambda occupiable_station : isinstance ( occupiable_station [ 1 ][ 0 ], OccupiableStation ), occupiable_stations )))
+
objects_stacked = [ x [ 1 ] for x in occupiable_stations ]
+
objects_unstacked = [ x for xs in objects_stacked for x in xs ]
+
self . assertEqual ( len ( objects_unstacked ), 6 )
+
+
def test_get_objects_occupiable_station_2 ( self ):
+
occupiable_stations : list [ tuple [ Vector , list [ OccupiableStation ]]] = self . game_board . get_objects ( ObjectType . OCCUPIABLE_STATION )
+
self . assertTrue ( any ( map ( lambda vec_list : len ( vec_list [ 1 ]) == 3 , occupiable_stations )))
+
objects_stacked = [ x [ 1 ] for x in occupiable_stations ]
+
objects_unstacked = [ x for xs in objects_stacked for x in xs ]
+
self . assertEqual ( len ( objects_unstacked ), 6 )
+
+
# test that get_objects works correctly with avatar
+
def test_get_objects_avatar ( self ):
+
avatars : list [ tuple [ Vector , list [ Avatar ]]] = self . game_board . get_objects ( ObjectType . AVATAR )
+
self . assertTrue ( all ( map ( lambda avatar : isinstance ( avatar [ 1 ][ 0 ], Avatar ), avatars )))
+
self . assertEqual ( len ( avatars ), 1 )
+
+
# test that get_objects works correctly with walls
+
def test_get_objects_wall ( self ):
+
walls : list [ tuple [ Vector , list [ Wall ]]] = self . game_board . get_objects ( ObjectType . WALL )
+
self . assertTrue ( all ( map ( lambda wall : isinstance ( wall [ 1 ][ 0 ], Wall ), walls )))
+
self . assertEqual ( len ( walls ), 1 )
+
+
# test json method
+
def test_game_board_json ( self ):
+
data : dict = self . game_board . to_json ()
+
temp : GameBoard = GameBoard () . from_json ( data )
+
for ( k , v ), ( x , y ) in zip ( self . locations . items (), temp . locations . items ()):
+
for ( i , j ), ( a , b ) in zip ( zip ( k , v ), zip ( x , y )):
+
self . assertEqual ( i . object_type , a . object_type )
+
self . assertEqual ( j . object_type , b . object_type )
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/test_suite/tests/test_game_board_no_gen.html b/docs/_modules/game/test_suite/tests/test_game_board_no_gen.html
new file mode 100644
index 0000000..5104f96
--- /dev/null
+++ b/docs/_modules/game/test_suite/tests/test_game_board_no_gen.html
@@ -0,0 +1,350 @@
+
+
+
+
+
+
+
+ game.test_suite.tests.test_game_board_no_gen - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.test_suite.tests.test_game_board_no_gen
+import unittest
+
+from game.common.enums import ObjectType
+from game.common.avatar import Avatar
+from game.common.items.item import Item
+from game.common.stations.station import Station
+from game.common.stations.occupiable_station import OccupiableStation
+from game.common.map.tile import Tile
+from game.common.map.wall import Wall
+from game.utils.vector import Vector
+from game.common.game_object import GameObject
+from game.common.map.game_board import GameBoard
+
+
+[docs] class TestGameBoard ( unittest . TestCase ):
+
"""
+
`Test Gameboard Without Generation Notes:`
+
+
This class tests the different methods in the Gameboard class when the map is *not* generated.
+
"""
+
"""
+
`Test Avatar Notes:`
+
+
This class tests the different methods in the Avatar class.
+
"""
+
[docs] def setUp ( self ) -> None :
+
self . item : Item = Item ( 10 , None )
+
self . wall : Wall = Wall ()
+
self . avatar : Avatar = Avatar ( Vector ( 5 , 5 ))
+
self . locations : dict [ tuple [ Vector ]: list [ GameObject ]] = {
+
( Vector ( 1 , 1 ),): [ Station ( None )],
+
( Vector ( 1 , 2 ), Vector ( 1 , 3 )): [ OccupiableStation ( self . item ), Station ( None )],
+
( Vector ( 5 , 5 ),): [ self . avatar ],
+
( Vector ( 5 , 6 ),): [ self . wall ]
+
}
+
self . game_board : GameBoard = GameBoard ( 1 , Vector ( 10 , 10 ), self . locations , False )
+
+
# test seed
+
def test_seed ( self ):
+
self . game_board . seed = 2
+
self . assertEqual ( self . game_board . seed , 2 )
+
+
def test_seed_fail ( self ):
+
with self . assertRaises ( ValueError ) as e :
+
self . game_board . seed = "False"
+
self . assertEqual ( str ( e . exception ), 'GameBoard.seed must be an integer or None.' )
+
+
# test map_size
+
def test_map_size ( self ):
+
self . game_board . map_size = Vector ( 12 , 12 )
+
self . assertEqual ( str ( self . game_board . map_size ), str ( Vector ( 12 , 12 )))
+
+
def test_map_size_fail ( self ):
+
with self . assertRaises ( ValueError ) as e :
+
self . game_board . map_size = "wow"
+
self . assertEqual ( str ( e . exception ), 'GameBoard.map_size must be a Vector.' )
+
+
# test locations
+
def test_locations ( self ):
+
self . locations = {
+
( Vector ( 1 , 1 ),): [ self . avatar ],
+
( Vector ( 1 , 2 ), Vector ( 1 , 3 )): [ OccupiableStation ( self . item ), Station ( None )],
+
( Vector ( 5 , 5 ),): [ Station ( None )],
+
( Vector ( 5 , 6 ),): [ self . wall ]
+
}
+
self . game_board . locations = self . locations
+
self . assertEqual ( str ( self . game_board . locations ), str ( self . locations ))
+
+
def test_locations_fail_type ( self ):
+
with self . assertRaises ( ValueError ) as e :
+
self . game_board . locations = "wow"
+
self . assertEqual ( str ( e . exception ), 'Locations must be a dict. The key must be a tuple of Vector Objects, '
+
'and the value a list of GameObject.' )
+
+
# test walled
+
def test_walled ( self ):
+
self . game_board . walled = True
+
self . assertEqual ( self . game_board . walled , True )
+
+
def test_walled_fail ( self ):
+
with self . assertRaises ( ValueError ) as e :
+
self . game_board . walled = "wow"
+
self . assertEqual ( str ( e . exception ), 'GameBoard.walled must be a bool.' )
+
+
# test json method
+
def test_game_board_json ( self ):
+
data : dict = self . game_board . to_json ()
+
temp : GameBoard = GameBoard () . from_json ( data )
+
for ( k , v ), ( x , y ) in zip ( self . locations . items (), temp . locations . items ()):
+
for ( i , j ), ( a , b ) in zip ( zip ( k , v ), zip ( x , y )):
+
self . assertEqual ( i . object_type , a . object_type )
+
self . assertEqual ( j . object_type , b . object_type )
+
+
def test_generate_map ( self ):
+
self . game_board . generate_map ()
+
self . assertEqual ( self . game_board . game_map [ 1 ][ 1 ] . occupied_by . object_type , ObjectType . STATION )
+
self . assertEqual ( self . game_board . game_map [ 2 ][ 1 ] . occupied_by . object_type , ObjectType . OCCUPIABLE_STATION )
+
self . assertEqual ( self . game_board . game_map [ 3 ][ 1 ] . occupied_by . object_type , ObjectType . STATION )
+
self . assertEqual ( self . game_board . game_map [ 5 ][ 5 ] . occupied_by . object_type , ObjectType . AVATAR )
+
self . assertEqual ( self . game_board . game_map [ 6 ][ 5 ] . occupied_by . object_type , ObjectType . WALL )
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/test_suite/tests/test_initialization.html b/docs/_modules/game/test_suite/tests/test_initialization.html
new file mode 100644
index 0000000..ddb07e7
--- /dev/null
+++ b/docs/_modules/game/test_suite/tests/test_initialization.html
@@ -0,0 +1,288 @@
+
+
+
+
+
+
+
+ game.test_suite.tests.test_initialization - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.test_suite.tests.test_initialization
+import unittest
+
+from game.common.enums import ObjectType
+from game.common.avatar import Avatar
+from game.common.items.item import Item
+from game.common.stations.station import Station
+from game.common.stations.occupiable_station import OccupiableStation
+from game.common.map.tile import Tile
+from game.common.map.wall import Wall
+from game.utils.vector import Vector
+
+
+[docs] class TestInitialization ( unittest . TestCase ):
+
"""
+
`Test Avatar Notes:`
+
+
This class tests the instantiation of different Objects within the project. Recall that every new class created
+
needs a respective ObjectType enum created for it.
+
"""
+
+
[docs] def setUp ( self ) -> None :
+
self . item : Item = Item ( 10 , 100 )
+
self . avatar : Avatar = Avatar ( None )
+
self . station : Station = Station ( None )
+
self . occupiable_station : OccupiableStation = OccupiableStation ( None , None )
+
self . tile : Tile = Tile ( None )
+
self . wall : Wall = Wall ()
+
self . vector : Vector = Vector ()
+
+
# tests that all objects have the correct ObjectType
+
def test_object_init ( self ):
+
self . assertEqual ( self . item . object_type , ObjectType . ITEM )
+
self . assertEqual ( self . avatar . object_type , ObjectType . AVATAR )
+
self . assertEqual ( self . station . object_type , ObjectType . STATION )
+
self . assertEqual ( self . occupiable_station . object_type , ObjectType . OCCUPIABLE_STATION )
+
self . assertEqual ( self . tile . object_type , ObjectType . TILE )
+
self . assertEqual ( self . wall . object_type , ObjectType . WALL )
+
self . assertEqual ( self . vector . object_type , ObjectType . VECTOR )
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/test_suite/tests/test_interact_controller.html b/docs/_modules/game/test_suite/tests/test_interact_controller.html
new file mode 100644
index 0000000..1e8b2c7
--- /dev/null
+++ b/docs/_modules/game/test_suite/tests/test_interact_controller.html
@@ -0,0 +1,317 @@
+
+
+
+
+
+
+
+ game.test_suite.tests.test_interact_controller - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.test_suite.tests.test_interact_controller
+import unittest
+
+from game.common.avatar import Avatar
+from game.common.items.item import Item
+from game.controllers.interact_controller import InteractController
+from game.common.map.game_board import GameBoard
+from game.utils.vector import Vector
+from game.common.map.wall import Wall
+from game.common.stations.station import Station
+from game.common.stations.station_example import StationExample
+from game.common.stations.station_receiver_example import StationReceiverExample
+from game.common.stations.occupiable_station import OccupiableStation
+from game.common.stations.occupiable_station_example import OccupiableStationExample
+from game.common.game_object import GameObject
+from game.common.action import ActionType
+from game.common.player import Player
+from game.common.enums import ObjectType
+
+
+[docs] class TestInteractController ( unittest . TestCase ):
+
"""
+
`Test Avatar Notes:`
+
+
This class tests the different methods in the InteractController class.
+
"""
+
+
[docs] def setUp ( self ) -> None :
+
self . interact_controller : InteractController = InteractController ()
+
self . item : Item = Item ( 10 , None )
+
self . wall : Wall = Wall ()
+
self . occupiable_station : OccupiableStation = OccupiableStation ( self . item )
+
self . station_example : StationExample = StationExample ( self . item )
+
self . occupiable_station_example = OccupiableStationExample ( self . item )
+
self . avatar : Avatar = Avatar ( Vector ( 5 , 5 ))
+
self . locations : dict [ tuple [ Vector ]: list [ GameObject ]] = {
+
( Vector ( 1 , 1 ),): [ Station ( None )],
+
( Vector ( 5 , 4 ),): [ self . occupiable_station_example ],
+
( Vector ( 6 , 5 ),): [ self . station_example ],
+
( Vector ( 4 , 5 ),): [ StationReceiverExample ()],
+
( Vector ( 5 , 5 ),): [ self . avatar ],
+
( Vector ( 5 , 6 ),): [ self . wall ]
+
}
+
self . game_board : GameBoard = GameBoard ( 1 , Vector ( 10 , 10 ), self . locations , False )
+
self . player : Player = Player ( None , None , [], self . avatar )
+
self . game_board . generate_map ()
+
+
# interact and pick up nothing
+
def test_interact_nothing ( self ):
+
self . interact_controller . handle_actions ( ActionType . INTERACT_DOWN , self . player , self . game_board )
+
self . assertEqual ( self . avatar . held_item , None )
+
+
# interact and pick up from an occupiable_station
+
def test_interact_item_occupiable_station ( self ):
+
self . interact_controller . handle_actions ( ActionType . INTERACT_UP , self . player , self . game_board )
+
self . assertEqual ( self . avatar . inventory [ 0 ] . object_type , ObjectType . ITEM )
+
+
# interact and pick up from a station
+
def test_interact_item_station ( self ):
+
self . interact_controller . handle_actions ( ActionType . INTERACT_RIGHT , self . player , self . game_board )
+
self . assertEqual ( self . avatar . inventory [ 0 ] . object_type , ObjectType . ITEM )
+
+
# interact and get item then dump item
+
def test_interact_dump_item ( self ):
+
self . interact_controller . handle_actions ( ActionType . INTERACT_RIGHT , self . player , self . game_board )
+
self . assertEqual ( self . avatar . held_item , self . item )
+
self . interact_controller . handle_actions ( ActionType . INTERACT_LEFT , self . player , self . game_board )
+
self . assertTrue ( all ( map ( lambda x : x is None , self . avatar . inventory )))
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/test_suite/tests/test_inventory_controller.html b/docs/_modules/game/test_suite/tests/test_inventory_controller.html
new file mode 100644
index 0000000..1ef6bb3
--- /dev/null
+++ b/docs/_modules/game/test_suite/tests/test_inventory_controller.html
@@ -0,0 +1,360 @@
+
+
+
+
+
+
+
+ game.test_suite.tests.test_inventory_controller - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.test_suite.tests.test_inventory_controller
+import unittest
+
+from game.common.enums import *
+from game.common.avatar import Avatar
+from game.common.player import Player
+from game.common.items.item import Item
+from game.controllers.inventory_controller import InventoryController
+from game.common.map.game_board import GameBoard
+
+
+[docs] class TestInventoryController ( unittest . TestCase ):
+
"""
+
`Test Inventory Controller Notes:`
+
+
This class tests the different methods in the Avatar class' inventory.
+
"""
+
+
[docs] def setUp ( self ) -> None :
+
self . inventory_controller : InventoryController = InventoryController ()
+
self . item : Item = Item ()
+
self . avatar : Avatar = Avatar ( max_inventory_size = 10 )
+
+
self . inventory : [ Item ] = [ Item ( 1 ), Item ( 2 ), Item ( 3 ), Item ( 4 ), Item ( 5 ), Item ( 6 ), Item ( 7 ), Item ( 8 ),
+
Item ( 9 ), Item ( 10 )]
+
+
self . avatar . inventory = self . inventory
+
self . player : Player = Player ( avatar = self . avatar )
+
self . game_board : GameBoard = GameBoard ()
+
+
# Testing accessing the right Item with the controller
+
def test_select_slot_0 ( self ):
+
self . inventory_controller . handle_actions ( ActionType . SELECT_SLOT_0 , self . player , self . game_board )
+
self . assertEqual ( self . avatar . held_item , self . inventory [ 0 ])
+
self . check_inventory_item ()
+
+
def test_select_slot_1 ( self ):
+
self . inventory_controller . handle_actions ( ActionType . SELECT_SLOT_1 , self . player , self . game_board )
+
self . assertEqual ( self . avatar . held_item , self . inventory [ 1 ])
+
self . check_inventory_item ()
+
+
def test_select_slot_2 ( self ):
+
self . inventory_controller . handle_actions ( ActionType . SELECT_SLOT_2 , self . player , self . game_board )
+
self . assertEqual ( self . avatar . held_item , self . inventory [ 2 ])
+
self . check_inventory_item ()
+
+
def test_select_slot_3 ( self ):
+
self . inventory_controller . handle_actions ( ActionType . SELECT_SLOT_3 , self . player , self . game_board )
+
self . assertEqual ( self . avatar . held_item , self . inventory [ 3 ])
+
self . check_inventory_item ()
+
+
def test_select_slot_4 ( self ):
+
self . inventory_controller . handle_actions ( ActionType . SELECT_SLOT_4 , self . player , self . game_board )
+
self . assertEqual ( self . avatar . held_item , self . inventory [ 4 ])
+
self . check_inventory_item ()
+
+
def test_select_slot_5 ( self ):
+
self . inventory_controller . handle_actions ( ActionType . SELECT_SLOT_5 , self . player , self . game_board )
+
self . assertEqual ( self . avatar . held_item , self . inventory [ 5 ])
+
self . check_inventory_item ()
+
+
def test_select_slot_6 ( self ):
+
self . inventory_controller . handle_actions ( ActionType . SELECT_SLOT_6 , self . player , self . game_board )
+
self . assertEqual ( self . avatar . held_item , self . inventory [ 6 ])
+
self . check_inventory_item ()
+
+
def test_select_slot_7 ( self ):
+
self . inventory_controller . handle_actions ( ActionType . SELECT_SLOT_7 , self . player , self . game_board )
+
self . assertEqual ( self . avatar . held_item , self . inventory [ 7 ])
+
self . check_inventory_item ()
+
+
def test_select_slot_8 ( self ):
+
self . inventory_controller . handle_actions ( ActionType . SELECT_SLOT_8 , self . player , self . game_board )
+
self . assertEqual ( self . avatar . held_item , self . inventory [ 8 ])
+
self . check_inventory_item ()
+
+
def test_select_slot_9 ( self ):
+
self . inventory_controller . handle_actions ( ActionType . SELECT_SLOT_9 , self . player , self . game_board )
+
self . assertEqual ( self . avatar . held_item , self . inventory [ 9 ])
+
self . check_inventory_item ()
+
+
# Testing using the inventory controller with the wrong ActionType
+
def test_with_wrong_action_type ( self ):
+
self . inventory_controller . handle_actions ( ActionType . MOVE_LEFT , self . player , self . game_board )
+
self . assertEqual ( self . avatar . held_item , self . avatar . inventory [ 0 ])
+
self . check_inventory_item ()
+
+
# Tests accessing a slot of the inventory given an enum that's out of bounds
+
def test_with_out_of_bounds ( self ):
+
with self . assertRaises ( IndexError ) as e :
+
self . inventory : [ Item ] = [ Item ( 1 ), Item ( 2 ), Item ( 3 ), Item ( 4 ), Item ( 5 )]
+
self . avatar . max_inventory_size = 5
+
self . avatar . inventory = self . inventory
+
self . player : Player = Player ( avatar = self . avatar )
+
self . inventory_controller . handle_actions ( ActionType . SELECT_SLOT_9 , self . player , self . game_board )
+
self . assertEqual ( str ( e . exception ), 'The given action type, SELECT_SLOT_9, is not within bounds of the given '
+
'inventory of size 5. Select an ActionType enum '
+
'that will be within the inventory \' s bounds.' )
+
+
def check_inventory_item ( self ):
+
# Test to make sure that the inventory hasn't shifted items
+
self . assertEqual ( self . avatar . inventory [ 0 ] . value , 1 )
+
self . assertEqual ( self . avatar . inventory [ 1 ] . value , 2 )
+
self . assertEqual ( self . avatar . inventory [ 2 ] . value , 3 )
+
self . assertEqual ( self . avatar . inventory [ 3 ] . value , 4 )
+
self . assertEqual ( self . avatar . inventory [ 4 ] . value , 5 )
+
self . assertEqual ( self . avatar . inventory [ 5 ] . value , 6 )
+
self . assertEqual ( self . avatar . inventory [ 6 ] . value , 7 )
+
self . assertEqual ( self . avatar . inventory [ 7 ] . value , 8 )
+
self . assertEqual ( self . avatar . inventory [ 8 ] . value , 9 )
+
self . assertEqual ( self . avatar . inventory [ 9 ] . value , 10 )
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/test_suite/tests/test_item.html b/docs/_modules/game/test_suite/tests/test_item.html
new file mode 100644
index 0000000..76ad042
--- /dev/null
+++ b/docs/_modules/game/test_suite/tests/test_item.html
@@ -0,0 +1,364 @@
+
+
+
+
+
+
+
+ game.test_suite.tests.test_item - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.test_suite.tests.test_item
+import unittest
+
+from game.common.avatar import Avatar
+from game.common.items.item import Item
+from game.common.enums import ObjectType
+
+
+[docs] class TestItem ( unittest . TestCase ):
+
"""
+
`Test Item Notes:`
+
+
This class tests the different methods in the Item class.
+
"""
+
+
[docs] def setUp ( self ) -> None :
+
self . avatar : Avatar = Avatar ( None , 1 )
+
self . item : Item = Item ()
+
+
# test set durability
+
def test_set_durability ( self ):
+
self . item . durability = 10
+
self . assertEqual ( self . item . durability , 10 )
+
+
def test_set_durability_none ( self ):
+
self . item . durability = None
+
self . assertEqual ( self . item . durability , None )
+
+
def test_set_durability_fail ( self ):
+
with self . assertRaises ( ValueError ) as e :
+
self . item . durability = 'fail'
+
self . assertEqual ( str ( e . exception ), 'Item.durability must be an int or None.' )
+
+
def test_set_durability_stack_size_fail ( self ):
+
with self . assertRaises ( ValueError ) as e :
+
self . item = Item ( 10 , None , 10 , 10 )
+
self . item . durability = 19
+
self . assertEqual ( str ( e . exception ), 'Item.durability must be set to None if stack_size is not equal to 1.' )
+
+
# test set value
+
def test_set_value ( self ):
+
self . item . value = 10
+
self . assertEqual ( self . item . value , 10 )
+
+
def test_set_value_fail ( self ):
+
with self . assertRaises ( ValueError ) as e :
+
self . item . value = 'fail'
+
self . assertEqual ( str ( e . exception ), 'Item.value must be an int.' )
+
+
# test set quantity
+
def test_set_quantity ( self ):
+
self . item = Item ( 10 , None , 10 , 10 )
+
self . item . quantity = 5
+
self . assertEqual ( self . item . quantity , 5 )
+
+
def test_set_quantity_fail ( self ):
+
with self . assertRaises ( ValueError ) as e :
+
self . item . quantity = 'fail'
+
self . assertEqual ( str ( e . exception ), 'Item.quantity must be an int.' )
+
+
def test_set_quantity_fail_greater_than_0 ( self ):
+
with self . assertRaises ( ValueError ) as e :
+
self . item . quantity = - 1
+
self . assertEqual ( str ( e . exception ), 'Item.quantity must be greater than or equal to 0.' )
+
+
def test_set_quantity_fail_stack_size ( self ):
+
with self . assertRaises ( ValueError ) as e :
+
self . item . quantity = 10
+
self . item . stack_size = 1
+
self . assertEqual ( str ( e . exception ), 'Item.quantity cannot be greater than Item.stack_size' )
+
+
def test_stack_size ( self ):
+
self . item = Item ( 10 , None , 10 , 10 )
+
self . assertEqual ( self . item . quantity , 10 )
+
+
def test_stack_size_fail ( self ):
+
with self . assertRaises ( ValueError ) as e :
+
self . item . stack_size = 'fail'
+
self . assertEqual ( str ( e . exception ), 'Item.stack_size must be an int.' )
+
+
def test_stack_size_fail_quantity ( self ):
+
# value, durability, quantity, stack size
+
with self . assertRaises ( ValueError ) as e :
+
item : Item = Item ( 10 , None , 10 , 10 )
+
item . stack_size = 5
+
self . assertEqual ( str ( e . exception ), 'Item.stack_size must be greater than or equal to the quantity.' )
+
+
def test_pick_up ( self ):
+
# value, durability, quantity, stack size
+
item : Item = Item ( 10 , None , 2 , 10 )
+
self . item = Item ( 10 , None , 1 , 10 )
+
self . item . pick_up ( item )
+
self . assertEqual ( self . item . quantity , 3 )
+
+
def test_pick_up_wrong_object_type ( self ):
+
item : Item = Item ( 10 , 10 , 1 , 1 )
+
item . object_type = ObjectType . PLAYER
+
self . item = Item ( 10 , 10 , 1 , 1 )
+
self . item = self . item . pick_up ( item )
+
self . assertEqual ( self . item . object_type , item . object_type )
+
+
def test_pick_up_surplus ( self ):
+
item : Item = Item ( 10 , None , 10 , 10 )
+
self . item = Item ( 10 , None , 9 , 10 )
+
surplus : Item = self . item . pick_up ( item )
+
self . assertEqual ( surplus . quantity , 9 )
+
+
def test_item_json ( self ):
+
data : dict = self . item . to_json ()
+
item : Item = Item () . from_json ( data )
+
self . assertEqual ( self . item . object_type , item . object_type )
+
self . assertEqual ( self . item . value , item . value )
+
self . assertEqual ( self . item . stack_size , item . stack_size )
+
self . assertEqual ( self . item . durability , item . durability )
+
self . assertEqual ( self . item . quantity , item . quantity )
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/test_suite/tests/test_master_controller.html b/docs/_modules/game/test_suite/tests/test_master_controller.html
new file mode 100644
index 0000000..d675230
--- /dev/null
+++ b/docs/_modules/game/test_suite/tests/test_master_controller.html
@@ -0,0 +1,268 @@
+
+
+
+
+
+
+
+ game.test_suite.tests.test_master_controller - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.test_suite.tests.test_master_controller
+import unittest
+
+from game.controllers.master_controller import MasterController
+from game.controllers.movement_controller import MovementController
+from game.controllers.interact_controller import InteractController
+
+
+[docs] class TestMasterController ( unittest . TestCase ):
+
"""
+
`Test Master Controller Notes:`
+
+
Add tests to this class to tests any new functionality added to the Master Controller.
+
"""
+
+
[docs] def setUp ( self ) -> None :
+
self . master_controller = MasterController ()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/test_suite/tests/test_movement_controller.html b/docs/_modules/game/test_suite/tests/test_movement_controller.html
new file mode 100644
index 0000000..4f104aa
--- /dev/null
+++ b/docs/_modules/game/test_suite/tests/test_movement_controller.html
@@ -0,0 +1,299 @@
+
+
+
+
+
+
+
+ game.test_suite.tests.test_movement_controller - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.test_suite.tests.test_movement_controller
+import unittest
+
+from game.common.map.game_board import GameBoard
+from game.controllers.movement_controller import MovementController
+from game.common.stations.station import Station
+from game.common.stations.occupiable_station import OccupiableStation
+from game.common.map.wall import Wall
+from game.utils.vector import Vector
+from game.common.player import Player
+from game.common.action import ActionType
+from game.common.avatar import Avatar
+from game.common.game_object import GameObject
+
+
+[docs] class TestMovementControllerIfWall ( unittest . TestCase ):
+
"""
+
`Test Movement Controller if Wall Notes:`
+
+
This class tests the Movement Controller *specifically* for when there are walls -- or other impassable
+
objects -- near the Avatar.
+
"""
+
+
[docs] def setUp ( self ) -> None :
+
self . movement_controller = MovementController ()
+
self . avatar = Avatar ( Vector ( 2 , 2 ), 1 )
+
self . locations : dict [ tuple [ Vector ]: list [ GameObject ]] = {
+
( Vector ( 2 , 2 ),): [ self . avatar ]
+
}
+
self . game_board = GameBoard ( 0 , Vector ( 4 , 4 ), self . locations , False )
+
# test movements up, down, left and right by starting with default 3,3 then know if it changes from there \/
+
self . client = Player ( None , None , [], self . avatar )
+
self . game_board . generate_map ()
+
+
# if there is a wall
+
def test_move_up ( self ):
+
self . movement_controller . handle_actions ( ActionType . MOVE_UP , self . client , self . game_board )
+
self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 2 , 1 )))
+
+
def test_move_down ( self ):
+
self . movement_controller . handle_actions ( ActionType . MOVE_DOWN , self . client , self . game_board )
+
self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 2 , 3 )))
+
+
def test_move_left ( self ):
+
self . movement_controller . handle_actions ( ActionType . MOVE_LEFT , self . client , self . game_board )
+
self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 1 , 2 )))
+
+
def test_move_right ( self ):
+
self . movement_controller . handle_actions ( ActionType . MOVE_RIGHT , self . client , self . game_board )
+
self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 3 , 2 )))
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/test_suite/tests/test_movement_controller_if_occupiable_station_is_occupiable.html b/docs/_modules/game/test_suite/tests/test_movement_controller_if_occupiable_station_is_occupiable.html
new file mode 100644
index 0000000..3aa7459
--- /dev/null
+++ b/docs/_modules/game/test_suite/tests/test_movement_controller_if_occupiable_station_is_occupiable.html
@@ -0,0 +1,308 @@
+
+
+
+
+
+
+
+ game.test_suite.tests.test_movement_controller_if_occupiable_station_is_occupiable - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.test_suite.tests.test_movement_controller_if_occupiable_station_is_occupiable
+import unittest
+
+from game.common.action import ActionType
+from game.common.avatar import Avatar
+from game.common.map.game_board import GameBoard
+from game.common.map.wall import Wall
+from game.common.player import Player
+from game.common.stations.occupiable_station import OccupiableStation
+from game.controllers.movement_controller import MovementController
+from game.utils.vector import Vector
+from game.common.stations.station import Station
+
+
+[docs] class TestMovementControllerIfOccupiableStationIsOccupiable ( unittest . TestCase ):
+
"""
+
`Test Movement Controller if Occupiable Stations are Occupiable Notes:`
+
+
This class tests the different methods in the Movement Controller class and the Avatar moving onto Occupiable
+
Stations so that the Avatar can occupy it.
+
"""
+
+
[docs] def setUp ( self ) -> None :
+
self . movement_controller = MovementController ()
+
+
# (1, 0), (2, 0), (0, 1), (0, 2), (1, 3), (2, 3), (3, 1), (3, 2)
+
self . locations : dict = {
+
( Vector ( 1 , 0 ), Vector ( 2 , 0 ), Vector ( 0 , 1 ), Vector ( 0 , 2 )): [ OccupiableStation ( None , None ),
+
OccupiableStation ( None , None ),
+
OccupiableStation ( None , None ),
+
OccupiableStation ( None , None )]}
+
self . game_board = GameBoard ( 0 , Vector ( 3 , 3 ), self . locations , False )
+
self . occ_station = OccupiableStation ()
+
self . occ_station = OccupiableStation ()
+
# self.wall = Wall()
+
# test movements up, down, left and right by starting with default 3,3 then know if it changes from there \/
+
self . avatar = Avatar ( None , Vector ( 1 , 1 ), [], 1 )
+
self . client = Player ( None , None , [], self . avatar )
+
self . game_board . generate_map ()
+
+
+def test_move_up ( self ):
+ self . movement_controller . handle_actions ( ActionType . MOVE_UP , self . client , self . game_board )
+ self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 1 , 0 )))
+
+
+def test_move_down ( self ):
+ self . movement_controller . handle_actions ( ActionType . MOVE_DOWN , self . client , self . game_board )
+ self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 1 , 2 )))
+
+
+def test_move_left ( self ):
+ self . movement_controller . handle_actions ( ActionType . MOVE_LEFT , self . client , self . game_board )
+ self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 0 , 1 )))
+
+
+def test_move_right ( self ):
+ self . movement_controller . handle_actions ( ActionType . MOVE_RIGHT , self . client , self . game_board )
+ self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 2 , 1 )))
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/test_suite/tests/test_movement_controller_if_occupiable_stations.html b/docs/_modules/game/test_suite/tests/test_movement_controller_if_occupiable_stations.html
new file mode 100644
index 0000000..790a425
--- /dev/null
+++ b/docs/_modules/game/test_suite/tests/test_movement_controller_if_occupiable_stations.html
@@ -0,0 +1,338 @@
+
+
+
+
+
+
+
+ game.test_suite.tests.test_movement_controller_if_occupiable_stations - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.test_suite.tests.test_movement_controller_if_occupiable_stations
+import unittest
+
+from game.common.action import ActionType
+from game.common.avatar import Avatar
+from game.common.map.game_board import GameBoard
+from game.common.map.wall import Wall
+from game.common.player import Player
+from game.common.stations.occupiable_station import OccupiableStation
+from game.controllers.movement_controller import MovementController
+from game.utils.vector import Vector
+from game.common.stations.station import Station
+
+
+[docs] class TestMovementControllerIfOccupiableStations ( unittest . TestCase ):
+
"""
+
`Test Movement Controller with Occupiable Stations that are Occupied Notes:`
+
+
This class tests the different methods in the Movement Controller and that the Avatar can't move onto an
+
Occupiable Station that is occupied by an unoccupiable object (e.g., a Wall or Station object).
+
"""
+
+
[docs] def setUp ( self ) -> None :
+
self . movement_controller = MovementController ()
+
+
# (1, 0), (2, 0), (0, 1), (0, 2), (1, 3), (2, 3), (3, 1), (3, 2)
+
self . locations : dict = {( Vector ( 1 , 0 ), Vector ( 2 , 0 ), Vector ( 0 , 1 ), Vector ( 0 , 2 ), Vector ( 1 , 3 ), Vector ( 2 , 3 ),
+
Vector ( 3 , 1 ), Vector ( 3 , 2 )): [ OccupiableStation ( None , Wall ()),
+
OccupiableStation ( None , Wall ()),
+
OccupiableStation ( None , Wall ()),
+
OccupiableStation ( None , Wall ()),
+
OccupiableStation ( None , Wall ()),
+
OccupiableStation ( None , Wall ()),
+
OccupiableStation ( None , Wall ()),
+
OccupiableStation ( None , Station ())]}
+
self . game_board = GameBoard ( 0 , Vector ( 4 , 4 ), self . locations , False )
+
self . occ_station = OccupiableStation ()
+
self . occ_station = OccupiableStation ()
+
# self.wall = Wall()
+
# test movements up, down, left and right by starting with default 3,3 then know if it changes from there \/
+
self . avatar = Avatar ( None , Vector ( 2 , 2 ), [], 1 )
+
self . client = Player ( None , None , [], self . avatar )
+
self . game_board . generate_map ()
+
+ # it is not occupied, so you can move there
+
+
+def test_move_up ( self ):
+ self . movement_controller . handle_actions ( ActionType . MOVE_UP , self . client , self . game_board )
+ self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 2 , 1 )))
+
+
+def test_move_up_fail ( self ):
+ self . movement_controller . handle_actions ( ActionType . MOVE_UP , self . client , self . game_board )
+ self . movement_controller . handle_actions ( ActionType . MOVE_UP , self . client , self . game_board )
+ self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 2 , 1 )))
+
+
+def test_move_down ( self ):
+ self . movement_controller . handle_actions ( ActionType . MOVE_UP , self . client , self . game_board )
+ self . movement_controller . handle_actions ( ActionType . MOVE_DOWN , self . client , self . game_board )
+ self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 2 , 2 )))
+
+
+def test_move_down_fail ( self ):
+ self . movement_controller . handle_actions ( ActionType . MOVE_DOWN , self . client , self . game_board )
+ self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 2 , 2 )))
+
+
+def test_move_left ( self ):
+ self . movement_controller . handle_actions ( ActionType . MOVE_LEFT , self . client , self . game_board )
+ self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 1 , 2 )))
+
+
+def test_move_left_fail ( self ):
+ self . movement_controller . handle_actions ( ActionType . MOVE_LEFT , self . client , self . game_board )
+ self . movement_controller . handle_actions ( ActionType . MOVE_LEFT , self . client , self . game_board )
+ self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 1 , 2 )))
+
+
+def test_move_right ( self ):
+ self . movement_controller . handle_actions ( ActionType . MOVE_LEFT , self . client , self . game_board )
+ self . movement_controller . handle_actions ( ActionType . MOVE_RIGHT , self . client , self . game_board )
+ self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 2 , 2 )))
+
+
+def test_move_right_fail ( self ):
+ self . movement_controller . handle_actions ( ActionType . MOVE_RIGHT , self . client , self . game_board )
+ self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 2 , 2 )))
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/test_suite/tests/test_movement_controller_if_stations.html b/docs/_modules/game/test_suite/tests/test_movement_controller_if_stations.html
new file mode 100644
index 0000000..cecc429
--- /dev/null
+++ b/docs/_modules/game/test_suite/tests/test_movement_controller_if_stations.html
@@ -0,0 +1,320 @@
+
+
+
+
+
+
+
+ game.test_suite.tests.test_movement_controller_if_stations - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.test_suite.tests.test_movement_controller_if_stations
+import unittest
+
+from game.controllers.movement_controller import MovementController
+from game.common.map.game_board import GameBoard
+from game.common.stations.station import Station
+from game.common.stations.occupiable_station import OccupiableStation
+from game.common.map.wall import Wall
+from game.utils.vector import Vector
+from game.common.player import Player
+from game.common.avatar import Avatar
+from game.common.action import ActionType
+from game.common.game_object import GameObject
+
+
+[docs] class TestMovementControllerIfStations ( unittest . TestCase ):
+
"""
+
`Test Movement Controller with Stations Notes:`
+
+
This class tests the different methods in the Movement Controller and that the Avatar can't move onto a Station
+
object (an example of an impassable object).
+
"""
+
+
[docs] def setUp ( self ) -> None :
+
self . movement_controller = MovementController ()
+
# (1, 0), (2, 0), (0, 1), (0, 2), (1, 3), (2, 3), (3, 1), (3, 2)
+
self . locations : dict = {( Vector ( 1 , 0 ), Vector ( 2 , 0 ), Vector ( 0 , 1 ), Vector ( 0 , 2 ), Vector ( 1 , 3 ), Vector ( 2 , 3 ),
+
Vector ( 3 , 1 ), Vector ( 3 , 2 )): [ Station ( None ), Station ( None ), Station ( None ),
+
Station ( None ), Station ( None ), Station ( None ),
+
Station ( None ), Station ( None )]}
+
+
self . occ_station = OccupiableStation ()
+
self . game_board = GameBoard ( 0 , Vector ( 4 , 4 ), self . locations , True )
+
self . wall = Wall ()
+
# test movements up, down, left and right by starting with default 3,3 then know if it changes from there \/
+
self . avatar = Avatar ( Vector ( 2 , 2 ), 1 )
+
self . client = Player ( None , None , [], self . avatar )
+
self . game_board . generate_map ()
+
+
# if there is a station
+
def test_move_up_fail ( self ):
+
self . movement_controller . handle_actions ( ActionType . MOVE_UP , self . client , self . game_board )
+
self . movement_controller . handle_actions ( ActionType . MOVE_UP , self . client , self . game_board )
+
self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 2 , 1 )))
+
+
def test_move_down ( self ):
+
self . movement_controller . handle_actions ( ActionType . MOVE_UP , self . client , self . game_board )
+
self . movement_controller . handle_actions ( ActionType . MOVE_DOWN , self . client , self . game_board )
+
self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 2 , 2 )))
+
+
def test_move_down_fail ( self ):
+
self . movement_controller . handle_actions ( ActionType . MOVE_DOWN , self . client , self . game_board )
+
self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 2 , 2 )))
+
+
def test_move_left ( self ):
+
self . movement_controller . handle_actions ( ActionType . MOVE_LEFT , self . client , self . game_board )
+
self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 1 , 2 )))
+
+
def test_move_left_fail ( self ):
+
self . movement_controller . handle_actions ( ActionType . MOVE_LEFT , self . client , self . game_board )
+
self . movement_controller . handle_actions ( ActionType . MOVE_LEFT , self . client , self . game_board )
+
self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 1 , 2 )))
+
+
def test_move_right ( self ):
+
self . movement_controller . handle_actions ( ActionType . MOVE_LEFT , self . client , self . game_board )
+
self . movement_controller . handle_actions ( ActionType . MOVE_RIGHT , self . client , self . game_board )
+
self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 2 , 2 )))
+
+
def test_move_right_fail ( self ):
+
self . movement_controller . handle_actions ( ActionType . MOVE_RIGHT , self . client , self . game_board )
+
self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 2 , 2 )))
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/test_suite/tests/test_movement_controller_if_wall.html b/docs/_modules/game/test_suite/tests/test_movement_controller_if_wall.html
new file mode 100644
index 0000000..3c5a3bd
--- /dev/null
+++ b/docs/_modules/game/test_suite/tests/test_movement_controller_if_wall.html
@@ -0,0 +1,322 @@
+
+
+
+
+
+
+
+ game.test_suite.tests.test_movement_controller_if_wall - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.test_suite.tests.test_movement_controller_if_wall
+import unittest
+
+from game.common.map.game_board import GameBoard
+from game.controllers.movement_controller import MovementController
+from game.common.stations.station import Station
+from game.common.stations.occupiable_station import OccupiableStation
+from game.common.map.wall import Wall
+from game.utils.vector import Vector
+from game.common.player import Player
+from game.common.action import ActionType
+from game.common.avatar import Avatar
+from game.common.game_object import GameObject
+
+
+[docs] class TestMovementControllerIfWall ( unittest . TestCase ):
+
"""
+
`Test Movement Controller with Stations Notes:`
+
+
This class tests the different methods in the Movement Controller and that the Avatar can't pass Wall objects.
+
"""
+
+
[docs] def setUp ( self ) -> None :
+
self . movement_controller = MovementController ()
+
self . avatar = Avatar ( Vector ( 2 , 2 ), 1 )
+
self . locations : dict [ tuple [ Vector ]: list [ GameObject ]] = {
+
( Vector ( 2 , 2 ),): [ self . avatar ]
+
}
+
self . game_board = GameBoard ( 0 , Vector ( 4 , 4 ), self . locations , True )
+
self . station = Station ()
+
self . occupiable_station = OccupiableStation ()
+
self . occupiable_station = OccupiableStation ()
+
self . wall = Wall ()
+
# test movements up, down, left and right by starting with default 3,3 then know if it changes from there \/
+
self . client = Player ( None , None , [], self . avatar )
+
self . game_board . generate_map ()
+
+
# if there is a wall
+
def test_move_up ( self ):
+
self . movement_controller . handle_actions ( ActionType . MOVE_UP , self . client , self . game_board )
+
self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 2 , 1 )))
+
+
def test_move_up_fail ( self ):
+
self . movement_controller . handle_actions ( ActionType . MOVE_UP , self . client , self . game_board )
+
self . movement_controller . handle_actions ( ActionType . MOVE_UP , self . client , self . game_board )
+
self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 2 , 1 )))
+
+
def test_move_down ( self ):
+
self . movement_controller . handle_actions ( ActionType . MOVE_UP , self . client , self . game_board )
+
self . movement_controller . handle_actions ( ActionType . MOVE_DOWN , self . client , self . game_board )
+
self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 2 , 2 )))
+
+
def test_move_down_fail ( self ):
+
self . movement_controller . handle_actions ( ActionType . MOVE_DOWN , self . client , self . game_board )
+
self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 2 , 2 )))
+
+
def test_move_left ( self ):
+
self . movement_controller . handle_actions ( ActionType . MOVE_LEFT , self . client , self . game_board )
+
self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 1 , 2 )))
+
+
def test_move_left_fail ( self ):
+
self . movement_controller . handle_actions ( ActionType . MOVE_LEFT , self . client , self . game_board )
+
self . movement_controller . handle_actions ( ActionType . MOVE_LEFT , self . client , self . game_board )
+
self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 1 , 2 )))
+
+
def test_move_right ( self ):
+
self . movement_controller . handle_actions ( ActionType . MOVE_LEFT , self . client , self . game_board )
+
self . movement_controller . handle_actions ( ActionType . MOVE_RIGHT , self . client , self . game_board )
+
self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 2 , 2 )))
+
+
def test_move_right_fail ( self ):
+
self . movement_controller . handle_actions ( ActionType . MOVE_RIGHT , self . client , self . game_board )
+
self . assertEqual (( str ( self . client . avatar . position )), str ( Vector ( 2 , 2 )))
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/test_suite/tests/test_occupiable_station.html b/docs/_modules/game/test_suite/tests/test_occupiable_station.html
new file mode 100644
index 0000000..c4be426
--- /dev/null
+++ b/docs/_modules/game/test_suite/tests/test_occupiable_station.html
@@ -0,0 +1,323 @@
+
+
+
+
+
+
+
+ game.test_suite.tests.test_occupiable_station - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.test_suite.tests.test_occupiable_station
+import unittest
+
+from game.common.stations.occupiable_station import OccupiableStation
+from game.common.stations.station import Station
+from game.common.map.wall import Wall
+from game.common.avatar import Avatar
+from game.common.items.item import Item
+from game.common.enums import ObjectType
+
+
+[docs] class TestOccupiableStation ( unittest . TestCase ):
+
"""
+
`Test Item Notes:`
+
+
This class tests the different methods in the OccupiableStation class and ensures the objects that occupy them
+
are properly set.
+
"""
+
+
[docs] def setUp ( self ) -> None :
+
self . occupiable_station : OccupiableStation = OccupiableStation ()
+
self . occupiable_station1 : OccupiableStation = OccupiableStation ()
+
self . wall : Wall = Wall ()
+
self . station : Station = Station ()
+
self . avatar : Avatar = Avatar ()
+
self . item : Item = Item ()
+
+
# test adding wall to occupiable_station
+
def test_wall_occ ( self ):
+
self . occupiable_station . occupied_by = self . wall
+
self . assertEqual ( self . occupiable_station . occupied_by . object_type , ObjectType . WALL )
+
+
# test adding station to occupiable_station
+
def test_station_occ ( self ):
+
self . occupiable_station . occupied_by = self . station
+
self . assertEqual ( self . occupiable_station . occupied_by . object_type , ObjectType . STATION )
+
+
# test adding avatar to occupiable_station
+
def test_avatar_occ ( self ):
+
self . occupiable_station . occupied_by = self . avatar
+
self . assertEqual ( self . occupiable_station . occupied_by . object_type , ObjectType . AVATAR )
+
+
# test adding item to occupiable_station
+
def test_item_occ ( self ):
+
self . occupiable_station . item = self . item
+
self . assertEqual ( self . occupiable_station . item . object_type , ObjectType . ITEM )
+
self . assertEqual ( self . occupiable_station . item . durability , self . item . durability )
+
self . assertEqual ( self . occupiable_station . item . value , self . item . value )
+
+
# test cannot add item to occupied_by
+
def test_fail_item_occ ( self ):
+
with self . assertRaises ( ValueError ) as e :
+
self . occupiable_station . occupied_by = self . item
+
self . assertEqual ( str ( e . exception ), 'OccupiableStation.occupied_by cannot be an Item.' )
+
+
# test json method
+
def test_occ_json ( self ):
+
self . occupiable_station . occupied_by = self . avatar
+
data : dict = self . occupiable_station . to_json ()
+
occupiable_station : OccupiableStation = OccupiableStation () . from_json ( data )
+
self . assertEqual ( self . occupiable_station . object_type , occupiable_station . object_type )
+
self . assertEqual ( self . occupiable_station . occupied_by . object_type , occupiable_station . occupied_by . object_type )
+
+
# test json method with nested occupiable_station
+
def test_nested_occ_json ( self ):
+
self . occupiable_station . occupied_by = self . occupiable_station1
+
self . occupiable_station . occupied_by . occupied_by = self . avatar
+
data : dict = self . occupiable_station . to_json ()
+
occupiable_station : OccupiableStation = OccupiableStation () . from_json ( data )
+
self . assertEqual ( self . occupiable_station . object_type , occupiable_station . object_type )
+
self . assertEqual ( self . occupiable_station . occupied_by . object_type , occupiable_station . occupied_by . object_type )
+
assert ( isinstance ( occupiable_station . occupied_by , OccupiableStation ))
+
self . assertEqual ( self . occupiable_station . occupied_by . occupied_by . object_type ,
+
occupiable_station . occupied_by . occupied_by . object_type )
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/test_suite/tests/test_player.html b/docs/_modules/game/test_suite/tests/test_player.html
new file mode 100644
index 0000000..961fe1b
--- /dev/null
+++ b/docs/_modules/game/test_suite/tests/test_player.html
@@ -0,0 +1,373 @@
+
+
+
+
+
+
+
+ game.test_suite.tests.test_player - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.test_suite.tests.test_player
+import unittest
+from game.common.player import Player
+from game.common.game_object import GameObject
+from game.common.avatar import Avatar
+from game.common.enums import *
+from game.common.avatar import Avatar
+
+
+[docs] class TestPlayer ( unittest . TestCase ):
+
"""
+
`Test Player Notes:`
+
+
This class tests the different methods in the Player class.
+
"""
+
+
[docs] def setUp ( self ) -> None :
+
self . object_type : ObjectType = ObjectType . PLAYER
+
self . functional : bool = True
+
self . player : Player = Player ()
+
self . actions : list [ ActionType ] = []
+
self . team_name : str | None = ""
+
self . avatar : Avatar | None = Avatar ()
+
+
# test action
+
def test_actions ( self ):
+
# accepts a list of ActionType
+
self . actions = [ ActionType . MOVE_LEFT ]
+
self . player . actions = self . actions
+
self . assertEqual ( self . player . actions , self . actions )
+
+
def test_actions_empty_list ( self ):
+
# accepts a list of ActionType
+
self . actions = []
+
self . player . actions = self . actions
+
self . assertEqual ( self . player . actions , self . actions )
+
+
def test_actions_fail_none ( self ):
+
with self . assertRaises ( ValueError ) as e :
+
self . player . actions = None
+
self . assertEqual ( str ( e . exception ), 'Player.action must be an empty list or a list of action types' )
+
+
def test_actions_fail_not_action_type ( self ):
+
with self . assertRaises ( ValueError ) as e :
+
self . player . actions = 10
+
self . assertEqual ( str ( e . exception ), 'Player.action must be an empty list or a list of action types' )
+
+
# test functional
+
def test_functional_true ( self ):
+
# functional can only be a boolean
+
self . player . functional = True
+
self . functional = True
+
self . assertEqual ( self . player . functional , self . functional )
+
+
#
+
def test_functional_false ( self ):
+
self . player . functional = False
+
self . functional = False
+
self . assertEqual ( self . player . functional , self . functional )
+
+
def test_functional_fail_int ( self ):
+
with self . assertRaises ( ValueError ) as e :
+
self . player . functional = "Strig"
+
self . assertEqual ( str ( e . exception ), 'Player.functional must be a boolean' )
+
+
# team name
+
def test_team_name ( self ):
+
# if it is a string it passes
+
self . team_name = ""
+
self . player . team_name = ""
+
self . assertEqual ( self . player . team_name , self . team_name )
+
+
def test_team_name_none ( self ):
+
# if it is none it passes
+
self . team_name = None
+
self . assertEqual ( self . player . team_name , self . team_name )
+
+
def test_team_name_fail_int ( self ):
+
# if it is not a string it fails
+
with self . assertRaises ( ValueError ) as e :
+
self . player . team_name = 1
+
self . assertEqual ( str ( e . exception ), 'Player.team_name must be a String or None' )
+
+
# test avatar
+
def test_avatar ( self ):
+
self . avatar = Avatar ()
+
self . player . avatar = self . avatar
+
self . assertEqual ( self . player . avatar , self . avatar )
+
+
def test_avatar_none ( self ):
+
self . avatar = None
+
self . assertEqual ( self . player . avatar , self . avatar )
+
+
def test_avatar_fail_string ( self ):
+
with self . assertRaises ( ValueError ) as e :
+
self . player . avatar = 10
+
self . assertEqual ( str ( e . exception ), 'Player.avatar must be Avatar or None' )
+
+
# test object type
+
def test_object_type ( self ):
+
# object type only accepts object type
+
self . object_type = ObjectType . PLAYER
+
self . player . object_type = self . object_type
+
self . assertEqual ( self . player . object_type , self . object_type )
+
+
def test_object_type_fail_none ( self ):
+
with self . assertRaises ( ValueError ) as e :
+
self . player . object_type = None
+
self . assertEqual ( str ( e . exception ), 'Player.object_type must be ObjectType' )
+
+
def test_object_type_fail_int ( self ):
+
with self . assertRaises ( ValueError ) as e :
+
self . player . object_type = 10
+
self . assertEqual ( str ( e . exception ), 'Player.object_type must be ObjectType' )
+
+
# test to json
+
def test_player_json ( self ):
+
data : dict = self . player . to_json ()
+
player : Player = Player () . from_json ( data )
+
self . assertEqual ( self . player . object_type , player . object_type )
+
self . assertEqual ( self . player . functional , player . functional )
+
self . assertEqual ( self . player . team_name , player . team_name )
+
self . assertEqual ( self . player . actions , player . actions )
+
self . assertEqual ( self . player . avatar , player . avatar )
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/test_suite/tests/test_station.html b/docs/_modules/game/test_suite/tests/test_station.html
new file mode 100644
index 0000000..b15f3a8
--- /dev/null
+++ b/docs/_modules/game/test_suite/tests/test_station.html
@@ -0,0 +1,307 @@
+
+
+
+
+
+
+
+ game.test_suite.tests.test_station - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.test_suite.tests.test_station
+import unittest
+
+from game.common.stations.station import Station
+from game.common.stations.station_example import StationExample
+from game.common.items.item import Item
+from game.controllers.inventory_controller import InventoryController
+from game.common.avatar import Avatar
+from game.common.player import Player
+from game.common.map.game_board import GameBoard
+from game.utils.vector import Vector
+from game.common.enums import ActionType
+from game.common.enums import ObjectType
+
+# class that tests stations and its methods
+[docs] class TestStation ( unittest . TestCase ):
+
"""
+
`Test Station Example Notes:`
+
+
This class tests the different methods in the Station Example class. This is used to show how Stations could
+
work and how they can be tested.
+
"""
+
+
[docs] def setUp ( self ) -> None :
+
self . station = Station ()
+
self . item = Item ( 10 , None , 2 , 64 )
+
self . station_example = StationExample ( self . item )
+
self . avatar = Avatar ( Vector ( 2 , 2 ), 10 )
+
self . inventory : list [ Item ] = [ Item ( 0 ), Item ( 1 ), Item ( 2 ), Item ( 3 ), Item ( 4 ), Item ( 5 ), Item ( 6 ), Item ( 7 ), Item ( 8 ), Item ( 9 )]
+
self . player = Player ( avatar = self . avatar )
+
self . avatar . inventory = self . inventory
+
self . game_board = GameBoard ( None , Vector ( 4 , 4 ), None , False )
+
self . inventory_controller = InventoryController ()
+
+
# test adding item to station
+
def test_item_occ ( self ):
+
self . station . held_item = self . item
+
self . assertEqual ( self . station . held_item . object_type , ObjectType . ITEM )
+
+
# test adding something not an item
+
def test_item_occ_fail ( self ):
+
with self . assertRaises ( ValueError ) as e :
+
self . station . held_item = 'wow'
+
self . assertEqual ( str ( e . exception ), 'Station.held_item must be an Item or None, not wow.' )
+
+
# test base take action method works
+
def test_take_action ( self ):
+
self . inventory_controller . handle_actions ( ActionType . SELECT_SLOT_0 , self . player , self . game_board )
+
self . station_example . take_action ( self . avatar )
+
self . assertEqual ( self . avatar . held_item . object_type , self . item . object_type )
+
+
# test json method
+
def test_json ( self ):
+
self . station . held_item = self . item
+
data : dict = self . station . to_json ()
+
station : Station = Station () . from_json ( data )
+
self . assertEqual ( self . station . object_type , station . object_type )
+
self . assertEqual ( self . station . held_item . object_type , station . held_item . object_type )
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/test_suite/tests/test_tile.html b/docs/_modules/game/test_suite/tests/test_tile.html
new file mode 100644
index 0000000..5cb08dd
--- /dev/null
+++ b/docs/_modules/game/test_suite/tests/test_tile.html
@@ -0,0 +1,311 @@
+
+
+
+
+
+
+
+ game.test_suite.tests.test_tile - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.test_suite.tests.test_tile
+import unittest
+
+from game.common.map.tile import Tile
+from game.common.map.wall import Wall
+from game.common.stations.station import Station
+from game.common.stations.occupiable_station import OccupiableStation
+from game.common.avatar import Avatar
+from game.common.enums import ObjectType
+
+
+[docs] class TestTile ( unittest . TestCase ):
+
"""
+
`Test Tile Notes:`
+
+
This class tests the different methods in the Tile class.
+
"""
+
[docs] def setUp ( self ) -> None :
+
self . tile : Tile = Tile ()
+
self . wall : Wall = Wall ()
+
self . station : Station = Station ()
+
self . occupiable_station : OccupiableStation = OccupiableStation ()
+
self . avatar : Avatar = Avatar ()
+
+
# test adding avatar to tile
+
def test_avatar_tile ( self ):
+
self . tile . occupied_by = self . avatar
+
self . assertEqual ( self . tile . occupied_by . object_type , ObjectType . AVATAR )
+
+
# test adding station to tile
+
def test_station_tile ( self ):
+
self . tile . occupied_by = self . station
+
self . assertEqual ( self . tile . occupied_by . object_type , ObjectType . STATION )
+
+
# test adding occupiable_station to tile
+
def test_occupiable_station_tile ( self ):
+
self . tile . occupied_by = self . occupiable_station
+
self . assertEqual ( self . tile . occupied_by . object_type , ObjectType . OCCUPIABLE_STATION )
+
+
# test aadding wall to tile
+
def test_wall_tile ( self ):
+
self . tile . occupied_by = self . wall
+
self . assertEqual ( self . tile . occupied_by . object_type , ObjectType . WALL )
+
+
# test json method
+
def test_tile_json ( self ):
+
self . tile . occupied_by = self . station
+
data : dict = self . tile . to_json ()
+
tile : Tile = Tile () . from_json ( data )
+
self . assertEqual ( self . tile . object_type , tile . object_type )
+
self . assertEqual ( self . tile . occupied_by . object_type , tile . occupied_by . object_type )
+
+
# test if json is correct when nested tile
+
def test_nested_tile_json ( self ):
+
self . occupiable_station . occupied_by = self . avatar
+
self . tile . occupied_by = self . occupiable_station
+
data : dict = self . tile . to_json ()
+
tile : Tile = Tile () . from_json ( data )
+
self . assertEqual ( self . tile . object_type , tile . object_type )
+
self . assertEqual ( self . tile . occupied_by . object_type , tile . occupied_by . object_type )
+
assert ( isinstance ( tile . occupied_by , OccupiableStation ))
+
self . assertEqual ( self . tile . occupied_by . occupied_by . object_type , tile . occupied_by . occupied_by . object_type )
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/utils/generate_game.html b/docs/_modules/game/utils/generate_game.html
new file mode 100644
index 0000000..92ee8d4
--- /dev/null
+++ b/docs/_modules/game/utils/generate_game.html
@@ -0,0 +1,282 @@
+
+
+
+
+
+
+
+ game.utils.generate_game - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.utils.generate_game
+import random
+from game.common.avatar import Avatar
+from game.utils.vector import Vector
+from game.config import *
+from game.utils.helpers import write_json_file
+from game.common.map.game_board import GameBoard
+
+
+[docs] def generate ( seed : int = random . randint ( 0 , 1000000000 )):
+
"""
+
This method is what generates the game_map. This method is slow, so be mindful when using it. A seed can be set as
+
the parameter; otherwise, a random one will be generated. Then, the method checks to make sure the location for
+
storing logs exists. Lastly, the game map is written to the game file.
+
:param seed:
+
:return: None
+
"""
+
+
print ( 'Generating game map...' )
+
+
temp : GameBoard = GameBoard ( seed , map_size = Vector ( 6 , 6 ), locations = {( Vector ( 1 , 1 ),): [ Avatar ()],
+
( Vector ( 4 , 4 ),): [ Avatar ()]}, walled = True )
+
temp . generate_map ()
+
data : dict = { 'game_board' : temp . to_json ()}
+
# for x in range(1, MAX_TICKS + 1):
+
# data[x] = 'data'
+
+
# Verify logs location exists
+
if not os . path . exists ( GAME_MAP_DIR ):
+
os . mkdir ( GAME_MAP_DIR )
+
+
# Write game map to file
+
write_json_file ( data , GAME_MAP_FILE )
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/utils/helpers.html b/docs/_modules/game/utils/helpers.html
new file mode 100644
index 0000000..b992842
--- /dev/null
+++ b/docs/_modules/game/utils/helpers.html
@@ -0,0 +1,260 @@
+
+
+
+
+
+
+
+ game.utils.helpers - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.utils.helpers
+import json
+
+
+[docs] def write_json_file ( data , filename ):
+
"""
+
This file contain the method ``write_json_file``. It opens the a file with the given name and writes all the given data
+
to the file.
+
"""
+
with open ( filename , 'w' ) as f :
+
json . dump ( data , f , indent = ' \t ' )
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/utils/thread.html b/docs/_modules/game/utils/thread.html
new file mode 100644
index 0000000..87426bb
--- /dev/null
+++ b/docs/_modules/game/utils/thread.html
@@ -0,0 +1,311 @@
+
+
+
+
+
+
+
+ game.utils.thread - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.utils.thread
+import threading
+import traceback
+
+
+[docs] class Thread ( threading . Thread ):
+
"""
+
`Thread Class Notes:`
+
Threads are how the engine communicates with user clients. These Threads are built to catch errors. If an error
+
is caught, it will be logged, but the program will continue to run.
+
+
If multithreading is needed for whatever reason, this class would be used for that.
+
"""
+
def __init__ ( self , func , args ):
+
threading . Thread . __init__ ( self )
+
self . args = args
+
self . func = func
+
self . error = None
+
+
[docs] def run ( self ):
+
try :
+
self . func ( * self . args )
+
except Exception :
+
self . error = traceback . format_exc ()
+
+
+[docs] class CommunicationThread ( Thread ):
+
"""
+
`Communication Thread Class Notes:`
+
+
Communication Threads are bulkier than normal Threads. It also has error catching functionality, but tends
+
to be used for single-use, single-variable communication.
+
+
For example, if a client tries to use malicious code in any methods, a Communication Thread is used to check
+
any given parameters and throw an error if the type needed does not match what is given.
+
+
Communication Threads use a nested class to make the return value of the Communication Thread private. It helps
+
to keep things secure. This is now achieved through getter and setter decorators. Since the code here was
+
written long ago, the structure is different. For future note, use getter and setter decorators as needed.
+
"""
+
def __init__ ( self , func , args = None , variable_type = None ):
+
super () . __init__ ( func , args )
+
self . type = variable_type
+
+
class InternalObject :
+
def __init__ ( self ):
+
self . value = None
+
+
self . safeObject = InternalObject ()
+
+
[docs] def run ( self ):
+
try :
+
self . safeObject . value = self . func ( * self . args )
+
except Exception :
+
self . error = traceback . format_exc ()
+
+
if self . type is not None and not isinstance ( self . safeObject . value , self . type ):
+
self . safeObject . value = None
+
+
def retrieve_value ( self ):
+
return self . safeObject . value
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/utils/validation.html b/docs/_modules/game/utils/validation.html
new file mode 100644
index 0000000..f2053e7
--- /dev/null
+++ b/docs/_modules/game/utils/validation.html
@@ -0,0 +1,316 @@
+
+
+
+
+
+
+
+ game.utils.validation - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.utils.validation
+import parsec
+import re
+
+from game.config import ALLOWED_MODULES
+
+
+[docs] def verify_code ( filename , already_string = False ):
+
"""
+
This file is used to verify a client's code. It helps to prevent certain attempts at purposefully interfering with the
+
code and competition.
+
"""
+
contents = None
+
+
if already_string :
+
contents = filename
+
else :
+
with open ( filename , 'r' ) as f :
+
contents = f . read ()
+
+
contents = contents . split ( ' \n ' )
+
+
illegal_imports = list ()
+
uses_open = False
+
uses_print = False
+
+
for line in contents :
+
line = re . split ( '[ ;]' , line )
+
for token in line :
+
if '#' in token :
+
break
+
+
# Check for illegal keywords
+
if 'from' in token :
+
module = line [ line . index ( 'from' ) + 1 ]
+
if module not in ALLOWED_MODULES :
+
illegal_imports . append ( module )
+
else :
+
break
+
elif 'import' in token :
+
module = line [ line . index ( 'import' ) + 1 ]
+
if module not in ALLOWED_MODULES :
+
illegal_imports . append ( module )
+
else :
+
break
+
if 'open' in token :
+
uses_open = True
+
+
if 'print' in token :
+
uses_print = True
+
+
return ( illegal_imports , uses_open , uses_print )
+
+def verify_num_clients ( clients , set_clients , min_clients , max_clients ):
+ res = None
+ # Verify correct number of clients
+ if set_clients is not None and len ( clients ) != set_clients :
+ res = ValueError ( "Number of clients is not the set value. \n "
+ "Number of clients: " + str ( len ( clients )) + " | Set number: " + str ( set_clients ))
+ elif min_clients is not None and len ( clients ) < min_clients :
+ res = ValueError ( "Number of clients is less than the minimum required. \n "
+ "Number of clients: " + str ( len ( clients )) + " | Minimum: " + str ( min_clients ))
+ elif max_clients is not None and len ( clients ) > max_clients :
+ res = ValueError ( "Number of clients exceeds the maximum allowed. \n "
+ "Number of clients: " + str ( len ( clients )) + " | Maximum: " + str ( max_clients ))
+
+ return res
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/game/utils/vector.html b/docs/_modules/game/utils/vector.html
new file mode 100644
index 0000000..4edd924
--- /dev/null
+++ b/docs/_modules/game/utils/vector.html
@@ -0,0 +1,380 @@
+
+
+
+
+
+
+
+ game.utils.vector - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ Source code for game.utils.vector
+from game.common.game_object import GameObject
+from game.common.enums import ObjectType
+from typing import Self , Tuple
+
+
+[docs] class Vector ( GameObject ):
+
"""
+
`Vector Class Notes:`
+
+
This class is used universally in the project to handle anything related to coordinates. There are a few useful
+
methods here to help in a few situations.
+
+
-----
+
+
Add Vectors Method:
+
This method will take two Vector objects, combine their (x, y) coordinates, and return a new Vector object.
+
+
Example:
+
vector_1: (1, 1)
+
vector_2: (1, 1)
+
+
Result:
+
vector_result: (2, 2)
+
+
-----
+
+
Add to Vector method:
+
This method will take a different Vector object and add it to the current Self reference; that is, this method
+
belongs to a Vector object and is not static.
+
+
Example:
+
self_vector: (0, 0)
+
vector_1: (1, 3)
+
+
Result:
+
self_vector: (1, 3)
+
+
-----
+
+
Add X and Add Y methods:
+
These methods act similarly to the ``add_vector()`` method, but instead of changing both the x and y, these
+
methods change their respective variables.
+
+
Add X Example:
+
self_vector: (0, 0)
+
vector_1: (1, 3)
+
+
Result:
+
self_vector: (1, 0)
+
+
Add Y Example:
+
self_vector: (0, 0)
+
vector_1: (1, 3)
+
+
Result:
+
self_vector: (0, 3)
+
+
-----
+
+
As Tuple Method:
+
This method returns a tuple of the Vector object in the form of (x, y). This is to help with storing it easily
+
or accessing it in an immutable structure.
+
"""
+
+
def __init__ ( self , x : int = 0 , y : int = 0 ):
+
super () . __init__ ()
+
self . object_type : ObjectType = ObjectType . VECTOR
+
self . x = x
+
self . y = y
+
+
@property
+
def x ( self ) -> int :
+
return self . __x
+
+
@x . setter
+
def x ( self , x : int ) -> None :
+
if x is None or not isinstance ( x , int ):
+
raise ValueError ( f "The given x value, { x } , is not an integer." )
+
self . __x = x
+
+
@property
+
def y ( self ) -> int :
+
return self . __y
+
+
@y . setter
+
def y ( self , y : int ) -> None :
+
if y is None or not isinstance ( y , int ):
+
raise ValueError ( f "The given y value, { y } , is not an integer." )
+
self . __y = y
+
+
@staticmethod
+
def add_vectors ( vector_1 : 'Vector' , vector_2 : 'Vector' ) -> 'Vector' :
+
new_x : int = vector_1 . x + vector_2 . x
+
new_y : int = vector_1 . y + vector_2 . y
+
return Vector ( new_x , new_y )
+
+
def add_to_vector ( self , other_vector : Self ) -> None :
+
self . x += other_vector . x
+
self . y += other_vector . y
+
+
def add_x_y ( self , x : int , y : int ) -> None :
+
self . x += x
+
self . y += y
+
+
def add_x ( self , x : int ) -> None :
+
self . x += x
+
+
def add_y ( self , y : int ) -> None :
+
self . y += y
+
+
[docs] def as_tuple ( self ) -> Tuple [ int , int ]:
+
"""Returns (x: int, y: int)"""
+
return ( self . x , self . y )
+
+
def to_json ( self ) -> dict :
+
data = super () . to_json ()
+
data [ 'x' ] = self . x
+
data [ 'y' ] = self . y
+
+
return data
+
+
def from_json ( self , data ) -> Self :
+
super () . from_json ( data )
+
self . x = data [ 'x' ]
+
self . y = data [ 'y' ]
+
+
return self
+
+
def __str__ ( self ) -> str :
+
return f "Coordinates: ( { self . x } , { self . y } )"
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_modules/index.html b/docs/_modules/index.html
new file mode 100644
index 0000000..4ad1fce
--- /dev/null
+++ b/docs/_modules/index.html
@@ -0,0 +1,287 @@
+
+
+
+
+
+
+
+ Overview: module code - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+ All modules for which code is available
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_sources/base_client.rst.txt b/docs/_sources/base_client.rst.txt
new file mode 100644
index 0000000..95f6fe2
--- /dev/null
+++ b/docs/_sources/base_client.rst.txt
@@ -0,0 +1,7 @@
+Base Client
+===========
+
+.. automodule:: base_client
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/_sources/base_client_2.rst.txt b/docs/_sources/base_client_2.rst.txt
new file mode 100644
index 0000000..d731fbf
--- /dev/null
+++ b/docs/_sources/base_client_2.rst.txt
@@ -0,0 +1,7 @@
+Base Client 2
+=============
+
+.. automodule:: base_client_2
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/_sources/game.client.rst.txt b/docs/_sources/game.client.rst.txt
new file mode 100644
index 0000000..bfa55b4
--- /dev/null
+++ b/docs/_sources/game.client.rst.txt
@@ -0,0 +1,10 @@
+Client Package
+===================
+
+User Client
+-----------
+
+.. automodule:: game.client.user_client
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
diff --git a/docs/_sources/game.common.items.rst.txt b/docs/_sources/game.common.items.rst.txt
new file mode 100644
index 0000000..7aaf488
--- /dev/null
+++ b/docs/_sources/game.common.items.rst.txt
@@ -0,0 +1,10 @@
+Items Package
+=============
+
+Item Class
+----------
+
+.. automodule:: game.common.items.item
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
diff --git a/docs/_sources/game.common.map.rst.txt b/docs/_sources/game.common.map.rst.txt
new file mode 100644
index 0000000..eaf0ec5
--- /dev/null
+++ b/docs/_sources/game.common.map.rst.txt
@@ -0,0 +1,35 @@
+Map Package
+===========
+
+Gameboard Class
+---------------
+
+.. automodule:: game.common.map.game_board
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+Occupiable Class
+----------------
+
+.. automodule:: game.common.map.occupiable
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+Tile Class
+----------
+
+.. automodule:: game.common.map.tile
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+Wall Class
+----------
+
+.. automodule:: game.common.map.wall
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
diff --git a/docs/_sources/game.common.rst.txt b/docs/_sources/game.common.rst.txt
new file mode 100644
index 0000000..a040a24
--- /dev/null
+++ b/docs/_sources/game.common.rst.txt
@@ -0,0 +1,62 @@
+Common Package
+==============
+
+.. toctree::
+ :maxdepth: 4
+
+ game.common.items
+ game.common.map
+ game.common.stations
+
+Action Class
+------------
+
+.. automodule:: game.common.action
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Avatar Class
+------------
+
+.. automodule:: game.common.avatar
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Enums File
+----------
+
+**NOTE:** The use of the enum structure is to make is easier to execute certain tasks. It also helps with
+identifying types of Objects throughout the project.
+
+When developing the game, add any extra enums as necessary.
+
+.. automodule:: game.common.enums
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+GameObject Class
+----------------
+
+.. automodule:: game.common.game_object
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Player Class
+------------
+
+.. automodule:: game.common.player
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
diff --git a/docs/_sources/game.common.stations.rst.txt b/docs/_sources/game.common.stations.rst.txt
new file mode 100644
index 0000000..6f56b13
--- /dev/null
+++ b/docs/_sources/game.common.stations.rst.txt
@@ -0,0 +1,50 @@
+Stations Package
+================
+
+Occupiable Station Class
+------------------------
+
+.. automodule:: game.common.stations.occupiable_station
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Occupiable Station Example Class
+--------------------------------
+
+.. automodule:: game.common.stations.occupiable_station_example
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Station Class
+-------------
+
+.. automodule:: game.common.stations.station
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Station Example Class
+---------------------
+
+.. automodule:: game.common.stations.station_example
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Station Receiver Example Class
+------------------------------
+
+.. automodule:: game.common.stations.station_receiver_example
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
diff --git a/docs/_sources/game.controllers.rst.txt b/docs/_sources/game.controllers.rst.txt
new file mode 100644
index 0000000..87a3823
--- /dev/null
+++ b/docs/_sources/game.controllers.rst.txt
@@ -0,0 +1,50 @@
+Controllers Package
+========================
+
+Controller Class
+----------------
+
+.. automodule:: game.controllers.controller
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Interact Controller Class
+-------------------------
+
+.. automodule:: game.controllers.interact_controller
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Inventory Controller Class
+--------------------------
+
+.. automodule:: game.controllers.inventory_controller
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Master Controller Class
+-----------------------
+
+.. automodule:: game.controllers.master_controller
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Movement Controller Class
+-------------------------
+
+.. automodule:: game.controllers.movement_controller
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
diff --git a/docs/_sources/game.rst.txt b/docs/_sources/game.rst.txt
new file mode 100644
index 0000000..74da087
--- /dev/null
+++ b/docs/_sources/game.rst.txt
@@ -0,0 +1,10 @@
+Game Package Contents
+=====================
+
+.. toctree::
+ :maxdepth: 4
+
+ game.common
+ game.controllers
+ game.test_suite
+ game.utils
diff --git a/docs/_sources/game.test_suite.rst.txt b/docs/_sources/game.test_suite.rst.txt
new file mode 100644
index 0000000..e2f6b72
--- /dev/null
+++ b/docs/_sources/game.test_suite.rst.txt
@@ -0,0 +1,15 @@
+Test Suite Package
+==================
+
+.. toctree::
+ :maxdepth: 4
+
+ game.test_suite.tests
+
+Runner.py File
+--------------
+
+.. automodule:: game.test_suite.runner
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
diff --git a/docs/_sources/game.test_suite.tests.rst.txt b/docs/_sources/game.test_suite.tests.rst.txt
new file mode 100644
index 0000000..c9837ea
--- /dev/null
+++ b/docs/_sources/game.test_suite.tests.rst.txt
@@ -0,0 +1,190 @@
+Tests Package
+=============
+
+Test Example File
+-----------------
+
+.. automodule:: game.test_suite.tests.test_example
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Avatar Class
+-----------------
+
+.. automodule:: game.test_suite.tests.test_avatar
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Avatar Inventory
+---------------------
+
+.. automodule:: game.test_suite.tests.test_avatar_inventory
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Gameboard Class
+--------------------
+
+.. automodule:: game.test_suite.tests.test_game_board
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Gameboard (No Generation)
+------------------------------
+
+.. automodule:: game.test_suite.tests.test_game_board_no_gen
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Initialization File
+------------------------
+
+.. automodule:: game.test_suite.tests.test_initialization
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Interact Controller File
+-----------------------------
+
+.. automodule:: game.test_suite.tests.test_interact_controller
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Inventory Controller Class
+-------------------------------
+
+.. automodule:: game.test_suite.tests.test_inventory_controller
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Item Class
+---------------
+
+.. automodule:: game.test_suite.tests.test_item
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Master Controller Class
+----------------------------
+
+.. automodule:: game.test_suite.tests.test_master_controller
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Movement Controller Class
+------------------------------
+
+.. automodule:: game.test_suite.tests.test_movement_controller
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Movement Controller with Occupiable Stations the Avatar can Occupy
+-----------------------------------------------------------------------
+
+.. automodule:: game.test_suite.tests.test_movement_controller_if_occupiable_station_is_occupiable
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Movement Controller with Occupiable Stations
+-------------------------------------------------
+
+.. automodule:: game.test_suite.tests.test_movement_controller_if_occupiable_stations
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Movement Controller with Stations the Avatar Occupy
+--------------------------------------------------------
+
+.. automodule:: game.test_suite.tests.test_movement_controller_if_stations
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Movement Controller with Walls
+-----------------------------------
+
+.. automodule:: game.test_suite.tests.test_movement_controller_if_wall
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Occupiable Station Class
+-----------------------------
+
+.. automodule:: game.test_suite.tests.test_occupiable_station
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Player Class
+-----------------
+
+.. automodule:: game.test_suite.tests.test_player
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Station Class
+------------------
+
+.. automodule:: game.test_suite.tests.test_station
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Tile Class
+---------------
+
+.. automodule:: game.test_suite.tests.test_tile
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
diff --git a/docs/_sources/game.utils.rst.txt b/docs/_sources/game.utils.rst.txt
new file mode 100644
index 0000000..4a31a55
--- /dev/null
+++ b/docs/_sources/game.utils.rst.txt
@@ -0,0 +1,50 @@
+Utils Package
+=============
+
+Generate Game
+-------------
+
+.. automodule:: game.utils.generate_game
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Helpers
+-------
+
+.. automodule:: game.utils.helpers
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Thread
+------
+
+.. automodule:: game.utils.thread
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Validation
+----------
+
+.. automodule:: game.utils.validation
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Vector
+------
+
+.. automodule:: game.utils.vector
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
diff --git a/docs/_sources/index.rst.txt b/docs/_sources/index.rst.txt
new file mode 100644
index 0000000..0c03f2a
--- /dev/null
+++ b/docs/_sources/index.rst.txt
@@ -0,0 +1,36 @@
+.. Byte Engine documentation master file, created by
+ sphinx-quickstart on Fri Jul 21 23:39:22 2023.
+ You can adapt this file completely to your liking, but it should at least
+ contain the root `toctree` directive.
+
+=============================================
+Welcome to NDACM's Byte Engine Documentation!
+=============================================
+
+NDSU's ACM chapter hosts an annual competition called "Byte-le Royale." This competition was created by Riley Conlin,
+Jordan Goetze, Jacob Baumann, Ajay Brown, and Nick Hilger. It promotes working with others and developing critical
+thinking skills, while challenging competitors under a time limit.
+
+This project provides the framework for developing games for Byte-le. The README document is attached to this page.
+Refer to that for additional info to what's here!
+
+
+README Document
+===============
+
+.. include:: ../../../README.md
+ :parser: myst_parser.sphinx_
+
+-----
+
+.. toctree::
+ game
+
+-----
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
diff --git a/docs/_sources/modules.rst.txt b/docs/_sources/modules.rst.txt
new file mode 100644
index 0000000..38a26f2
--- /dev/null
+++ b/docs/_sources/modules.rst.txt
@@ -0,0 +1,9 @@
+byte_le_engine
+==============
+
+.. toctree::
+ :maxdepth: 4
+
+ base_client
+ base_client_2
+ game
diff --git a/docs/_sources/readme.rst.txt b/docs/_sources/readme.rst.txt
new file mode 100644
index 0000000..34bb02e
--- /dev/null
+++ b/docs/_sources/readme.rst.txt
@@ -0,0 +1,4 @@
+README File
+===========
+
+.. include:: ../../../README.md
\ No newline at end of file
diff --git a/docs/_static/basic.css b/docs/_static/basic.css
new file mode 100644
index 0000000..7577acb
--- /dev/null
+++ b/docs/_static/basic.css
@@ -0,0 +1,903 @@
+/*
+ * basic.css
+ * ~~~~~~~~~
+ *
+ * Sphinx stylesheet -- basic theme.
+ *
+ * :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
+ * :license: BSD, see LICENSE for details.
+ *
+ */
+
+/* -- main layout ----------------------------------------------------------- */
+
+div.clearer {
+ clear: both;
+}
+
+div.section::after {
+ display: block;
+ content: '';
+ clear: left;
+}
+
+/* -- relbar ---------------------------------------------------------------- */
+
+div.related {
+ width: 100%;
+ font-size: 90%;
+}
+
+div.related h3 {
+ display: none;
+}
+
+div.related ul {
+ margin: 0;
+ padding: 0 0 0 10px;
+ list-style: none;
+}
+
+div.related li {
+ display: inline;
+}
+
+div.related li.right {
+ float: right;
+ margin-right: 5px;
+}
+
+/* -- sidebar --------------------------------------------------------------- */
+
+div.sphinxsidebarwrapper {
+ padding: 10px 5px 0 10px;
+}
+
+div.sphinxsidebar {
+ float: left;
+ width: 230px;
+ margin-left: -100%;
+ font-size: 90%;
+ word-wrap: break-word;
+ overflow-wrap : break-word;
+}
+
+div.sphinxsidebar ul {
+ list-style: none;
+}
+
+div.sphinxsidebar ul ul,
+div.sphinxsidebar ul.want-points {
+ margin-left: 20px;
+ list-style: square;
+}
+
+div.sphinxsidebar ul ul {
+ margin-top: 0;
+ margin-bottom: 0;
+}
+
+div.sphinxsidebar form {
+ margin-top: 10px;
+}
+
+div.sphinxsidebar input {
+ border: 1px solid #98dbcc;
+ font-family: sans-serif;
+ font-size: 1em;
+}
+
+div.sphinxsidebar #searchbox form.search {
+ overflow: hidden;
+}
+
+div.sphinxsidebar #searchbox input[type="text"] {
+ float: left;
+ width: 80%;
+ padding: 0.25em;
+ box-sizing: border-box;
+}
+
+div.sphinxsidebar #searchbox input[type="submit"] {
+ float: left;
+ width: 20%;
+ border-left: none;
+ padding: 0.25em;
+ box-sizing: border-box;
+}
+
+
+img {
+ border: 0;
+ max-width: 100%;
+}
+
+/* -- search page ----------------------------------------------------------- */
+
+ul.search {
+ margin: 10px 0 0 20px;
+ padding: 0;
+}
+
+ul.search li {
+ padding: 5px 0 5px 20px;
+ background-image: url(file.png);
+ background-repeat: no-repeat;
+ background-position: 0 7px;
+}
+
+ul.search li a {
+ font-weight: bold;
+}
+
+ul.search li p.context {
+ color: #888;
+ margin: 2px 0 0 30px;
+ text-align: left;
+}
+
+ul.keywordmatches li.goodmatch a {
+ font-weight: bold;
+}
+
+/* -- index page ------------------------------------------------------------ */
+
+table.contentstable {
+ width: 90%;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+table.contentstable p.biglink {
+ line-height: 150%;
+}
+
+a.biglink {
+ font-size: 1.3em;
+}
+
+span.linkdescr {
+ font-style: italic;
+ padding-top: 5px;
+ font-size: 90%;
+}
+
+/* -- general index --------------------------------------------------------- */
+
+table.indextable {
+ width: 100%;
+}
+
+table.indextable td {
+ text-align: left;
+ vertical-align: top;
+}
+
+table.indextable ul {
+ margin-top: 0;
+ margin-bottom: 0;
+ list-style-type: none;
+}
+
+table.indextable > tbody > tr > td > ul {
+ padding-left: 0em;
+}
+
+table.indextable tr.pcap {
+ height: 10px;
+}
+
+table.indextable tr.cap {
+ margin-top: 10px;
+ background-color: #f2f2f2;
+}
+
+img.toggler {
+ margin-right: 3px;
+ margin-top: 3px;
+ cursor: pointer;
+}
+
+div.modindex-jumpbox {
+ border-top: 1px solid #ddd;
+ border-bottom: 1px solid #ddd;
+ margin: 1em 0 1em 0;
+ padding: 0.4em;
+}
+
+div.genindex-jumpbox {
+ border-top: 1px solid #ddd;
+ border-bottom: 1px solid #ddd;
+ margin: 1em 0 1em 0;
+ padding: 0.4em;
+}
+
+/* -- domain module index --------------------------------------------------- */
+
+table.modindextable td {
+ padding: 2px;
+ border-collapse: collapse;
+}
+
+/* -- general body styles --------------------------------------------------- */
+
+div.body {
+ min-width: 360px;
+ max-width: 800px;
+}
+
+div.body p, div.body dd, div.body li, div.body blockquote {
+ -moz-hyphens: auto;
+ -ms-hyphens: auto;
+ -webkit-hyphens: auto;
+ hyphens: auto;
+}
+
+a.headerlink {
+ visibility: hidden;
+}
+
+h1:hover > a.headerlink,
+h2:hover > a.headerlink,
+h3:hover > a.headerlink,
+h4:hover > a.headerlink,
+h5:hover > a.headerlink,
+h6:hover > a.headerlink,
+dt:hover > a.headerlink,
+caption:hover > a.headerlink,
+p.caption:hover > a.headerlink,
+div.code-block-caption:hover > a.headerlink {
+ visibility: visible;
+}
+
+div.body p.caption {
+ text-align: inherit;
+}
+
+div.body td {
+ text-align: left;
+}
+
+.first {
+ margin-top: 0 !important;
+}
+
+p.rubric {
+ margin-top: 30px;
+ font-weight: bold;
+}
+
+img.align-left, figure.align-left, .figure.align-left, object.align-left {
+ clear: left;
+ float: left;
+ margin-right: 1em;
+}
+
+img.align-right, figure.align-right, .figure.align-right, object.align-right {
+ clear: right;
+ float: right;
+ margin-left: 1em;
+}
+
+img.align-center, figure.align-center, .figure.align-center, object.align-center {
+ display: block;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+img.align-default, figure.align-default, .figure.align-default {
+ display: block;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+.align-left {
+ text-align: left;
+}
+
+.align-center {
+ text-align: center;
+}
+
+.align-default {
+ text-align: center;
+}
+
+.align-right {
+ text-align: right;
+}
+
+/* -- sidebars -------------------------------------------------------------- */
+
+div.sidebar,
+aside.sidebar {
+ margin: 0 0 0.5em 1em;
+ border: 1px solid #ddb;
+ padding: 7px;
+ background-color: #ffe;
+ width: 40%;
+ float: right;
+ clear: right;
+ overflow-x: auto;
+}
+
+p.sidebar-title {
+ font-weight: bold;
+}
+
+nav.contents,
+aside.topic,
+div.admonition, div.topic, blockquote {
+ clear: left;
+}
+
+/* -- topics ---------------------------------------------------------------- */
+
+nav.contents,
+aside.topic,
+div.topic {
+ border: 1px solid #ccc;
+ padding: 7px;
+ margin: 10px 0 10px 0;
+}
+
+p.topic-title {
+ font-size: 1.1em;
+ font-weight: bold;
+ margin-top: 10px;
+}
+
+/* -- admonitions ----------------------------------------------------------- */
+
+div.admonition {
+ margin-top: 10px;
+ margin-bottom: 10px;
+ padding: 7px;
+}
+
+div.admonition dt {
+ font-weight: bold;
+}
+
+p.admonition-title {
+ margin: 0px 10px 5px 0px;
+ font-weight: bold;
+}
+
+div.body p.centered {
+ text-align: center;
+ margin-top: 25px;
+}
+
+/* -- content of sidebars/topics/admonitions -------------------------------- */
+
+div.sidebar > :last-child,
+aside.sidebar > :last-child,
+nav.contents > :last-child,
+aside.topic > :last-child,
+div.topic > :last-child,
+div.admonition > :last-child {
+ margin-bottom: 0;
+}
+
+div.sidebar::after,
+aside.sidebar::after,
+nav.contents::after,
+aside.topic::after,
+div.topic::after,
+div.admonition::after,
+blockquote::after {
+ display: block;
+ content: '';
+ clear: both;
+}
+
+/* -- tables ---------------------------------------------------------------- */
+
+table.docutils {
+ margin-top: 10px;
+ margin-bottom: 10px;
+ border: 0;
+ border-collapse: collapse;
+}
+
+table.align-center {
+ margin-left: auto;
+ margin-right: auto;
+}
+
+table.align-default {
+ margin-left: auto;
+ margin-right: auto;
+}
+
+table caption span.caption-number {
+ font-style: italic;
+}
+
+table caption span.caption-text {
+}
+
+table.docutils td, table.docutils th {
+ padding: 1px 8px 1px 5px;
+ border-top: 0;
+ border-left: 0;
+ border-right: 0;
+ border-bottom: 1px solid #aaa;
+}
+
+th {
+ text-align: left;
+ padding-right: 5px;
+}
+
+table.citation {
+ border-left: solid 1px gray;
+ margin-left: 1px;
+}
+
+table.citation td {
+ border-bottom: none;
+}
+
+th > :first-child,
+td > :first-child {
+ margin-top: 0px;
+}
+
+th > :last-child,
+td > :last-child {
+ margin-bottom: 0px;
+}
+
+/* -- figures --------------------------------------------------------------- */
+
+div.figure, figure {
+ margin: 0.5em;
+ padding: 0.5em;
+}
+
+div.figure p.caption, figcaption {
+ padding: 0.3em;
+}
+
+div.figure p.caption span.caption-number,
+figcaption span.caption-number {
+ font-style: italic;
+}
+
+div.figure p.caption span.caption-text,
+figcaption span.caption-text {
+}
+
+/* -- field list styles ----------------------------------------------------- */
+
+table.field-list td, table.field-list th {
+ border: 0 !important;
+}
+
+.field-list ul {
+ margin: 0;
+ padding-left: 1em;
+}
+
+.field-list p {
+ margin: 0;
+}
+
+.field-name {
+ -moz-hyphens: manual;
+ -ms-hyphens: manual;
+ -webkit-hyphens: manual;
+ hyphens: manual;
+}
+
+/* -- hlist styles ---------------------------------------------------------- */
+
+table.hlist {
+ margin: 1em 0;
+}
+
+table.hlist td {
+ vertical-align: top;
+}
+
+/* -- object description styles --------------------------------------------- */
+
+.sig {
+ font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
+}
+
+.sig-name, code.descname {
+ background-color: transparent;
+ font-weight: bold;
+}
+
+.sig-name {
+ font-size: 1.1em;
+}
+
+code.descname {
+ font-size: 1.2em;
+}
+
+.sig-prename, code.descclassname {
+ background-color: transparent;
+}
+
+.optional {
+ font-size: 1.3em;
+}
+
+.sig-paren {
+ font-size: larger;
+}
+
+.sig-param.n {
+ font-style: italic;
+}
+
+/* C++ specific styling */
+
+.sig-inline.c-texpr,
+.sig-inline.cpp-texpr {
+ font-family: unset;
+}
+
+.sig.c .k, .sig.c .kt,
+.sig.cpp .k, .sig.cpp .kt {
+ color: #0033B3;
+}
+
+.sig.c .m,
+.sig.cpp .m {
+ color: #1750EB;
+}
+
+.sig.c .s, .sig.c .sc,
+.sig.cpp .s, .sig.cpp .sc {
+ color: #067D17;
+}
+
+
+/* -- other body styles ----------------------------------------------------- */
+
+ol.arabic {
+ list-style: decimal;
+}
+
+ol.loweralpha {
+ list-style: lower-alpha;
+}
+
+ol.upperalpha {
+ list-style: upper-alpha;
+}
+
+ol.lowerroman {
+ list-style: lower-roman;
+}
+
+ol.upperroman {
+ list-style: upper-roman;
+}
+
+:not(li) > ol > li:first-child > :first-child,
+:not(li) > ul > li:first-child > :first-child {
+ margin-top: 0px;
+}
+
+:not(li) > ol > li:last-child > :last-child,
+:not(li) > ul > li:last-child > :last-child {
+ margin-bottom: 0px;
+}
+
+ol.simple ol p,
+ol.simple ul p,
+ul.simple ol p,
+ul.simple ul p {
+ margin-top: 0;
+}
+
+ol.simple > li:not(:first-child) > p,
+ul.simple > li:not(:first-child) > p {
+ margin-top: 0;
+}
+
+ol.simple p,
+ul.simple p {
+ margin-bottom: 0;
+}
+
+aside.footnote > span,
+div.citation > span {
+ float: left;
+}
+aside.footnote > span:last-of-type,
+div.citation > span:last-of-type {
+ padding-right: 0.5em;
+}
+aside.footnote > p {
+ margin-left: 2em;
+}
+div.citation > p {
+ margin-left: 4em;
+}
+aside.footnote > p:last-of-type,
+div.citation > p:last-of-type {
+ margin-bottom: 0em;
+}
+aside.footnote > p:last-of-type:after,
+div.citation > p:last-of-type:after {
+ content: "";
+ clear: both;
+}
+
+dl.field-list {
+ display: grid;
+ grid-template-columns: fit-content(30%) auto;
+}
+
+dl.field-list > dt {
+ font-weight: bold;
+ word-break: break-word;
+ padding-left: 0.5em;
+ padding-right: 5px;
+}
+
+dl.field-list > dd {
+ padding-left: 0.5em;
+ margin-top: 0em;
+ margin-left: 0em;
+ margin-bottom: 0em;
+}
+
+dl {
+ margin-bottom: 15px;
+}
+
+dd > :first-child {
+ margin-top: 0px;
+}
+
+dd ul, dd table {
+ margin-bottom: 10px;
+}
+
+dd {
+ margin-top: 3px;
+ margin-bottom: 10px;
+ margin-left: 30px;
+}
+
+dl > dd:last-child,
+dl > dd:last-child > :last-child {
+ margin-bottom: 0;
+}
+
+dt:target, span.highlighted {
+ background-color: #fbe54e;
+}
+
+rect.highlighted {
+ fill: #fbe54e;
+}
+
+dl.glossary dt {
+ font-weight: bold;
+ font-size: 1.1em;
+}
+
+.versionmodified {
+ font-style: italic;
+}
+
+.system-message {
+ background-color: #fda;
+ padding: 5px;
+ border: 3px solid red;
+}
+
+.footnote:target {
+ background-color: #ffa;
+}
+
+.line-block {
+ display: block;
+ margin-top: 1em;
+ margin-bottom: 1em;
+}
+
+.line-block .line-block {
+ margin-top: 0;
+ margin-bottom: 0;
+ margin-left: 1.5em;
+}
+
+.guilabel, .menuselection {
+ font-family: sans-serif;
+}
+
+.accelerator {
+ text-decoration: underline;
+}
+
+.classifier {
+ font-style: oblique;
+}
+
+.classifier:before {
+ font-style: normal;
+ margin: 0 0.5em;
+ content: ":";
+ display: inline-block;
+}
+
+abbr, acronym {
+ border-bottom: dotted 1px;
+ cursor: help;
+}
+
+/* -- code displays --------------------------------------------------------- */
+
+pre {
+ overflow: auto;
+ overflow-y: hidden; /* fixes display issues on Chrome browsers */
+}
+
+pre, div[class*="highlight-"] {
+ clear: both;
+}
+
+span.pre {
+ -moz-hyphens: none;
+ -ms-hyphens: none;
+ -webkit-hyphens: none;
+ hyphens: none;
+ white-space: nowrap;
+}
+
+div[class*="highlight-"] {
+ margin: 1em 0;
+}
+
+td.linenos pre {
+ border: 0;
+ background-color: transparent;
+ color: #aaa;
+}
+
+table.highlighttable {
+ display: block;
+}
+
+table.highlighttable tbody {
+ display: block;
+}
+
+table.highlighttable tr {
+ display: flex;
+}
+
+table.highlighttable td {
+ margin: 0;
+ padding: 0;
+}
+
+table.highlighttable td.linenos {
+ padding-right: 0.5em;
+}
+
+table.highlighttable td.code {
+ flex: 1;
+ overflow: hidden;
+}
+
+.highlight .hll {
+ display: block;
+}
+
+div.highlight pre,
+table.highlighttable pre {
+ margin: 0;
+}
+
+div.code-block-caption + div {
+ margin-top: 0;
+}
+
+div.code-block-caption {
+ margin-top: 1em;
+ padding: 2px 5px;
+ font-size: small;
+}
+
+div.code-block-caption code {
+ background-color: transparent;
+}
+
+table.highlighttable td.linenos,
+span.linenos,
+div.highlight span.gp { /* gp: Generic.Prompt */
+ user-select: none;
+ -webkit-user-select: text; /* Safari fallback only */
+ -webkit-user-select: none; /* Chrome/Safari */
+ -moz-user-select: none; /* Firefox */
+ -ms-user-select: none; /* IE10+ */
+}
+
+div.code-block-caption span.caption-number {
+ padding: 0.1em 0.3em;
+ font-style: italic;
+}
+
+div.code-block-caption span.caption-text {
+}
+
+div.literal-block-wrapper {
+ margin: 1em 0;
+}
+
+code.xref, a code {
+ background-color: transparent;
+ font-weight: bold;
+}
+
+h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
+ background-color: transparent;
+}
+
+.viewcode-link {
+ float: right;
+}
+
+.viewcode-back {
+ float: right;
+ font-family: sans-serif;
+}
+
+div.viewcode-block:target {
+ margin: -1px -10px;
+ padding: 0 10px;
+}
+
+/* -- math display ---------------------------------------------------------- */
+
+img.math {
+ vertical-align: middle;
+}
+
+div.body div.math p {
+ text-align: center;
+}
+
+span.eqno {
+ float: right;
+}
+
+span.eqno a.headerlink {
+ position: absolute;
+ z-index: 1;
+}
+
+div.math:hover a.headerlink {
+ visibility: visible;
+}
+
+/* -- printout stylesheet --------------------------------------------------- */
+
+@media print {
+ div.document,
+ div.documentwrapper,
+ div.bodywrapper {
+ margin: 0 !important;
+ width: 100%;
+ }
+
+ div.sphinxsidebar,
+ div.related,
+ div.footer,
+ #top-link {
+ display: none;
+ }
+}
\ No newline at end of file
diff --git a/docs/_static/debug.css b/docs/_static/debug.css
new file mode 100644
index 0000000..74d4aec
--- /dev/null
+++ b/docs/_static/debug.css
@@ -0,0 +1,69 @@
+/*
+ This CSS file should be overridden by the theme authors. It's
+ meant for debugging and developing the skeleton that this theme provides.
+*/
+body {
+ font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif,
+ "Apple Color Emoji", "Segoe UI Emoji";
+ background: lavender;
+}
+.sb-announcement {
+ background: rgb(131, 131, 131);
+}
+.sb-announcement__inner {
+ background: black;
+ color: white;
+}
+.sb-header {
+ background: lightskyblue;
+}
+.sb-header__inner {
+ background: royalblue;
+ color: white;
+}
+.sb-header-secondary {
+ background: lightcyan;
+}
+.sb-header-secondary__inner {
+ background: cornflowerblue;
+ color: white;
+}
+.sb-sidebar-primary {
+ background: lightgreen;
+}
+.sb-main {
+ background: blanchedalmond;
+}
+.sb-main__inner {
+ background: antiquewhite;
+}
+.sb-header-article {
+ background: lightsteelblue;
+}
+.sb-article-container {
+ background: snow;
+}
+.sb-article-main {
+ background: white;
+}
+.sb-footer-article {
+ background: lightpink;
+}
+.sb-sidebar-secondary {
+ background: lightgoldenrodyellow;
+}
+.sb-footer-content {
+ background: plum;
+}
+.sb-footer-content__inner {
+ background: palevioletred;
+}
+.sb-footer {
+ background: pink;
+}
+.sb-footer__inner {
+ background: salmon;
+}
+.sb-article {
+ background: white;
+}
diff --git a/docs/_static/doctools.js b/docs/_static/doctools.js
new file mode 100644
index 0000000..d06a71d
--- /dev/null
+++ b/docs/_static/doctools.js
@@ -0,0 +1,156 @@
+/*
+ * doctools.js
+ * ~~~~~~~~~~~
+ *
+ * Base JavaScript utilities for all Sphinx HTML documentation.
+ *
+ * :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
+ * :license: BSD, see LICENSE for details.
+ *
+ */
+"use strict";
+
+const BLACKLISTED_KEY_CONTROL_ELEMENTS = new Set([
+ "TEXTAREA",
+ "INPUT",
+ "SELECT",
+ "BUTTON",
+]);
+
+const _ready = (callback) => {
+ if (document.readyState !== "loading") {
+ callback();
+ } else {
+ document.addEventListener("DOMContentLoaded", callback);
+ }
+};
+
+/**
+ * Small JavaScript module for the documentation.
+ */
+const Documentation = {
+ init: () => {
+ Documentation.initDomainIndexTable();
+ Documentation.initOnKeyListeners();
+ },
+
+ /**
+ * i18n support
+ */
+ TRANSLATIONS: {},
+ PLURAL_EXPR: (n) => (n === 1 ? 0 : 1),
+ LOCALE: "unknown",
+
+ // gettext and ngettext don't access this so that the functions
+ // can safely bound to a different name (_ = Documentation.gettext)
+ gettext: (string) => {
+ const translated = Documentation.TRANSLATIONS[string];
+ switch (typeof translated) {
+ case "undefined":
+ return string; // no translation
+ case "string":
+ return translated; // translation exists
+ default:
+ return translated[0]; // (singular, plural) translation tuple exists
+ }
+ },
+
+ ngettext: (singular, plural, n) => {
+ const translated = Documentation.TRANSLATIONS[singular];
+ if (typeof translated !== "undefined")
+ return translated[Documentation.PLURAL_EXPR(n)];
+ return n === 1 ? singular : plural;
+ },
+
+ addTranslations: (catalog) => {
+ Object.assign(Documentation.TRANSLATIONS, catalog.messages);
+ Documentation.PLURAL_EXPR = new Function(
+ "n",
+ `return (${catalog.plural_expr})`
+ );
+ Documentation.LOCALE = catalog.locale;
+ },
+
+ /**
+ * helper function to focus on search bar
+ */
+ focusSearchBar: () => {
+ document.querySelectorAll("input[name=q]")[0]?.focus();
+ },
+
+ /**
+ * Initialise the domain index toggle buttons
+ */
+ initDomainIndexTable: () => {
+ const toggler = (el) => {
+ const idNumber = el.id.substr(7);
+ const toggledRows = document.querySelectorAll(`tr.cg-${idNumber}`);
+ if (el.src.substr(-9) === "minus.png") {
+ el.src = `${el.src.substr(0, el.src.length - 9)}plus.png`;
+ toggledRows.forEach((el) => (el.style.display = "none"));
+ } else {
+ el.src = `${el.src.substr(0, el.src.length - 8)}minus.png`;
+ toggledRows.forEach((el) => (el.style.display = ""));
+ }
+ };
+
+ const togglerElements = document.querySelectorAll("img.toggler");
+ togglerElements.forEach((el) =>
+ el.addEventListener("click", (event) => toggler(event.currentTarget))
+ );
+ togglerElements.forEach((el) => (el.style.display = ""));
+ if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) togglerElements.forEach(toggler);
+ },
+
+ initOnKeyListeners: () => {
+ // only install a listener if it is really needed
+ if (
+ !DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS &&
+ !DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS
+ )
+ return;
+
+ document.addEventListener("keydown", (event) => {
+ // bail for input elements
+ if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return;
+ // bail with special keys
+ if (event.altKey || event.ctrlKey || event.metaKey) return;
+
+ if (!event.shiftKey) {
+ switch (event.key) {
+ case "ArrowLeft":
+ if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break;
+
+ const prevLink = document.querySelector('link[rel="prev"]');
+ if (prevLink && prevLink.href) {
+ window.location.href = prevLink.href;
+ event.preventDefault();
+ }
+ break;
+ case "ArrowRight":
+ if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break;
+
+ const nextLink = document.querySelector('link[rel="next"]');
+ if (nextLink && nextLink.href) {
+ window.location.href = nextLink.href;
+ event.preventDefault();
+ }
+ break;
+ }
+ }
+
+ // some keyboard layouts may need Shift to get /
+ switch (event.key) {
+ case "/":
+ if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) break;
+ Documentation.focusSearchBar();
+ event.preventDefault();
+ }
+ });
+ },
+};
+
+// quick alias for translations
+const _ = Documentation.gettext;
+
+_ready(Documentation.init);
diff --git a/docs/_static/documentation_options.js b/docs/_static/documentation_options.js
new file mode 100644
index 0000000..995f333
--- /dev/null
+++ b/docs/_static/documentation_options.js
@@ -0,0 +1,14 @@
+var DOCUMENTATION_OPTIONS = {
+ URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
+ VERSION: '1.0.0',
+ LANGUAGE: 'en',
+ COLLAPSE_INDEX: false,
+ BUILDER: 'html',
+ FILE_SUFFIX: '.html',
+ LINK_SUFFIX: '.html',
+ HAS_SOURCE: true,
+ SOURCELINK_SUFFIX: '.txt',
+ NAVIGATION_WITH_KEYS: false,
+ SHOW_SEARCH_SUMMARY: true,
+ ENABLE_SEARCH_SHORTCUTS: true,
+};
\ No newline at end of file
diff --git a/docs/_static/file.png b/docs/_static/file.png
new file mode 100644
index 0000000..a858a41
Binary files /dev/null and b/docs/_static/file.png differ
diff --git a/docs/_static/language_data.js b/docs/_static/language_data.js
new file mode 100644
index 0000000..250f566
--- /dev/null
+++ b/docs/_static/language_data.js
@@ -0,0 +1,199 @@
+/*
+ * language_data.js
+ * ~~~~~~~~~~~~~~~~
+ *
+ * This script contains the language-specific data used by searchtools.js,
+ * namely the list of stopwords, stemmer, scorer and splitter.
+ *
+ * :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
+ * :license: BSD, see LICENSE for details.
+ *
+ */
+
+var stopwords = ["a", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "near", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"];
+
+
+/* Non-minified version is copied as a separate JS file, is available */
+
+/**
+ * Porter Stemmer
+ */
+var Stemmer = function() {
+
+ var step2list = {
+ ational: 'ate',
+ tional: 'tion',
+ enci: 'ence',
+ anci: 'ance',
+ izer: 'ize',
+ bli: 'ble',
+ alli: 'al',
+ entli: 'ent',
+ eli: 'e',
+ ousli: 'ous',
+ ization: 'ize',
+ ation: 'ate',
+ ator: 'ate',
+ alism: 'al',
+ iveness: 'ive',
+ fulness: 'ful',
+ ousness: 'ous',
+ aliti: 'al',
+ iviti: 'ive',
+ biliti: 'ble',
+ logi: 'log'
+ };
+
+ var step3list = {
+ icate: 'ic',
+ ative: '',
+ alize: 'al',
+ iciti: 'ic',
+ ical: 'ic',
+ ful: '',
+ ness: ''
+ };
+
+ var c = "[^aeiou]"; // consonant
+ var v = "[aeiouy]"; // vowel
+ var C = c + "[^aeiouy]*"; // consonant sequence
+ var V = v + "[aeiou]*"; // vowel sequence
+
+ var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0
+ var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1
+ var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1
+ var s_v = "^(" + C + ")?" + v; // vowel in stem
+
+ this.stemWord = function (w) {
+ var stem;
+ var suffix;
+ var firstch;
+ var origword = w;
+
+ if (w.length < 3)
+ return w;
+
+ var re;
+ var re2;
+ var re3;
+ var re4;
+
+ firstch = w.substr(0,1);
+ if (firstch == "y")
+ w = firstch.toUpperCase() + w.substr(1);
+
+ // Step 1a
+ re = /^(.+?)(ss|i)es$/;
+ re2 = /^(.+?)([^s])s$/;
+
+ if (re.test(w))
+ w = w.replace(re,"$1$2");
+ else if (re2.test(w))
+ w = w.replace(re2,"$1$2");
+
+ // Step 1b
+ re = /^(.+?)eed$/;
+ re2 = /^(.+?)(ed|ing)$/;
+ if (re.test(w)) {
+ var fp = re.exec(w);
+ re = new RegExp(mgr0);
+ if (re.test(fp[1])) {
+ re = /.$/;
+ w = w.replace(re,"");
+ }
+ }
+ else if (re2.test(w)) {
+ var fp = re2.exec(w);
+ stem = fp[1];
+ re2 = new RegExp(s_v);
+ if (re2.test(stem)) {
+ w = stem;
+ re2 = /(at|bl|iz)$/;
+ re3 = new RegExp("([^aeiouylsz])\\1$");
+ re4 = new RegExp("^" + C + v + "[^aeiouwxy]$");
+ if (re2.test(w))
+ w = w + "e";
+ else if (re3.test(w)) {
+ re = /.$/;
+ w = w.replace(re,"");
+ }
+ else if (re4.test(w))
+ w = w + "e";
+ }
+ }
+
+ // Step 1c
+ re = /^(.+?)y$/;
+ if (re.test(w)) {
+ var fp = re.exec(w);
+ stem = fp[1];
+ re = new RegExp(s_v);
+ if (re.test(stem))
+ w = stem + "i";
+ }
+
+ // Step 2
+ re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;
+ if (re.test(w)) {
+ var fp = re.exec(w);
+ stem = fp[1];
+ suffix = fp[2];
+ re = new RegExp(mgr0);
+ if (re.test(stem))
+ w = stem + step2list[suffix];
+ }
+
+ // Step 3
+ re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;
+ if (re.test(w)) {
+ var fp = re.exec(w);
+ stem = fp[1];
+ suffix = fp[2];
+ re = new RegExp(mgr0);
+ if (re.test(stem))
+ w = stem + step3list[suffix];
+ }
+
+ // Step 4
+ re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;
+ re2 = /^(.+?)(s|t)(ion)$/;
+ if (re.test(w)) {
+ var fp = re.exec(w);
+ stem = fp[1];
+ re = new RegExp(mgr1);
+ if (re.test(stem))
+ w = stem;
+ }
+ else if (re2.test(w)) {
+ var fp = re2.exec(w);
+ stem = fp[1] + fp[2];
+ re2 = new RegExp(mgr1);
+ if (re2.test(stem))
+ w = stem;
+ }
+
+ // Step 5
+ re = /^(.+?)e$/;
+ if (re.test(w)) {
+ var fp = re.exec(w);
+ stem = fp[1];
+ re = new RegExp(mgr1);
+ re2 = new RegExp(meq1);
+ re3 = new RegExp("^" + C + v + "[^aeiouwxy]$");
+ if (re.test(stem) || (re2.test(stem) && !(re3.test(stem))))
+ w = stem;
+ }
+ re = /ll$/;
+ re2 = new RegExp(mgr1);
+ if (re.test(w) && re2.test(w)) {
+ re = /.$/;
+ w = w.replace(re,"");
+ }
+
+ // and turn initial Y back to y
+ if (firstch == "y")
+ w = firstch.toLowerCase() + w.substr(1);
+ return w;
+ }
+}
+
diff --git a/docs/_static/minus.png b/docs/_static/minus.png
new file mode 100644
index 0000000..d96755f
Binary files /dev/null and b/docs/_static/minus.png differ
diff --git a/docs/_static/plus.png b/docs/_static/plus.png
new file mode 100644
index 0000000..7107cec
Binary files /dev/null and b/docs/_static/plus.png differ
diff --git a/docs/_static/pygments.css b/docs/_static/pygments.css
new file mode 100644
index 0000000..c2e07c7
--- /dev/null
+++ b/docs/_static/pygments.css
@@ -0,0 +1,258 @@
+.highlight pre { line-height: 125%; }
+.highlight td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
+.highlight span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
+.highlight td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
+.highlight span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
+.highlight .hll { background-color: #ffffcc }
+.highlight { background: #f8f8f8; }
+.highlight .c { color: #8f5902; font-style: italic } /* Comment */
+.highlight .err { color: #a40000; border: 1px solid #ef2929 } /* Error */
+.highlight .g { color: #000000 } /* Generic */
+.highlight .k { color: #204a87; font-weight: bold } /* Keyword */
+.highlight .l { color: #000000 } /* Literal */
+.highlight .n { color: #000000 } /* Name */
+.highlight .o { color: #ce5c00; font-weight: bold } /* Operator */
+.highlight .x { color: #000000 } /* Other */
+.highlight .p { color: #000000; font-weight: bold } /* Punctuation */
+.highlight .ch { color: #8f5902; font-style: italic } /* Comment.Hashbang */
+.highlight .cm { color: #8f5902; font-style: italic } /* Comment.Multiline */
+.highlight .cp { color: #8f5902; font-style: italic } /* Comment.Preproc */
+.highlight .cpf { color: #8f5902; font-style: italic } /* Comment.PreprocFile */
+.highlight .c1 { color: #8f5902; font-style: italic } /* Comment.Single */
+.highlight .cs { color: #8f5902; font-style: italic } /* Comment.Special */
+.highlight .gd { color: #a40000 } /* Generic.Deleted */
+.highlight .ge { color: #000000; font-style: italic } /* Generic.Emph */
+.highlight .ges { color: #000000; font-weight: bold; font-style: italic } /* Generic.EmphStrong */
+.highlight .gr { color: #ef2929 } /* Generic.Error */
+.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
+.highlight .gi { color: #00A000 } /* Generic.Inserted */
+.highlight .go { color: #000000; font-style: italic } /* Generic.Output */
+.highlight .gp { color: #8f5902 } /* Generic.Prompt */
+.highlight .gs { color: #000000; font-weight: bold } /* Generic.Strong */
+.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
+.highlight .gt { color: #a40000; font-weight: bold } /* Generic.Traceback */
+.highlight .kc { color: #204a87; font-weight: bold } /* Keyword.Constant */
+.highlight .kd { color: #204a87; font-weight: bold } /* Keyword.Declaration */
+.highlight .kn { color: #204a87; font-weight: bold } /* Keyword.Namespace */
+.highlight .kp { color: #204a87; font-weight: bold } /* Keyword.Pseudo */
+.highlight .kr { color: #204a87; font-weight: bold } /* Keyword.Reserved */
+.highlight .kt { color: #204a87; font-weight: bold } /* Keyword.Type */
+.highlight .ld { color: #000000 } /* Literal.Date */
+.highlight .m { color: #0000cf; font-weight: bold } /* Literal.Number */
+.highlight .s { color: #4e9a06 } /* Literal.String */
+.highlight .na { color: #c4a000 } /* Name.Attribute */
+.highlight .nb { color: #204a87 } /* Name.Builtin */
+.highlight .nc { color: #000000 } /* Name.Class */
+.highlight .no { color: #000000 } /* Name.Constant */
+.highlight .nd { color: #5c35cc; font-weight: bold } /* Name.Decorator */
+.highlight .ni { color: #ce5c00 } /* Name.Entity */
+.highlight .ne { color: #cc0000; font-weight: bold } /* Name.Exception */
+.highlight .nf { color: #000000 } /* Name.Function */
+.highlight .nl { color: #f57900 } /* Name.Label */
+.highlight .nn { color: #000000 } /* Name.Namespace */
+.highlight .nx { color: #000000 } /* Name.Other */
+.highlight .py { color: #000000 } /* Name.Property */
+.highlight .nt { color: #204a87; font-weight: bold } /* Name.Tag */
+.highlight .nv { color: #000000 } /* Name.Variable */
+.highlight .ow { color: #204a87; font-weight: bold } /* Operator.Word */
+.highlight .pm { color: #000000; font-weight: bold } /* Punctuation.Marker */
+.highlight .w { color: #f8f8f8 } /* Text.Whitespace */
+.highlight .mb { color: #0000cf; font-weight: bold } /* Literal.Number.Bin */
+.highlight .mf { color: #0000cf; font-weight: bold } /* Literal.Number.Float */
+.highlight .mh { color: #0000cf; font-weight: bold } /* Literal.Number.Hex */
+.highlight .mi { color: #0000cf; font-weight: bold } /* Literal.Number.Integer */
+.highlight .mo { color: #0000cf; font-weight: bold } /* Literal.Number.Oct */
+.highlight .sa { color: #4e9a06 } /* Literal.String.Affix */
+.highlight .sb { color: #4e9a06 } /* Literal.String.Backtick */
+.highlight .sc { color: #4e9a06 } /* Literal.String.Char */
+.highlight .dl { color: #4e9a06 } /* Literal.String.Delimiter */
+.highlight .sd { color: #8f5902; font-style: italic } /* Literal.String.Doc */
+.highlight .s2 { color: #4e9a06 } /* Literal.String.Double */
+.highlight .se { color: #4e9a06 } /* Literal.String.Escape */
+.highlight .sh { color: #4e9a06 } /* Literal.String.Heredoc */
+.highlight .si { color: #4e9a06 } /* Literal.String.Interpol */
+.highlight .sx { color: #4e9a06 } /* Literal.String.Other */
+.highlight .sr { color: #4e9a06 } /* Literal.String.Regex */
+.highlight .s1 { color: #4e9a06 } /* Literal.String.Single */
+.highlight .ss { color: #4e9a06 } /* Literal.String.Symbol */
+.highlight .bp { color: #3465a4 } /* Name.Builtin.Pseudo */
+.highlight .fm { color: #000000 } /* Name.Function.Magic */
+.highlight .vc { color: #000000 } /* Name.Variable.Class */
+.highlight .vg { color: #000000 } /* Name.Variable.Global */
+.highlight .vi { color: #000000 } /* Name.Variable.Instance */
+.highlight .vm { color: #000000 } /* Name.Variable.Magic */
+.highlight .il { color: #0000cf; font-weight: bold } /* Literal.Number.Integer.Long */
+@media not print {
+body[data-theme="dark"] .highlight pre { line-height: 125%; }
+body[data-theme="dark"] .highlight td.linenos .normal { color: #aaaaaa; background-color: transparent; padding-left: 5px; padding-right: 5px; }
+body[data-theme="dark"] .highlight span.linenos { color: #aaaaaa; background-color: transparent; padding-left: 5px; padding-right: 5px; }
+body[data-theme="dark"] .highlight td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
+body[data-theme="dark"] .highlight span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
+body[data-theme="dark"] .highlight .hll { background-color: #404040 }
+body[data-theme="dark"] .highlight { background: #202020; color: #d0d0d0 }
+body[data-theme="dark"] .highlight .c { color: #ababab; font-style: italic } /* Comment */
+body[data-theme="dark"] .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
+body[data-theme="dark"] .highlight .esc { color: #d0d0d0 } /* Escape */
+body[data-theme="dark"] .highlight .g { color: #d0d0d0 } /* Generic */
+body[data-theme="dark"] .highlight .k { color: #6ebf26; font-weight: bold } /* Keyword */
+body[data-theme="dark"] .highlight .l { color: #d0d0d0 } /* Literal */
+body[data-theme="dark"] .highlight .n { color: #d0d0d0 } /* Name */
+body[data-theme="dark"] .highlight .o { color: #d0d0d0 } /* Operator */
+body[data-theme="dark"] .highlight .x { color: #d0d0d0 } /* Other */
+body[data-theme="dark"] .highlight .p { color: #d0d0d0 } /* Punctuation */
+body[data-theme="dark"] .highlight .ch { color: #ababab; font-style: italic } /* Comment.Hashbang */
+body[data-theme="dark"] .highlight .cm { color: #ababab; font-style: italic } /* Comment.Multiline */
+body[data-theme="dark"] .highlight .cp { color: #ff3a3a; font-weight: bold } /* Comment.Preproc */
+body[data-theme="dark"] .highlight .cpf { color: #ababab; font-style: italic } /* Comment.PreprocFile */
+body[data-theme="dark"] .highlight .c1 { color: #ababab; font-style: italic } /* Comment.Single */
+body[data-theme="dark"] .highlight .cs { color: #e50808; font-weight: bold; background-color: #520000 } /* Comment.Special */
+body[data-theme="dark"] .highlight .gd { color: #d22323 } /* Generic.Deleted */
+body[data-theme="dark"] .highlight .ge { color: #d0d0d0; font-style: italic } /* Generic.Emph */
+body[data-theme="dark"] .highlight .ges { color: #d0d0d0; font-weight: bold; font-style: italic } /* Generic.EmphStrong */
+body[data-theme="dark"] .highlight .gr { color: #d22323 } /* Generic.Error */
+body[data-theme="dark"] .highlight .gh { color: #ffffff; font-weight: bold } /* Generic.Heading */
+body[data-theme="dark"] .highlight .gi { color: #589819 } /* Generic.Inserted */
+body[data-theme="dark"] .highlight .go { color: #cccccc } /* Generic.Output */
+body[data-theme="dark"] .highlight .gp { color: #aaaaaa } /* Generic.Prompt */
+body[data-theme="dark"] .highlight .gs { color: #d0d0d0; font-weight: bold } /* Generic.Strong */
+body[data-theme="dark"] .highlight .gu { color: #ffffff; text-decoration: underline } /* Generic.Subheading */
+body[data-theme="dark"] .highlight .gt { color: #d22323 } /* Generic.Traceback */
+body[data-theme="dark"] .highlight .kc { color: #6ebf26; font-weight: bold } /* Keyword.Constant */
+body[data-theme="dark"] .highlight .kd { color: #6ebf26; font-weight: bold } /* Keyword.Declaration */
+body[data-theme="dark"] .highlight .kn { color: #6ebf26; font-weight: bold } /* Keyword.Namespace */
+body[data-theme="dark"] .highlight .kp { color: #6ebf26 } /* Keyword.Pseudo */
+body[data-theme="dark"] .highlight .kr { color: #6ebf26; font-weight: bold } /* Keyword.Reserved */
+body[data-theme="dark"] .highlight .kt { color: #6ebf26; font-weight: bold } /* Keyword.Type */
+body[data-theme="dark"] .highlight .ld { color: #d0d0d0 } /* Literal.Date */
+body[data-theme="dark"] .highlight .m { color: #51b2fd } /* Literal.Number */
+body[data-theme="dark"] .highlight .s { color: #ed9d13 } /* Literal.String */
+body[data-theme="dark"] .highlight .na { color: #bbbbbb } /* Name.Attribute */
+body[data-theme="dark"] .highlight .nb { color: #2fbccd } /* Name.Builtin */
+body[data-theme="dark"] .highlight .nc { color: #71adff; text-decoration: underline } /* Name.Class */
+body[data-theme="dark"] .highlight .no { color: #40ffff } /* Name.Constant */
+body[data-theme="dark"] .highlight .nd { color: #ffa500 } /* Name.Decorator */
+body[data-theme="dark"] .highlight .ni { color: #d0d0d0 } /* Name.Entity */
+body[data-theme="dark"] .highlight .ne { color: #bbbbbb } /* Name.Exception */
+body[data-theme="dark"] .highlight .nf { color: #71adff } /* Name.Function */
+body[data-theme="dark"] .highlight .nl { color: #d0d0d0 } /* Name.Label */
+body[data-theme="dark"] .highlight .nn { color: #71adff; text-decoration: underline } /* Name.Namespace */
+body[data-theme="dark"] .highlight .nx { color: #d0d0d0 } /* Name.Other */
+body[data-theme="dark"] .highlight .py { color: #d0d0d0 } /* Name.Property */
+body[data-theme="dark"] .highlight .nt { color: #6ebf26; font-weight: bold } /* Name.Tag */
+body[data-theme="dark"] .highlight .nv { color: #40ffff } /* Name.Variable */
+body[data-theme="dark"] .highlight .ow { color: #6ebf26; font-weight: bold } /* Operator.Word */
+body[data-theme="dark"] .highlight .pm { color: #d0d0d0 } /* Punctuation.Marker */
+body[data-theme="dark"] .highlight .w { color: #666666 } /* Text.Whitespace */
+body[data-theme="dark"] .highlight .mb { color: #51b2fd } /* Literal.Number.Bin */
+body[data-theme="dark"] .highlight .mf { color: #51b2fd } /* Literal.Number.Float */
+body[data-theme="dark"] .highlight .mh { color: #51b2fd } /* Literal.Number.Hex */
+body[data-theme="dark"] .highlight .mi { color: #51b2fd } /* Literal.Number.Integer */
+body[data-theme="dark"] .highlight .mo { color: #51b2fd } /* Literal.Number.Oct */
+body[data-theme="dark"] .highlight .sa { color: #ed9d13 } /* Literal.String.Affix */
+body[data-theme="dark"] .highlight .sb { color: #ed9d13 } /* Literal.String.Backtick */
+body[data-theme="dark"] .highlight .sc { color: #ed9d13 } /* Literal.String.Char */
+body[data-theme="dark"] .highlight .dl { color: #ed9d13 } /* Literal.String.Delimiter */
+body[data-theme="dark"] .highlight .sd { color: #ed9d13 } /* Literal.String.Doc */
+body[data-theme="dark"] .highlight .s2 { color: #ed9d13 } /* Literal.String.Double */
+body[data-theme="dark"] .highlight .se { color: #ed9d13 } /* Literal.String.Escape */
+body[data-theme="dark"] .highlight .sh { color: #ed9d13 } /* Literal.String.Heredoc */
+body[data-theme="dark"] .highlight .si { color: #ed9d13 } /* Literal.String.Interpol */
+body[data-theme="dark"] .highlight .sx { color: #ffa500 } /* Literal.String.Other */
+body[data-theme="dark"] .highlight .sr { color: #ed9d13 } /* Literal.String.Regex */
+body[data-theme="dark"] .highlight .s1 { color: #ed9d13 } /* Literal.String.Single */
+body[data-theme="dark"] .highlight .ss { color: #ed9d13 } /* Literal.String.Symbol */
+body[data-theme="dark"] .highlight .bp { color: #2fbccd } /* Name.Builtin.Pseudo */
+body[data-theme="dark"] .highlight .fm { color: #71adff } /* Name.Function.Magic */
+body[data-theme="dark"] .highlight .vc { color: #40ffff } /* Name.Variable.Class */
+body[data-theme="dark"] .highlight .vg { color: #40ffff } /* Name.Variable.Global */
+body[data-theme="dark"] .highlight .vi { color: #40ffff } /* Name.Variable.Instance */
+body[data-theme="dark"] .highlight .vm { color: #40ffff } /* Name.Variable.Magic */
+body[data-theme="dark"] .highlight .il { color: #51b2fd } /* Literal.Number.Integer.Long */
+@media (prefers-color-scheme: dark) {
+body:not([data-theme="light"]) .highlight pre { line-height: 125%; }
+body:not([data-theme="light"]) .highlight td.linenos .normal { color: #aaaaaa; background-color: transparent; padding-left: 5px; padding-right: 5px; }
+body:not([data-theme="light"]) .highlight span.linenos { color: #aaaaaa; background-color: transparent; padding-left: 5px; padding-right: 5px; }
+body:not([data-theme="light"]) .highlight td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
+body:not([data-theme="light"]) .highlight span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
+body:not([data-theme="light"]) .highlight .hll { background-color: #404040 }
+body:not([data-theme="light"]) .highlight { background: #202020; color: #d0d0d0 }
+body:not([data-theme="light"]) .highlight .c { color: #ababab; font-style: italic } /* Comment */
+body:not([data-theme="light"]) .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
+body:not([data-theme="light"]) .highlight .esc { color: #d0d0d0 } /* Escape */
+body:not([data-theme="light"]) .highlight .g { color: #d0d0d0 } /* Generic */
+body:not([data-theme="light"]) .highlight .k { color: #6ebf26; font-weight: bold } /* Keyword */
+body:not([data-theme="light"]) .highlight .l { color: #d0d0d0 } /* Literal */
+body:not([data-theme="light"]) .highlight .n { color: #d0d0d0 } /* Name */
+body:not([data-theme="light"]) .highlight .o { color: #d0d0d0 } /* Operator */
+body:not([data-theme="light"]) .highlight .x { color: #d0d0d0 } /* Other */
+body:not([data-theme="light"]) .highlight .p { color: #d0d0d0 } /* Punctuation */
+body:not([data-theme="light"]) .highlight .ch { color: #ababab; font-style: italic } /* Comment.Hashbang */
+body:not([data-theme="light"]) .highlight .cm { color: #ababab; font-style: italic } /* Comment.Multiline */
+body:not([data-theme="light"]) .highlight .cp { color: #ff3a3a; font-weight: bold } /* Comment.Preproc */
+body:not([data-theme="light"]) .highlight .cpf { color: #ababab; font-style: italic } /* Comment.PreprocFile */
+body:not([data-theme="light"]) .highlight .c1 { color: #ababab; font-style: italic } /* Comment.Single */
+body:not([data-theme="light"]) .highlight .cs { color: #e50808; font-weight: bold; background-color: #520000 } /* Comment.Special */
+body:not([data-theme="light"]) .highlight .gd { color: #d22323 } /* Generic.Deleted */
+body:not([data-theme="light"]) .highlight .ge { color: #d0d0d0; font-style: italic } /* Generic.Emph */
+body:not([data-theme="light"]) .highlight .ges { color: #d0d0d0; font-weight: bold; font-style: italic } /* Generic.EmphStrong */
+body:not([data-theme="light"]) .highlight .gr { color: #d22323 } /* Generic.Error */
+body:not([data-theme="light"]) .highlight .gh { color: #ffffff; font-weight: bold } /* Generic.Heading */
+body:not([data-theme="light"]) .highlight .gi { color: #589819 } /* Generic.Inserted */
+body:not([data-theme="light"]) .highlight .go { color: #cccccc } /* Generic.Output */
+body:not([data-theme="light"]) .highlight .gp { color: #aaaaaa } /* Generic.Prompt */
+body:not([data-theme="light"]) .highlight .gs { color: #d0d0d0; font-weight: bold } /* Generic.Strong */
+body:not([data-theme="light"]) .highlight .gu { color: #ffffff; text-decoration: underline } /* Generic.Subheading */
+body:not([data-theme="light"]) .highlight .gt { color: #d22323 } /* Generic.Traceback */
+body:not([data-theme="light"]) .highlight .kc { color: #6ebf26; font-weight: bold } /* Keyword.Constant */
+body:not([data-theme="light"]) .highlight .kd { color: #6ebf26; font-weight: bold } /* Keyword.Declaration */
+body:not([data-theme="light"]) .highlight .kn { color: #6ebf26; font-weight: bold } /* Keyword.Namespace */
+body:not([data-theme="light"]) .highlight .kp { color: #6ebf26 } /* Keyword.Pseudo */
+body:not([data-theme="light"]) .highlight .kr { color: #6ebf26; font-weight: bold } /* Keyword.Reserved */
+body:not([data-theme="light"]) .highlight .kt { color: #6ebf26; font-weight: bold } /* Keyword.Type */
+body:not([data-theme="light"]) .highlight .ld { color: #d0d0d0 } /* Literal.Date */
+body:not([data-theme="light"]) .highlight .m { color: #51b2fd } /* Literal.Number */
+body:not([data-theme="light"]) .highlight .s { color: #ed9d13 } /* Literal.String */
+body:not([data-theme="light"]) .highlight .na { color: #bbbbbb } /* Name.Attribute */
+body:not([data-theme="light"]) .highlight .nb { color: #2fbccd } /* Name.Builtin */
+body:not([data-theme="light"]) .highlight .nc { color: #71adff; text-decoration: underline } /* Name.Class */
+body:not([data-theme="light"]) .highlight .no { color: #40ffff } /* Name.Constant */
+body:not([data-theme="light"]) .highlight .nd { color: #ffa500 } /* Name.Decorator */
+body:not([data-theme="light"]) .highlight .ni { color: #d0d0d0 } /* Name.Entity */
+body:not([data-theme="light"]) .highlight .ne { color: #bbbbbb } /* Name.Exception */
+body:not([data-theme="light"]) .highlight .nf { color: #71adff } /* Name.Function */
+body:not([data-theme="light"]) .highlight .nl { color: #d0d0d0 } /* Name.Label */
+body:not([data-theme="light"]) .highlight .nn { color: #71adff; text-decoration: underline } /* Name.Namespace */
+body:not([data-theme="light"]) .highlight .nx { color: #d0d0d0 } /* Name.Other */
+body:not([data-theme="light"]) .highlight .py { color: #d0d0d0 } /* Name.Property */
+body:not([data-theme="light"]) .highlight .nt { color: #6ebf26; font-weight: bold } /* Name.Tag */
+body:not([data-theme="light"]) .highlight .nv { color: #40ffff } /* Name.Variable */
+body:not([data-theme="light"]) .highlight .ow { color: #6ebf26; font-weight: bold } /* Operator.Word */
+body:not([data-theme="light"]) .highlight .pm { color: #d0d0d0 } /* Punctuation.Marker */
+body:not([data-theme="light"]) .highlight .w { color: #666666 } /* Text.Whitespace */
+body:not([data-theme="light"]) .highlight .mb { color: #51b2fd } /* Literal.Number.Bin */
+body:not([data-theme="light"]) .highlight .mf { color: #51b2fd } /* Literal.Number.Float */
+body:not([data-theme="light"]) .highlight .mh { color: #51b2fd } /* Literal.Number.Hex */
+body:not([data-theme="light"]) .highlight .mi { color: #51b2fd } /* Literal.Number.Integer */
+body:not([data-theme="light"]) .highlight .mo { color: #51b2fd } /* Literal.Number.Oct */
+body:not([data-theme="light"]) .highlight .sa { color: #ed9d13 } /* Literal.String.Affix */
+body:not([data-theme="light"]) .highlight .sb { color: #ed9d13 } /* Literal.String.Backtick */
+body:not([data-theme="light"]) .highlight .sc { color: #ed9d13 } /* Literal.String.Char */
+body:not([data-theme="light"]) .highlight .dl { color: #ed9d13 } /* Literal.String.Delimiter */
+body:not([data-theme="light"]) .highlight .sd { color: #ed9d13 } /* Literal.String.Doc */
+body:not([data-theme="light"]) .highlight .s2 { color: #ed9d13 } /* Literal.String.Double */
+body:not([data-theme="light"]) .highlight .se { color: #ed9d13 } /* Literal.String.Escape */
+body:not([data-theme="light"]) .highlight .sh { color: #ed9d13 } /* Literal.String.Heredoc */
+body:not([data-theme="light"]) .highlight .si { color: #ed9d13 } /* Literal.String.Interpol */
+body:not([data-theme="light"]) .highlight .sx { color: #ffa500 } /* Literal.String.Other */
+body:not([data-theme="light"]) .highlight .sr { color: #ed9d13 } /* Literal.String.Regex */
+body:not([data-theme="light"]) .highlight .s1 { color: #ed9d13 } /* Literal.String.Single */
+body:not([data-theme="light"]) .highlight .ss { color: #ed9d13 } /* Literal.String.Symbol */
+body:not([data-theme="light"]) .highlight .bp { color: #2fbccd } /* Name.Builtin.Pseudo */
+body:not([data-theme="light"]) .highlight .fm { color: #71adff } /* Name.Function.Magic */
+body:not([data-theme="light"]) .highlight .vc { color: #40ffff } /* Name.Variable.Class */
+body:not([data-theme="light"]) .highlight .vg { color: #40ffff } /* Name.Variable.Global */
+body:not([data-theme="light"]) .highlight .vi { color: #40ffff } /* Name.Variable.Instance */
+body:not([data-theme="light"]) .highlight .vm { color: #40ffff } /* Name.Variable.Magic */
+body:not([data-theme="light"]) .highlight .il { color: #51b2fd } /* Literal.Number.Integer.Long */
+}
+}
\ No newline at end of file
diff --git a/docs/_static/scripts/furo-extensions.js b/docs/_static/scripts/furo-extensions.js
new file mode 100644
index 0000000..e69de29
diff --git a/docs/_static/scripts/furo.js b/docs/_static/scripts/furo.js
new file mode 100644
index 0000000..32e7c05
--- /dev/null
+++ b/docs/_static/scripts/furo.js
@@ -0,0 +1,3 @@
+/*! For license information please see furo.js.LICENSE.txt */
+(()=>{var t={212:function(t,e,n){var o,r;r=void 0!==n.g?n.g:"undefined"!=typeof window?window:this,o=function(){return function(t){"use strict";var e={navClass:"active",contentClass:"active",nested:!1,nestedClass:"active",offset:0,reflow:!1,events:!0},n=function(t,e,n){if(n.settings.events){var o=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e.dispatchEvent(o)}},o=function(t){var e=0;if(t.offsetParent)for(;t;)e+=t.offsetTop,t=t.offsetParent;return e>=0?e:0},r=function(t){t&&t.sort((function(t,e){return o(t.content)=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},l=function(t,e){var n=t[t.length-1];if(function(t,e){return!(!s()||!c(t.content,e,!0))}(n,e))return n;for(var o=t.length-1;o>=0;o--)if(c(t[o].content,e))return t[o]},a=function(t,e){if(e.nested&&t.parentNode){var n=t.parentNode.closest("li");n&&(n.classList.remove(e.nestedClass),a(n,e))}},i=function(t,e){if(t){var o=t.nav.closest("li");o&&(o.classList.remove(e.navClass),t.content.classList.remove(e.contentClass),a(o,e),n("gumshoeDeactivate",o,{link:t.nav,content:t.content,settings:e}))}},u=function(t,e){if(e.nested){var n=t.parentNode.closest("li");n&&(n.classList.add(e.nestedClass),u(n,e))}};return function(o,c){var s,a,d,f,m,v={setup:function(){s=document.querySelectorAll(o),a=[],Array.prototype.forEach.call(s,(function(t){var e=document.getElementById(decodeURIComponent(t.hash.substr(1)));e&&a.push({nav:t,content:e})})),r(a)},detect:function(){var t=l(a,m);t?d&&t.content===d.content||(i(d,m),function(t,e){if(t){var o=t.nav.closest("li");o&&(o.classList.add(e.navClass),t.content.classList.add(e.contentClass),u(o,e),n("gumshoeActivate",o,{link:t.nav,content:t.content,settings:e}))}}(t,m),d=t):d&&(i(d,m),d=null)}},h=function(e){f&&t.cancelAnimationFrame(f),f=t.requestAnimationFrame(v.detect)},g=function(e){f&&t.cancelAnimationFrame(f),f=t.requestAnimationFrame((function(){r(a),v.detect()}))};return v.destroy=function(){d&&i(d,m),t.removeEventListener("scroll",h,!1),m.reflow&&t.removeEventListener("resize",g,!1),a=null,s=null,d=null,f=null,m=null},m=function(){var t={};return Array.prototype.forEach.call(arguments,(function(e){for(var n in e){if(!e.hasOwnProperty(n))return;t[n]=e[n]}})),t}(e,c||{}),v.setup(),v.detect(),t.addEventListener("scroll",h,!1),m.reflow&&t.addEventListener("resize",g,!1),v}}(r)}.apply(e,[]),void 0===o||(t.exports=o)}},e={};function n(o){var r=e[o];if(void 0!==r)return r.exports;var c=e[o]={exports:{}};return t[o].call(c.exports,c,c.exports,n),c.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";var t=n(212),e=n.n(t),o=null,r=null,c=window.pageYOffset||document.documentElement.scrollTop;const s=64;function l(){const t=localStorage.getItem("theme")||"auto";var e;"light"!==(e=window.matchMedia("(prefers-color-scheme: dark)").matches?"auto"===t?"light":"light"==t?"dark":"auto":"auto"===t?"dark":"dark"==t?"light":"auto")&&"dark"!==e&&"auto"!==e&&(console.error(`Got invalid theme mode: ${e}. Resetting to auto.`),e="auto"),document.body.dataset.theme=e,localStorage.setItem("theme",e),console.log(`Changed to ${e} mode.`)}function a(){!function(){const t=document.getElementsByClassName("theme-toggle");Array.from(t).forEach((t=>{t.addEventListener("click",l)}))}(),function(){let t=0,e=!1;window.addEventListener("scroll",(function(n){t=window.scrollY,e||(window.requestAnimationFrame((function(){var n;n=t,0==Math.floor(r.getBoundingClientRect().top)?r.classList.add("scrolled"):r.classList.remove("scrolled"),function(t){tc&&document.documentElement.classList.remove("show-back-to-top"),c=t}(n),function(t){null!==o&&(0==t?o.scrollTo(0,0):Math.ceil(t)>=Math.floor(document.documentElement.scrollHeight-window.innerHeight)?o.scrollTo(0,o.scrollHeight):document.querySelector(".scroll-current"))}(n),e=!1})),e=!0)})),window.scroll()}(),null!==o&&new(e())(".toc-tree a",{reflow:!0,recursive:!0,navClass:"scroll-current",offset:()=>{let t=parseFloat(getComputedStyle(document.documentElement).fontSize);return r.getBoundingClientRect().height+.5*t+1}})}document.addEventListener("DOMContentLoaded",(function(){document.body.parentNode.classList.remove("no-js"),r=document.querySelector("header"),o=document.querySelector(".toc-scroll"),a()}))})()})();
+//# sourceMappingURL=furo.js.map
\ No newline at end of file
diff --git a/docs/_static/scripts/furo.js.LICENSE.txt b/docs/_static/scripts/furo.js.LICENSE.txt
new file mode 100644
index 0000000..1632189
--- /dev/null
+++ b/docs/_static/scripts/furo.js.LICENSE.txt
@@ -0,0 +1,7 @@
+/*!
+ * gumshoejs v5.1.2 (patched by @pradyunsg)
+ * A simple, framework-agnostic scrollspy script.
+ * (c) 2019 Chris Ferdinandi
+ * MIT License
+ * http://github.com/cferdinandi/gumshoe
+ */
diff --git a/docs/_static/scripts/furo.js.map b/docs/_static/scripts/furo.js.map
new file mode 100644
index 0000000..7b7ddb1
--- /dev/null
+++ b/docs/_static/scripts/furo.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"scripts/furo.js","mappings":";iCAAA,MAQWA,SAWS,IAAX,EAAAC,EACH,EAAAA,EACkB,oBAAXC,OACPA,OACAC,KAbS,EAAF,WACP,OAaJ,SAAUD,GACR,aAMA,IAAIE,EAAW,CAEbC,SAAU,SACVC,aAAc,SAGdC,QAAQ,EACRC,YAAa,SAGbC,OAAQ,EACRC,QAAQ,EAGRC,QAAQ,GA6BNC,EAAY,SAAUC,EAAMC,EAAMC,GAEpC,GAAKA,EAAOC,SAASL,OAArB,CAGA,IAAIM,EAAQ,IAAIC,YAAYL,EAAM,CAChCM,SAAS,EACTC,YAAY,EACZL,OAAQA,IAIVD,EAAKO,cAAcJ,EAVgB,CAWrC,EAOIK,EAAe,SAAUR,GAC3B,IAAIS,EAAW,EACf,GAAIT,EAAKU,aACP,KAAOV,GACLS,GAAYT,EAAKW,UACjBX,EAAOA,EAAKU,aAGhB,OAAOD,GAAY,EAAIA,EAAW,CACpC,EAMIG,EAAe,SAAUC,GACvBA,GACFA,EAASC,MAAK,SAAUC,EAAOC,GAG7B,OAFcR,EAAaO,EAAME,SACnBT,EAAaQ,EAAMC,UACF,EACxB,CACT,GAEJ,EAwCIC,EAAW,SAAUlB,EAAME,EAAUiB,GACvC,IAAIC,EAASpB,EAAKqB,wBACd1B,EAnCU,SAAUO,GAExB,MAA+B,mBAApBA,EAASP,OACX2B,WAAWpB,EAASP,UAItB2B,WAAWpB,EAASP,OAC7B,CA2Be4B,CAAUrB,GACvB,OAAIiB,EAEAK,SAASJ,EAAOD,OAAQ,KACvB/B,EAAOqC,aAAeC,SAASC,gBAAgBC,cAG7CJ,SAASJ,EAAOS,IAAK,KAAOlC,CACrC,EAMImC,EAAa,WACf,OACEC,KAAKC,KAAK5C,EAAOqC,YAAcrC,EAAO6C,cAnCjCF,KAAKG,IACVR,SAASS,KAAKC,aACdV,SAASC,gBAAgBS,aACzBV,SAASS,KAAKE,aACdX,SAASC,gBAAgBU,aACzBX,SAASS,KAAKP,aACdF,SAASC,gBAAgBC,aAkC7B,EAmBIU,EAAY,SAAUzB,EAAUX,GAClC,IAAIqC,EAAO1B,EAASA,EAAS2B,OAAS,GACtC,GAbgB,SAAUC,EAAMvC,GAChC,SAAI4B,MAAgBZ,EAASuB,EAAKxB,QAASf,GAAU,GAEvD,CAUMwC,CAAYH,EAAMrC,GAAW,OAAOqC,EACxC,IAAK,IAAII,EAAI9B,EAAS2B,OAAS,EAAGG,GAAK,EAAGA,IACxC,GAAIzB,EAASL,EAAS8B,GAAG1B,QAASf,GAAW,OAAOW,EAAS8B,EAEjE,EAOIC,EAAmB,SAAUC,EAAK3C,GAEpC,GAAKA,EAAST,QAAWoD,EAAIC,WAA7B,CAGA,IAAIC,EAAKF,EAAIC,WAAWE,QAAQ,MAC3BD,IAGLA,EAAGE,UAAUC,OAAOhD,EAASR,aAG7BkD,EAAiBG,EAAI7C,GAV0B,CAWjD,EAOIiD,EAAa,SAAUC,EAAOlD,GAEhC,GAAKkD,EAAL,CAGA,IAAIL,EAAKK,EAAMP,IAAIG,QAAQ,MACtBD,IAGLA,EAAGE,UAAUC,OAAOhD,EAASX,UAC7B6D,EAAMnC,QAAQgC,UAAUC,OAAOhD,EAASV,cAGxCoD,EAAiBG,EAAI7C,GAGrBJ,EAAU,oBAAqBiD,EAAI,CACjCM,KAAMD,EAAMP,IACZ5B,QAASmC,EAAMnC,QACff,SAAUA,IAjBM,CAmBpB,EAOIoD,EAAiB,SAAUT,EAAK3C,GAElC,GAAKA,EAAST,OAAd,CAGA,IAAIsD,EAAKF,EAAIC,WAAWE,QAAQ,MAC3BD,IAGLA,EAAGE,UAAUM,IAAIrD,EAASR,aAG1B4D,EAAeP,EAAI7C,GAVS,CAW9B,EA6LA,OA1JkB,SAAUsD,EAAUC,GAKpC,IACIC,EAAU7C,EAAU8C,EAASC,EAAS1D,EADtC2D,EAAa,CAUjBA,MAAmB,WAEjBH,EAAWhC,SAASoC,iBAAiBN,GAGrC3C,EAAW,GAGXkD,MAAMC,UAAUC,QAAQC,KAAKR,GAAU,SAAUjB,GAE/C,IAAIxB,EAAUS,SAASyC,eACrBC,mBAAmB3B,EAAK4B,KAAKC,OAAO,KAEjCrD,GAGLJ,EAAS0D,KAAK,CACZ1B,IAAKJ,EACLxB,QAASA,GAEb,IAGAL,EAAaC,EACf,EAKAgD,OAAoB,WAElB,IAAIW,EAASlC,EAAUzB,EAAUX,GAG5BsE,EASDb,GAAWa,EAAOvD,UAAY0C,EAAQ1C,UAG1CkC,EAAWQ,EAASzD,GAzFT,SAAUkD,EAAOlD,GAE9B,GAAKkD,EAAL,CAGA,IAAIL,EAAKK,EAAMP,IAAIG,QAAQ,MACtBD,IAGLA,EAAGE,UAAUM,IAAIrD,EAASX,UAC1B6D,EAAMnC,QAAQgC,UAAUM,IAAIrD,EAASV,cAGrC8D,EAAeP,EAAI7C,GAGnBJ,EAAU,kBAAmBiD,EAAI,CAC/BM,KAAMD,EAAMP,IACZ5B,QAASmC,EAAMnC,QACff,SAAUA,IAjBM,CAmBpB,CAqEIuE,CAASD,EAAQtE,GAGjByD,EAAUa,GAfJb,IACFR,EAAWQ,EAASzD,GACpByD,EAAU,KAchB,GAMIe,EAAgB,SAAUvE,GAExByD,GACFxE,EAAOuF,qBAAqBf,GAI9BA,EAAUxE,EAAOwF,sBAAsBf,EAAWgB,OACpD,EAMIC,EAAgB,SAAU3E,GAExByD,GACFxE,EAAOuF,qBAAqBf,GAI9BA,EAAUxE,EAAOwF,uBAAsB,WACrChE,EAAaC,GACbgD,EAAWgB,QACb,GACF,EAkDA,OA7CAhB,EAAWkB,QAAU,WAEfpB,GACFR,EAAWQ,EAASzD,GAItBd,EAAO4F,oBAAoB,SAAUN,GAAe,GAChDxE,EAASN,QACXR,EAAO4F,oBAAoB,SAAUF,GAAe,GAItDjE,EAAW,KACX6C,EAAW,KACXC,EAAU,KACVC,EAAU,KACV1D,EAAW,IACb,EAOEA,EA3XS,WACX,IAAI+E,EAAS,CAAC,EAOd,OANAlB,MAAMC,UAAUC,QAAQC,KAAKgB,WAAW,SAAUC,GAChD,IAAK,IAAIC,KAAOD,EAAK,CACnB,IAAKA,EAAIE,eAAeD,GAAM,OAC9BH,EAAOG,GAAOD,EAAIC,EACpB,CACF,IACOH,CACT,CAkXeK,CAAOhG,EAAUmE,GAAW,CAAC,GAGxCI,EAAW0B,QAGX1B,EAAWgB,SAGXzF,EAAOoG,iBAAiB,SAAUd,GAAe,GAC7CxE,EAASN,QACXR,EAAOoG,iBAAiB,SAAUV,GAAe,GAS9CjB,CACT,CAOF,CArcW4B,CAAQvG,EAChB,UAFM,SAEN,uBCXDwG,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaE,QAGrB,IAAIC,EAASN,EAAyBE,GAAY,CAGjDG,QAAS,CAAC,GAOX,OAHAE,EAAoBL,GAAU1B,KAAK8B,EAAOD,QAASC,EAAQA,EAAOD,QAASJ,GAGpEK,EAAOD,OACf,CCrBAJ,EAAoBO,EAAKF,IACxB,IAAIG,EAASH,GAAUA,EAAOI,WAC7B,IAAOJ,EAAiB,QACxB,IAAM,EAEP,OADAL,EAAoBU,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdR,EAAoBU,EAAI,CAACN,EAASQ,KACjC,IAAI,IAAInB,KAAOmB,EACXZ,EAAoBa,EAAED,EAAYnB,KAASO,EAAoBa,EAAET,EAASX,IAC5EqB,OAAOC,eAAeX,EAASX,EAAK,CAAEuB,YAAY,EAAMC,IAAKL,EAAWnB,IAE1E,ECNDO,EAAoBxG,EAAI,WACvB,GAA0B,iBAAf0H,WAAyB,OAAOA,WAC3C,IACC,OAAOxH,MAAQ,IAAIyH,SAAS,cAAb,EAChB,CAAE,MAAOC,GACR,GAAsB,iBAAX3H,OAAqB,OAAOA,MACxC,CACA,CAPuB,GCAxBuG,EAAoBa,EAAI,CAACrB,EAAK6B,IAAUP,OAAOzC,UAAUqB,eAAenB,KAAKiB,EAAK6B,4CCK9EC,EAAY,KACZC,EAAS,KACTC,EAAgB/H,OAAO6C,aAAeP,SAASC,gBAAgByF,UACnE,MAAMC,EAAmB,GA2EzB,SAASC,IACP,MAAMC,EAAeC,aAAaC,QAAQ,UAAY,OAZxD,IAAkBC,EACH,WADGA,EAaItI,OAAOuI,WAAW,gCAAgCC,QAI/C,SAAjBL,EACO,QACgB,SAAhBA,EACA,OAEA,OAIU,SAAjBA,EACO,OACgB,QAAhBA,EACA,QAEA,SA9BoB,SAATG,GAA4B,SAATA,IACzCG,QAAQC,MAAM,2BAA2BJ,yBACzCA,EAAO,QAGThG,SAASS,KAAK4F,QAAQC,MAAQN,EAC9BF,aAAaS,QAAQ,QAASP,GAC9BG,QAAQK,IAAI,cAAcR,UA0B5B,CAkDA,SAASnC,KART,WAEE,MAAM4C,EAAUzG,SAAS0G,uBAAuB,gBAChDrE,MAAMsE,KAAKF,GAASlE,SAASqE,IAC3BA,EAAI9C,iBAAiB,QAAS8B,EAAe,GAEjD,CAGEiB,GA9CF,WAEE,IAAIC,EAA6B,EAC7BC,GAAU,EAEdrJ,OAAOoG,iBAAiB,UAAU,SAAUuB,GAC1CyB,EAA6BpJ,OAAOsJ,QAE/BD,IACHrJ,OAAOwF,uBAAsB,WAzDnC,IAAuB+D,IA0DDH,EA9GkC,GAAlDzG,KAAK6G,MAAM1B,EAAO7F,wBAAwBQ,KAC5CqF,EAAOjE,UAAUM,IAAI,YAErB2D,EAAOjE,UAAUC,OAAO,YAI5B,SAAmCyF,GAC7BA,EAAYtB,EACd3F,SAASC,gBAAgBsB,UAAUC,OAAO,oBAEtCyF,EAAYxB,EACdzF,SAASC,gBAAgBsB,UAAUM,IAAI,oBAC9BoF,EAAYxB,GACrBzF,SAASC,gBAAgBsB,UAAUC,OAAO,oBAG9CiE,EAAgBwB,CAClB,CAoCEE,CAA0BF,GAlC5B,SAA6BA,GACT,OAAd1B,IAKa,GAAb0B,EACF1B,EAAU6B,SAAS,EAAG,GAGtB/G,KAAKC,KAAK2G,IACV5G,KAAK6G,MAAMlH,SAASC,gBAAgBS,aAAehD,OAAOqC,aAE1DwF,EAAU6B,SAAS,EAAG7B,EAAU7E,cAGhBV,SAASqH,cAAc,mBAc3C,CAKEC,CAAoBL,GAwDdF,GAAU,CACZ,IAEAA,GAAU,EAEd,IACArJ,OAAO6J,QACT,CA6BEC,GA1BkB,OAAdjC,GAKJ,IAAI,IAAJ,CAAY,cAAe,CACzBrH,QAAQ,EACRuJ,WAAW,EACX5J,SAAU,iBACVI,OAAQ,KACN,IAAIyJ,EAAM9H,WAAW+H,iBAAiB3H,SAASC,iBAAiB2H,UAChE,OAAOpC,EAAO7F,wBAAwBkI,OAAS,GAAMH,EAAM,CAAC,GAiBlE,CAcA1H,SAAS8D,iBAAiB,oBAT1B,WACE9D,SAASS,KAAKW,WAAWG,UAAUC,OAAO,SAE1CgE,EAASxF,SAASqH,cAAc,UAChC9B,EAAYvF,SAASqH,cAAc,eAEnCxD,GACF","sources":["webpack:///./src/furo/assets/scripts/gumshoe-patched.js","webpack:///webpack/bootstrap","webpack:///webpack/runtime/compat get default export","webpack:///webpack/runtime/define property getters","webpack:///webpack/runtime/global","webpack:///webpack/runtime/hasOwnProperty shorthand","webpack:///./src/furo/assets/scripts/furo.js"],"sourcesContent":["/*!\n * gumshoejs v5.1.2 (patched by @pradyunsg)\n * A simple, framework-agnostic scrollspy script.\n * (c) 2019 Chris Ferdinandi\n * MIT License\n * http://github.com/cferdinandi/gumshoe\n */\n\n(function (root, factory) {\n if (typeof define === \"function\" && define.amd) {\n define([], function () {\n return factory(root);\n });\n } else if (typeof exports === \"object\") {\n module.exports = factory(root);\n } else {\n root.Gumshoe = factory(root);\n }\n})(\n typeof global !== \"undefined\"\n ? global\n : typeof window !== \"undefined\"\n ? window\n : this,\n function (window) {\n \"use strict\";\n\n //\n // Defaults\n //\n\n var defaults = {\n // Active classes\n navClass: \"active\",\n contentClass: \"active\",\n\n // Nested navigation\n nested: false,\n nestedClass: \"active\",\n\n // Offset & reflow\n offset: 0,\n reflow: false,\n\n // Event support\n events: true,\n };\n\n //\n // Methods\n //\n\n /**\n * Merge two or more objects together.\n * @param {Object} objects The objects to merge together\n * @returns {Object} Merged values of defaults and options\n */\n var extend = function () {\n var merged = {};\n Array.prototype.forEach.call(arguments, function (obj) {\n for (var key in obj) {\n if (!obj.hasOwnProperty(key)) return;\n merged[key] = obj[key];\n }\n });\n return merged;\n };\n\n /**\n * Emit a custom event\n * @param {String} type The event type\n * @param {Node} elem The element to attach the event to\n * @param {Object} detail Any details to pass along with the event\n */\n var emitEvent = function (type, elem, detail) {\n // Make sure events are enabled\n if (!detail.settings.events) return;\n\n // Create a new event\n var event = new CustomEvent(type, {\n bubbles: true,\n cancelable: true,\n detail: detail,\n });\n\n // Dispatch the event\n elem.dispatchEvent(event);\n };\n\n /**\n * Get an element's distance from the top of the Document.\n * @param {Node} elem The element\n * @return {Number} Distance from the top in pixels\n */\n var getOffsetTop = function (elem) {\n var location = 0;\n if (elem.offsetParent) {\n while (elem) {\n location += elem.offsetTop;\n elem = elem.offsetParent;\n }\n }\n return location >= 0 ? location : 0;\n };\n\n /**\n * Sort content from first to last in the DOM\n * @param {Array} contents The content areas\n */\n var sortContents = function (contents) {\n if (contents) {\n contents.sort(function (item1, item2) {\n var offset1 = getOffsetTop(item1.content);\n var offset2 = getOffsetTop(item2.content);\n if (offset1 < offset2) return -1;\n return 1;\n });\n }\n };\n\n /**\n * Get the offset to use for calculating position\n * @param {Object} settings The settings for this instantiation\n * @return {Float} The number of pixels to offset the calculations\n */\n var getOffset = function (settings) {\n // if the offset is a function run it\n if (typeof settings.offset === \"function\") {\n return parseFloat(settings.offset());\n }\n\n // Otherwise, return it as-is\n return parseFloat(settings.offset);\n };\n\n /**\n * Get the document element's height\n * @private\n * @returns {Number}\n */\n var getDocumentHeight = function () {\n return Math.max(\n document.body.scrollHeight,\n document.documentElement.scrollHeight,\n document.body.offsetHeight,\n document.documentElement.offsetHeight,\n document.body.clientHeight,\n document.documentElement.clientHeight,\n );\n };\n\n /**\n * Determine if an element is in view\n * @param {Node} elem The element\n * @param {Object} settings The settings for this instantiation\n * @param {Boolean} bottom If true, check if element is above bottom of viewport instead\n * @return {Boolean} Returns true if element is in the viewport\n */\n var isInView = function (elem, settings, bottom) {\n var bounds = elem.getBoundingClientRect();\n var offset = getOffset(settings);\n if (bottom) {\n return (\n parseInt(bounds.bottom, 10) <\n (window.innerHeight || document.documentElement.clientHeight)\n );\n }\n return parseInt(bounds.top, 10) <= offset;\n };\n\n /**\n * Check if at the bottom of the viewport\n * @return {Boolean} If true, page is at the bottom of the viewport\n */\n var isAtBottom = function () {\n if (\n Math.ceil(window.innerHeight + window.pageYOffset) >=\n getDocumentHeight()\n )\n return true;\n return false;\n };\n\n /**\n * Check if the last item should be used (even if not at the top of the page)\n * @param {Object} item The last item\n * @param {Object} settings The settings for this instantiation\n * @return {Boolean} If true, use the last item\n */\n var useLastItem = function (item, settings) {\n if (isAtBottom() && isInView(item.content, settings, true)) return true;\n return false;\n };\n\n /**\n * Get the active content\n * @param {Array} contents The content areas\n * @param {Object} settings The settings for this instantiation\n * @return {Object} The content area and matching navigation link\n */\n var getActive = function (contents, settings) {\n var last = contents[contents.length - 1];\n if (useLastItem(last, settings)) return last;\n for (var i = contents.length - 1; i >= 0; i--) {\n if (isInView(contents[i].content, settings)) return contents[i];\n }\n };\n\n /**\n * Deactivate parent navs in a nested navigation\n * @param {Node} nav The starting navigation element\n * @param {Object} settings The settings for this instantiation\n */\n var deactivateNested = function (nav, settings) {\n // If nesting isn't activated, bail\n if (!settings.nested || !nav.parentNode) return;\n\n // Get the parent navigation\n var li = nav.parentNode.closest(\"li\");\n if (!li) return;\n\n // Remove the active class\n li.classList.remove(settings.nestedClass);\n\n // Apply recursively to any parent navigation elements\n deactivateNested(li, settings);\n };\n\n /**\n * Deactivate a nav and content area\n * @param {Object} items The nav item and content to deactivate\n * @param {Object} settings The settings for this instantiation\n */\n var deactivate = function (items, settings) {\n // Make sure there are items to deactivate\n if (!items) return;\n\n // Get the parent list item\n var li = items.nav.closest(\"li\");\n if (!li) return;\n\n // Remove the active class from the nav and content\n li.classList.remove(settings.navClass);\n items.content.classList.remove(settings.contentClass);\n\n // Deactivate any parent navs in a nested navigation\n deactivateNested(li, settings);\n\n // Emit a custom event\n emitEvent(\"gumshoeDeactivate\", li, {\n link: items.nav,\n content: items.content,\n settings: settings,\n });\n };\n\n /**\n * Activate parent navs in a nested navigation\n * @param {Node} nav The starting navigation element\n * @param {Object} settings The settings for this instantiation\n */\n var activateNested = function (nav, settings) {\n // If nesting isn't activated, bail\n if (!settings.nested) return;\n\n // Get the parent navigation\n var li = nav.parentNode.closest(\"li\");\n if (!li) return;\n\n // Add the active class\n li.classList.add(settings.nestedClass);\n\n // Apply recursively to any parent navigation elements\n activateNested(li, settings);\n };\n\n /**\n * Activate a nav and content area\n * @param {Object} items The nav item and content to activate\n * @param {Object} settings The settings for this instantiation\n */\n var activate = function (items, settings) {\n // Make sure there are items to activate\n if (!items) return;\n\n // Get the parent list item\n var li = items.nav.closest(\"li\");\n if (!li) return;\n\n // Add the active class to the nav and content\n li.classList.add(settings.navClass);\n items.content.classList.add(settings.contentClass);\n\n // Activate any parent navs in a nested navigation\n activateNested(li, settings);\n\n // Emit a custom event\n emitEvent(\"gumshoeActivate\", li, {\n link: items.nav,\n content: items.content,\n settings: settings,\n });\n };\n\n /**\n * Create the Constructor object\n * @param {String} selector The selector to use for navigation items\n * @param {Object} options User options and settings\n */\n var Constructor = function (selector, options) {\n //\n // Variables\n //\n\n var publicAPIs = {};\n var navItems, contents, current, timeout, settings;\n\n //\n // Methods\n //\n\n /**\n * Set variables from DOM elements\n */\n publicAPIs.setup = function () {\n // Get all nav items\n navItems = document.querySelectorAll(selector);\n\n // Create contents array\n contents = [];\n\n // Loop through each item, get it's matching content, and push to the array\n Array.prototype.forEach.call(navItems, function (item) {\n // Get the content for the nav item\n var content = document.getElementById(\n decodeURIComponent(item.hash.substr(1)),\n );\n if (!content) return;\n\n // Push to the contents array\n contents.push({\n nav: item,\n content: content,\n });\n });\n\n // Sort contents by the order they appear in the DOM\n sortContents(contents);\n };\n\n /**\n * Detect which content is currently active\n */\n publicAPIs.detect = function () {\n // Get the active content\n var active = getActive(contents, settings);\n\n // if there's no active content, deactivate and bail\n if (!active) {\n if (current) {\n deactivate(current, settings);\n current = null;\n }\n return;\n }\n\n // If the active content is the one currently active, do nothing\n if (current && active.content === current.content) return;\n\n // Deactivate the current content and activate the new content\n deactivate(current, settings);\n activate(active, settings);\n\n // Update the currently active content\n current = active;\n };\n\n /**\n * Detect the active content on scroll\n * Debounced for performance\n */\n var scrollHandler = function (event) {\n // If there's a timer, cancel it\n if (timeout) {\n window.cancelAnimationFrame(timeout);\n }\n\n // Setup debounce callback\n timeout = window.requestAnimationFrame(publicAPIs.detect);\n };\n\n /**\n * Update content sorting on resize\n * Debounced for performance\n */\n var resizeHandler = function (event) {\n // If there's a timer, cancel it\n if (timeout) {\n window.cancelAnimationFrame(timeout);\n }\n\n // Setup debounce callback\n timeout = window.requestAnimationFrame(function () {\n sortContents(contents);\n publicAPIs.detect();\n });\n };\n\n /**\n * Destroy the current instantiation\n */\n publicAPIs.destroy = function () {\n // Undo DOM changes\n if (current) {\n deactivate(current, settings);\n }\n\n // Remove event listeners\n window.removeEventListener(\"scroll\", scrollHandler, false);\n if (settings.reflow) {\n window.removeEventListener(\"resize\", resizeHandler, false);\n }\n\n // Reset variables\n contents = null;\n navItems = null;\n current = null;\n timeout = null;\n settings = null;\n };\n\n /**\n * Initialize the current instantiation\n */\n var init = function () {\n // Merge user options into defaults\n settings = extend(defaults, options || {});\n\n // Setup variables based on the current DOM\n publicAPIs.setup();\n\n // Find the currently active content\n publicAPIs.detect();\n\n // Setup event listeners\n window.addEventListener(\"scroll\", scrollHandler, false);\n if (settings.reflow) {\n window.addEventListener(\"resize\", resizeHandler, false);\n }\n };\n\n //\n // Initialize and return the public APIs\n //\n\n init();\n return publicAPIs;\n };\n\n //\n // Return the Constructor\n //\n\n return Constructor;\n },\n);\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","import Gumshoe from \"./gumshoe-patched.js\";\n\n////////////////////////////////////////////////////////////////////////////////\n// Scroll Handling\n////////////////////////////////////////////////////////////////////////////////\nvar tocScroll = null;\nvar header = null;\nvar lastScrollTop = window.pageYOffset || document.documentElement.scrollTop;\nconst GO_TO_TOP_OFFSET = 64;\n\nfunction scrollHandlerForHeader() {\n if (Math.floor(header.getBoundingClientRect().top) == 0) {\n header.classList.add(\"scrolled\");\n } else {\n header.classList.remove(\"scrolled\");\n }\n}\n\nfunction scrollHandlerForBackToTop(positionY) {\n if (positionY < GO_TO_TOP_OFFSET) {\n document.documentElement.classList.remove(\"show-back-to-top\");\n } else {\n if (positionY < lastScrollTop) {\n document.documentElement.classList.add(\"show-back-to-top\");\n } else if (positionY > lastScrollTop) {\n document.documentElement.classList.remove(\"show-back-to-top\");\n }\n }\n lastScrollTop = positionY;\n}\n\nfunction scrollHandlerForTOC(positionY) {\n if (tocScroll === null) {\n return;\n }\n\n // top of page.\n if (positionY == 0) {\n tocScroll.scrollTo(0, 0);\n } else if (\n // bottom of page.\n Math.ceil(positionY) >=\n Math.floor(document.documentElement.scrollHeight - window.innerHeight)\n ) {\n tocScroll.scrollTo(0, tocScroll.scrollHeight);\n } else {\n // somewhere in the middle.\n const current = document.querySelector(\".scroll-current\");\n if (current == null) {\n return;\n }\n\n // https://github.com/pypa/pip/issues/9159 This breaks scroll behaviours.\n // // scroll the currently \"active\" heading in toc, into view.\n // const rect = current.getBoundingClientRect();\n // if (0 > rect.top) {\n // current.scrollIntoView(true); // the argument is \"alignTop\"\n // } else if (rect.bottom > window.innerHeight) {\n // current.scrollIntoView(false);\n // }\n }\n}\n\nfunction scrollHandler(positionY) {\n scrollHandlerForHeader();\n scrollHandlerForBackToTop(positionY);\n scrollHandlerForTOC(positionY);\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// Theme Toggle\n////////////////////////////////////////////////////////////////////////////////\nfunction setTheme(mode) {\n if (mode !== \"light\" && mode !== \"dark\" && mode !== \"auto\") {\n console.error(`Got invalid theme mode: ${mode}. Resetting to auto.`);\n mode = \"auto\";\n }\n\n document.body.dataset.theme = mode;\n localStorage.setItem(\"theme\", mode);\n console.log(`Changed to ${mode} mode.`);\n}\n\nfunction cycleThemeOnce() {\n const currentTheme = localStorage.getItem(\"theme\") || \"auto\";\n const prefersDark = window.matchMedia(\"(prefers-color-scheme: dark)\").matches;\n\n if (prefersDark) {\n // Auto (dark) -> Light -> Dark\n if (currentTheme === \"auto\") {\n setTheme(\"light\");\n } else if (currentTheme == \"light\") {\n setTheme(\"dark\");\n } else {\n setTheme(\"auto\");\n }\n } else {\n // Auto (light) -> Dark -> Light\n if (currentTheme === \"auto\") {\n setTheme(\"dark\");\n } else if (currentTheme == \"dark\") {\n setTheme(\"light\");\n } else {\n setTheme(\"auto\");\n }\n }\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// Setup\n////////////////////////////////////////////////////////////////////////////////\nfunction setupScrollHandler() {\n // Taken from https://developer.mozilla.org/en-US/docs/Web/API/Document/scroll_event\n let last_known_scroll_position = 0;\n let ticking = false;\n\n window.addEventListener(\"scroll\", function (e) {\n last_known_scroll_position = window.scrollY;\n\n if (!ticking) {\n window.requestAnimationFrame(function () {\n scrollHandler(last_known_scroll_position);\n ticking = false;\n });\n\n ticking = true;\n }\n });\n window.scroll();\n}\n\nfunction setupScrollSpy() {\n if (tocScroll === null) {\n return;\n }\n\n // Scrollspy -- highlight table on contents, based on scroll\n new Gumshoe(\".toc-tree a\", {\n reflow: true,\n recursive: true,\n navClass: \"scroll-current\",\n offset: () => {\n let rem = parseFloat(getComputedStyle(document.documentElement).fontSize);\n return header.getBoundingClientRect().height + 0.5 * rem + 1;\n },\n });\n}\n\nfunction setupTheme() {\n // Attach event handlers for toggling themes\n const buttons = document.getElementsByClassName(\"theme-toggle\");\n Array.from(buttons).forEach((btn) => {\n btn.addEventListener(\"click\", cycleThemeOnce);\n });\n}\n\nfunction setup() {\n setupTheme();\n setupScrollHandler();\n setupScrollSpy();\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// Main entrypoint\n////////////////////////////////////////////////////////////////////////////////\nfunction main() {\n document.body.parentNode.classList.remove(\"no-js\");\n\n header = document.querySelector(\"header\");\n tocScroll = document.querySelector(\".toc-scroll\");\n\n setup();\n}\n\ndocument.addEventListener(\"DOMContentLoaded\", main);\n"],"names":["root","g","window","this","defaults","navClass","contentClass","nested","nestedClass","offset","reflow","events","emitEvent","type","elem","detail","settings","event","CustomEvent","bubbles","cancelable","dispatchEvent","getOffsetTop","location","offsetParent","offsetTop","sortContents","contents","sort","item1","item2","content","isInView","bottom","bounds","getBoundingClientRect","parseFloat","getOffset","parseInt","innerHeight","document","documentElement","clientHeight","top","isAtBottom","Math","ceil","pageYOffset","max","body","scrollHeight","offsetHeight","getActive","last","length","item","useLastItem","i","deactivateNested","nav","parentNode","li","closest","classList","remove","deactivate","items","link","activateNested","add","selector","options","navItems","current","timeout","publicAPIs","querySelectorAll","Array","prototype","forEach","call","getElementById","decodeURIComponent","hash","substr","push","active","activate","scrollHandler","cancelAnimationFrame","requestAnimationFrame","detect","resizeHandler","destroy","removeEventListener","merged","arguments","obj","key","hasOwnProperty","extend","setup","addEventListener","factory","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","exports","module","__webpack_modules__","n","getter","__esModule","d","a","definition","o","Object","defineProperty","enumerable","get","globalThis","Function","e","prop","tocScroll","header","lastScrollTop","scrollTop","GO_TO_TOP_OFFSET","cycleThemeOnce","currentTheme","localStorage","getItem","mode","matchMedia","matches","console","error","dataset","theme","setItem","log","buttons","getElementsByClassName","from","btn","setupTheme","last_known_scroll_position","ticking","scrollY","positionY","floor","scrollHandlerForBackToTop","scrollTo","querySelector","scrollHandlerForTOC","scroll","setupScrollHandler","recursive","rem","getComputedStyle","fontSize","height"],"sourceRoot":""}
\ No newline at end of file
diff --git a/docs/_static/searchtools.js b/docs/_static/searchtools.js
new file mode 100644
index 0000000..97d56a7
--- /dev/null
+++ b/docs/_static/searchtools.js
@@ -0,0 +1,566 @@
+/*
+ * searchtools.js
+ * ~~~~~~~~~~~~~~~~
+ *
+ * Sphinx JavaScript utilities for the full-text search.
+ *
+ * :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
+ * :license: BSD, see LICENSE for details.
+ *
+ */
+"use strict";
+
+/**
+ * Simple result scoring code.
+ */
+if (typeof Scorer === "undefined") {
+ var Scorer = {
+ // Implement the following function to further tweak the score for each result
+ // The function takes a result array [docname, title, anchor, descr, score, filename]
+ // and returns the new score.
+ /*
+ score: result => {
+ const [docname, title, anchor, descr, score, filename] = result
+ return score
+ },
+ */
+
+ // query matches the full name of an object
+ objNameMatch: 11,
+ // or matches in the last dotted part of the object name
+ objPartialMatch: 6,
+ // Additive scores depending on the priority of the object
+ objPrio: {
+ 0: 15, // used to be importantResults
+ 1: 5, // used to be objectResults
+ 2: -5, // used to be unimportantResults
+ },
+ // Used when the priority is not in the mapping.
+ objPrioDefault: 0,
+
+ // query found in title
+ title: 15,
+ partialTitle: 7,
+ // query found in terms
+ term: 5,
+ partialTerm: 2,
+ };
+}
+
+const _removeChildren = (element) => {
+ while (element && element.lastChild) element.removeChild(element.lastChild);
+};
+
+/**
+ * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping
+ */
+const _escapeRegExp = (string) =>
+ string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
+
+const _displayItem = (item, searchTerms) => {
+ const docBuilder = DOCUMENTATION_OPTIONS.BUILDER;
+ const docUrlRoot = DOCUMENTATION_OPTIONS.URL_ROOT;
+ const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX;
+ const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX;
+ const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY;
+
+ const [docName, title, anchor, descr, score, _filename] = item;
+
+ let listItem = document.createElement("li");
+ let requestUrl;
+ let linkUrl;
+ if (docBuilder === "dirhtml") {
+ // dirhtml builder
+ let dirname = docName + "/";
+ if (dirname.match(/\/index\/$/))
+ dirname = dirname.substring(0, dirname.length - 6);
+ else if (dirname === "index/") dirname = "";
+ requestUrl = docUrlRoot + dirname;
+ linkUrl = requestUrl;
+ } else {
+ // normal html builders
+ requestUrl = docUrlRoot + docName + docFileSuffix;
+ linkUrl = docName + docLinkSuffix;
+ }
+ let linkEl = listItem.appendChild(document.createElement("a"));
+ linkEl.href = linkUrl + anchor;
+ linkEl.dataset.score = score;
+ linkEl.innerHTML = title;
+ if (descr)
+ listItem.appendChild(document.createElement("span")).innerHTML =
+ " (" + descr + ")";
+ else if (showSearchSummary)
+ fetch(requestUrl)
+ .then((responseData) => responseData.text())
+ .then((data) => {
+ if (data)
+ listItem.appendChild(
+ Search.makeSearchSummary(data, searchTerms)
+ );
+ });
+ Search.output.appendChild(listItem);
+};
+const _finishSearch = (resultCount) => {
+ Search.stopPulse();
+ Search.title.innerText = _("Search Results");
+ if (!resultCount)
+ Search.status.innerText = Documentation.gettext(
+ "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories."
+ );
+ else
+ Search.status.innerText = _(
+ `Search finished, found ${resultCount} page(s) matching the search query.`
+ );
+};
+const _displayNextItem = (
+ results,
+ resultCount,
+ searchTerms
+) => {
+ // results left, load the summary and display it
+ // this is intended to be dynamic (don't sub resultsCount)
+ if (results.length) {
+ _displayItem(results.pop(), searchTerms);
+ setTimeout(
+ () => _displayNextItem(results, resultCount, searchTerms),
+ 5
+ );
+ }
+ // search finished, update title and status message
+ else _finishSearch(resultCount);
+};
+
+/**
+ * Default splitQuery function. Can be overridden in ``sphinx.search`` with a
+ * custom function per language.
+ *
+ * The regular expression works by splitting the string on consecutive characters
+ * that are not Unicode letters, numbers, underscores, or emoji characters.
+ * This is the same as ``\W+`` in Python, preserving the surrogate pair area.
+ */
+if (typeof splitQuery === "undefined") {
+ var splitQuery = (query) => query
+ .split(/[^\p{Letter}\p{Number}_\p{Emoji_Presentation}]+/gu)
+ .filter(term => term) // remove remaining empty strings
+}
+
+/**
+ * Search Module
+ */
+const Search = {
+ _index: null,
+ _queued_query: null,
+ _pulse_status: -1,
+
+ htmlToText: (htmlString) => {
+ const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html');
+ htmlElement.querySelectorAll(".headerlink").forEach((el) => { el.remove() });
+ const docContent = htmlElement.querySelector('[role="main"]');
+ if (docContent !== undefined) return docContent.textContent;
+ console.warn(
+ "Content block not found. Sphinx search tries to obtain it via '[role=main]'. Could you check your theme or template."
+ );
+ return "";
+ },
+
+ init: () => {
+ const query = new URLSearchParams(window.location.search).get("q");
+ document
+ .querySelectorAll('input[name="q"]')
+ .forEach((el) => (el.value = query));
+ if (query) Search.performSearch(query);
+ },
+
+ loadIndex: (url) =>
+ (document.body.appendChild(document.createElement("script")).src = url),
+
+ setIndex: (index) => {
+ Search._index = index;
+ if (Search._queued_query !== null) {
+ const query = Search._queued_query;
+ Search._queued_query = null;
+ Search.query(query);
+ }
+ },
+
+ hasIndex: () => Search._index !== null,
+
+ deferQuery: (query) => (Search._queued_query = query),
+
+ stopPulse: () => (Search._pulse_status = -1),
+
+ startPulse: () => {
+ if (Search._pulse_status >= 0) return;
+
+ const pulse = () => {
+ Search._pulse_status = (Search._pulse_status + 1) % 4;
+ Search.dots.innerText = ".".repeat(Search._pulse_status);
+ if (Search._pulse_status >= 0) window.setTimeout(pulse, 500);
+ };
+ pulse();
+ },
+
+ /**
+ * perform a search for something (or wait until index is loaded)
+ */
+ performSearch: (query) => {
+ // create the required interface elements
+ const searchText = document.createElement("h2");
+ searchText.textContent = _("Searching");
+ const searchSummary = document.createElement("p");
+ searchSummary.classList.add("search-summary");
+ searchSummary.innerText = "";
+ const searchList = document.createElement("ul");
+ searchList.classList.add("search");
+
+ const out = document.getElementById("search-results");
+ Search.title = out.appendChild(searchText);
+ Search.dots = Search.title.appendChild(document.createElement("span"));
+ Search.status = out.appendChild(searchSummary);
+ Search.output = out.appendChild(searchList);
+
+ const searchProgress = document.getElementById("search-progress");
+ // Some themes don't use the search progress node
+ if (searchProgress) {
+ searchProgress.innerText = _("Preparing search...");
+ }
+ Search.startPulse();
+
+ // index already loaded, the browser was quick!
+ if (Search.hasIndex()) Search.query(query);
+ else Search.deferQuery(query);
+ },
+
+ /**
+ * execute search (requires search index to be loaded)
+ */
+ query: (query) => {
+ const filenames = Search._index.filenames;
+ const docNames = Search._index.docnames;
+ const titles = Search._index.titles;
+ const allTitles = Search._index.alltitles;
+ const indexEntries = Search._index.indexentries;
+
+ // stem the search terms and add them to the correct list
+ const stemmer = new Stemmer();
+ const searchTerms = new Set();
+ const excludedTerms = new Set();
+ const highlightTerms = new Set();
+ const objectTerms = new Set(splitQuery(query.toLowerCase().trim()));
+ splitQuery(query.trim()).forEach((queryTerm) => {
+ const queryTermLower = queryTerm.toLowerCase();
+
+ // maybe skip this "word"
+ // stopwords array is from language_data.js
+ if (
+ stopwords.indexOf(queryTermLower) !== -1 ||
+ queryTerm.match(/^\d+$/)
+ )
+ return;
+
+ // stem the word
+ let word = stemmer.stemWord(queryTermLower);
+ // select the correct list
+ if (word[0] === "-") excludedTerms.add(word.substr(1));
+ else {
+ searchTerms.add(word);
+ highlightTerms.add(queryTermLower);
+ }
+ });
+
+ if (SPHINX_HIGHLIGHT_ENABLED) { // set in sphinx_highlight.js
+ localStorage.setItem("sphinx_highlight_terms", [...highlightTerms].join(" "))
+ }
+
+ // console.debug("SEARCH: searching for:");
+ // console.info("required: ", [...searchTerms]);
+ // console.info("excluded: ", [...excludedTerms]);
+
+ // array of [docname, title, anchor, descr, score, filename]
+ let results = [];
+ _removeChildren(document.getElementById("search-progress"));
+
+ const queryLower = query.toLowerCase();
+ for (const [title, foundTitles] of Object.entries(allTitles)) {
+ if (title.toLowerCase().includes(queryLower) && (queryLower.length >= title.length/2)) {
+ for (const [file, id] of foundTitles) {
+ let score = Math.round(100 * queryLower.length / title.length)
+ results.push([
+ docNames[file],
+ titles[file] !== title ? `${titles[file]} > ${title}` : title,
+ id !== null ? "#" + id : "",
+ null,
+ score,
+ filenames[file],
+ ]);
+ }
+ }
+ }
+
+ // search for explicit entries in index directives
+ for (const [entry, foundEntries] of Object.entries(indexEntries)) {
+ if (entry.includes(queryLower) && (queryLower.length >= entry.length/2)) {
+ for (const [file, id] of foundEntries) {
+ let score = Math.round(100 * queryLower.length / entry.length)
+ results.push([
+ docNames[file],
+ titles[file],
+ id ? "#" + id : "",
+ null,
+ score,
+ filenames[file],
+ ]);
+ }
+ }
+ }
+
+ // lookup as object
+ objectTerms.forEach((term) =>
+ results.push(...Search.performObjectSearch(term, objectTerms))
+ );
+
+ // lookup as search terms in fulltext
+ results.push(...Search.performTermsSearch(searchTerms, excludedTerms));
+
+ // let the scorer override scores with a custom scoring function
+ if (Scorer.score) results.forEach((item) => (item[4] = Scorer.score(item)));
+
+ // now sort the results by score (in opposite order of appearance, since the
+ // display function below uses pop() to retrieve items) and then
+ // alphabetically
+ results.sort((a, b) => {
+ const leftScore = a[4];
+ const rightScore = b[4];
+ if (leftScore === rightScore) {
+ // same score: sort alphabetically
+ const leftTitle = a[1].toLowerCase();
+ const rightTitle = b[1].toLowerCase();
+ if (leftTitle === rightTitle) return 0;
+ return leftTitle > rightTitle ? -1 : 1; // inverted is intentional
+ }
+ return leftScore > rightScore ? 1 : -1;
+ });
+
+ // remove duplicate search results
+ // note the reversing of results, so that in the case of duplicates, the highest-scoring entry is kept
+ let seen = new Set();
+ results = results.reverse().reduce((acc, result) => {
+ let resultStr = result.slice(0, 4).concat([result[5]]).map(v => String(v)).join(',');
+ if (!seen.has(resultStr)) {
+ acc.push(result);
+ seen.add(resultStr);
+ }
+ return acc;
+ }, []);
+
+ results = results.reverse();
+
+ // for debugging
+ //Search.lastresults = results.slice(); // a copy
+ // console.info("search results:", Search.lastresults);
+
+ // print the results
+ _displayNextItem(results, results.length, searchTerms);
+ },
+
+ /**
+ * search for object names
+ */
+ performObjectSearch: (object, objectTerms) => {
+ const filenames = Search._index.filenames;
+ const docNames = Search._index.docnames;
+ const objects = Search._index.objects;
+ const objNames = Search._index.objnames;
+ const titles = Search._index.titles;
+
+ const results = [];
+
+ const objectSearchCallback = (prefix, match) => {
+ const name = match[4]
+ const fullname = (prefix ? prefix + "." : "") + name;
+ const fullnameLower = fullname.toLowerCase();
+ if (fullnameLower.indexOf(object) < 0) return;
+
+ let score = 0;
+ const parts = fullnameLower.split(".");
+
+ // check for different match types: exact matches of full name or
+ // "last name" (i.e. last dotted part)
+ if (fullnameLower === object || parts.slice(-1)[0] === object)
+ score += Scorer.objNameMatch;
+ else if (parts.slice(-1)[0].indexOf(object) > -1)
+ score += Scorer.objPartialMatch; // matches in last name
+
+ const objName = objNames[match[1]][2];
+ const title = titles[match[0]];
+
+ // If more than one term searched for, we require other words to be
+ // found in the name/title/description
+ const otherTerms = new Set(objectTerms);
+ otherTerms.delete(object);
+ if (otherTerms.size > 0) {
+ const haystack = `${prefix} ${name} ${objName} ${title}`.toLowerCase();
+ if (
+ [...otherTerms].some((otherTerm) => haystack.indexOf(otherTerm) < 0)
+ )
+ return;
+ }
+
+ let anchor = match[3];
+ if (anchor === "") anchor = fullname;
+ else if (anchor === "-") anchor = objNames[match[1]][1] + "-" + fullname;
+
+ const descr = objName + _(", in ") + title;
+
+ // add custom score for some objects according to scorer
+ if (Scorer.objPrio.hasOwnProperty(match[2]))
+ score += Scorer.objPrio[match[2]];
+ else score += Scorer.objPrioDefault;
+
+ results.push([
+ docNames[match[0]],
+ fullname,
+ "#" + anchor,
+ descr,
+ score,
+ filenames[match[0]],
+ ]);
+ };
+ Object.keys(objects).forEach((prefix) =>
+ objects[prefix].forEach((array) =>
+ objectSearchCallback(prefix, array)
+ )
+ );
+ return results;
+ },
+
+ /**
+ * search for full-text terms in the index
+ */
+ performTermsSearch: (searchTerms, excludedTerms) => {
+ // prepare search
+ const terms = Search._index.terms;
+ const titleTerms = Search._index.titleterms;
+ const filenames = Search._index.filenames;
+ const docNames = Search._index.docnames;
+ const titles = Search._index.titles;
+
+ const scoreMap = new Map();
+ const fileMap = new Map();
+
+ // perform the search on the required terms
+ searchTerms.forEach((word) => {
+ const files = [];
+ const arr = [
+ { files: terms[word], score: Scorer.term },
+ { files: titleTerms[word], score: Scorer.title },
+ ];
+ // add support for partial matches
+ if (word.length > 2) {
+ const escapedWord = _escapeRegExp(word);
+ Object.keys(terms).forEach((term) => {
+ if (term.match(escapedWord) && !terms[word])
+ arr.push({ files: terms[term], score: Scorer.partialTerm });
+ });
+ Object.keys(titleTerms).forEach((term) => {
+ if (term.match(escapedWord) && !titleTerms[word])
+ arr.push({ files: titleTerms[word], score: Scorer.partialTitle });
+ });
+ }
+
+ // no match but word was a required one
+ if (arr.every((record) => record.files === undefined)) return;
+
+ // found search word in contents
+ arr.forEach((record) => {
+ if (record.files === undefined) return;
+
+ let recordFiles = record.files;
+ if (recordFiles.length === undefined) recordFiles = [recordFiles];
+ files.push(...recordFiles);
+
+ // set score for the word in each file
+ recordFiles.forEach((file) => {
+ if (!scoreMap.has(file)) scoreMap.set(file, {});
+ scoreMap.get(file)[word] = record.score;
+ });
+ });
+
+ // create the mapping
+ files.forEach((file) => {
+ if (fileMap.has(file) && fileMap.get(file).indexOf(word) === -1)
+ fileMap.get(file).push(word);
+ else fileMap.set(file, [word]);
+ });
+ });
+
+ // now check if the files don't contain excluded terms
+ const results = [];
+ for (const [file, wordList] of fileMap) {
+ // check if all requirements are matched
+
+ // as search terms with length < 3 are discarded
+ const filteredTermCount = [...searchTerms].filter(
+ (term) => term.length > 2
+ ).length;
+ if (
+ wordList.length !== searchTerms.size &&
+ wordList.length !== filteredTermCount
+ )
+ continue;
+
+ // ensure that none of the excluded terms is in the search result
+ if (
+ [...excludedTerms].some(
+ (term) =>
+ terms[term] === file ||
+ titleTerms[term] === file ||
+ (terms[term] || []).includes(file) ||
+ (titleTerms[term] || []).includes(file)
+ )
+ )
+ break;
+
+ // select one (max) score for the file.
+ const score = Math.max(...wordList.map((w) => scoreMap.get(file)[w]));
+ // add result to the result list
+ results.push([
+ docNames[file],
+ titles[file],
+ "",
+ null,
+ score,
+ filenames[file],
+ ]);
+ }
+ return results;
+ },
+
+ /**
+ * helper function to return a node containing the
+ * search summary for a given text. keywords is a list
+ * of stemmed words.
+ */
+ makeSearchSummary: (htmlText, keywords) => {
+ const text = Search.htmlToText(htmlText);
+ if (text === "") return null;
+
+ const textLower = text.toLowerCase();
+ const actualStartPosition = [...keywords]
+ .map((k) => textLower.indexOf(k.toLowerCase()))
+ .filter((i) => i > -1)
+ .slice(-1)[0];
+ const startWithContext = Math.max(actualStartPosition - 120, 0);
+
+ const top = startWithContext === 0 ? "" : "...";
+ const tail = startWithContext + 240 < text.length ? "..." : "";
+
+ let summary = document.createElement("p");
+ summary.classList.add("context");
+ summary.textContent = top + text.substr(startWithContext, 240).trim() + tail;
+
+ return summary;
+ },
+};
+
+_ready(Search.init);
diff --git a/docs/_static/skeleton.css b/docs/_static/skeleton.css
new file mode 100644
index 0000000..467c878
--- /dev/null
+++ b/docs/_static/skeleton.css
@@ -0,0 +1,296 @@
+/* Some sane resets. */
+html {
+ height: 100%;
+}
+
+body {
+ margin: 0;
+ min-height: 100%;
+}
+
+/* All the flexbox magic! */
+body,
+.sb-announcement,
+.sb-content,
+.sb-main,
+.sb-container,
+.sb-container__inner,
+.sb-article-container,
+.sb-footer-content,
+.sb-header,
+.sb-header-secondary,
+.sb-footer {
+ display: flex;
+}
+
+/* These order things vertically */
+body,
+.sb-main,
+.sb-article-container {
+ flex-direction: column;
+}
+
+/* Put elements in the center */
+.sb-header,
+.sb-header-secondary,
+.sb-container,
+.sb-content,
+.sb-footer,
+.sb-footer-content {
+ justify-content: center;
+}
+/* Put elements at the ends */
+.sb-article-container {
+ justify-content: space-between;
+}
+
+/* These elements grow. */
+.sb-main,
+.sb-content,
+.sb-container,
+article {
+ flex-grow: 1;
+}
+
+/* Because padding making this wider is not fun */
+article {
+ box-sizing: border-box;
+}
+
+/* The announcements element should never be wider than the page. */
+.sb-announcement {
+ max-width: 100%;
+}
+
+.sb-sidebar-primary,
+.sb-sidebar-secondary {
+ flex-shrink: 0;
+ width: 17rem;
+}
+
+.sb-announcement__inner {
+ justify-content: center;
+
+ box-sizing: border-box;
+ height: 3rem;
+
+ overflow-x: auto;
+ white-space: nowrap;
+}
+
+/* Sidebars, with checkbox-based toggle */
+.sb-sidebar-primary,
+.sb-sidebar-secondary {
+ position: fixed;
+ height: 100%;
+ top: 0;
+}
+
+.sb-sidebar-primary {
+ left: -17rem;
+ transition: left 250ms ease-in-out;
+}
+.sb-sidebar-secondary {
+ right: -17rem;
+ transition: right 250ms ease-in-out;
+}
+
+.sb-sidebar-toggle {
+ display: none;
+}
+.sb-sidebar-overlay {
+ position: fixed;
+ top: 0;
+ width: 0;
+ height: 0;
+
+ transition: width 0ms ease 250ms, height 0ms ease 250ms, opacity 250ms ease;
+
+ opacity: 0;
+ background-color: rgba(0, 0, 0, 0.54);
+}
+
+#sb-sidebar-toggle--primary:checked
+ ~ .sb-sidebar-overlay[for="sb-sidebar-toggle--primary"],
+#sb-sidebar-toggle--secondary:checked
+ ~ .sb-sidebar-overlay[for="sb-sidebar-toggle--secondary"] {
+ width: 100%;
+ height: 100%;
+ opacity: 1;
+ transition: width 0ms ease, height 0ms ease, opacity 250ms ease;
+}
+
+#sb-sidebar-toggle--primary:checked ~ .sb-container .sb-sidebar-primary {
+ left: 0;
+}
+#sb-sidebar-toggle--secondary:checked ~ .sb-container .sb-sidebar-secondary {
+ right: 0;
+}
+
+/* Full-width mode */
+.drop-secondary-sidebar-for-full-width-content
+ .hide-when-secondary-sidebar-shown {
+ display: none !important;
+}
+.drop-secondary-sidebar-for-full-width-content .sb-sidebar-secondary {
+ display: none !important;
+}
+
+/* Mobile views */
+.sb-page-width {
+ width: 100%;
+}
+
+.sb-article-container,
+.sb-footer-content__inner,
+.drop-secondary-sidebar-for-full-width-content .sb-article,
+.drop-secondary-sidebar-for-full-width-content .match-content-width {
+ width: 100vw;
+}
+
+.sb-article,
+.match-content-width {
+ padding: 0 1rem;
+ box-sizing: border-box;
+}
+
+@media (min-width: 32rem) {
+ .sb-article,
+ .match-content-width {
+ padding: 0 2rem;
+ }
+}
+
+/* Tablet views */
+@media (min-width: 42rem) {
+ .sb-article-container {
+ width: auto;
+ }
+ .sb-footer-content__inner,
+ .drop-secondary-sidebar-for-full-width-content .sb-article,
+ .drop-secondary-sidebar-for-full-width-content .match-content-width {
+ width: 42rem;
+ }
+ .sb-article,
+ .match-content-width {
+ width: 42rem;
+ }
+}
+@media (min-width: 46rem) {
+ .sb-footer-content__inner,
+ .drop-secondary-sidebar-for-full-width-content .sb-article,
+ .drop-secondary-sidebar-for-full-width-content .match-content-width {
+ width: 46rem;
+ }
+ .sb-article,
+ .match-content-width {
+ width: 46rem;
+ }
+}
+@media (min-width: 50rem) {
+ .sb-footer-content__inner,
+ .drop-secondary-sidebar-for-full-width-content .sb-article,
+ .drop-secondary-sidebar-for-full-width-content .match-content-width {
+ width: 50rem;
+ }
+ .sb-article,
+ .match-content-width {
+ width: 50rem;
+ }
+}
+
+/* Tablet views */
+@media (min-width: 59rem) {
+ .sb-sidebar-secondary {
+ position: static;
+ }
+ .hide-when-secondary-sidebar-shown {
+ display: none !important;
+ }
+ .sb-footer-content__inner,
+ .drop-secondary-sidebar-for-full-width-content .sb-article,
+ .drop-secondary-sidebar-for-full-width-content .match-content-width {
+ width: 59rem;
+ }
+ .sb-article,
+ .match-content-width {
+ width: 42rem;
+ }
+}
+@media (min-width: 63rem) {
+ .sb-footer-content__inner,
+ .drop-secondary-sidebar-for-full-width-content .sb-article,
+ .drop-secondary-sidebar-for-full-width-content .match-content-width {
+ width: 63rem;
+ }
+ .sb-article,
+ .match-content-width {
+ width: 46rem;
+ }
+}
+@media (min-width: 67rem) {
+ .sb-footer-content__inner,
+ .drop-secondary-sidebar-for-full-width-content .sb-article,
+ .drop-secondary-sidebar-for-full-width-content .match-content-width {
+ width: 67rem;
+ }
+ .sb-article,
+ .match-content-width {
+ width: 50rem;
+ }
+}
+
+/* Desktop views */
+@media (min-width: 76rem) {
+ .sb-sidebar-primary {
+ position: static;
+ }
+ .hide-when-primary-sidebar-shown {
+ display: none !important;
+ }
+ .sb-footer-content__inner,
+ .drop-secondary-sidebar-for-full-width-content .sb-article,
+ .drop-secondary-sidebar-for-full-width-content .match-content-width {
+ width: 59rem;
+ }
+ .sb-article,
+ .match-content-width {
+ width: 42rem;
+ }
+}
+
+/* Full desktop views */
+@media (min-width: 80rem) {
+ .sb-article,
+ .match-content-width {
+ width: 46rem;
+ }
+ .sb-footer-content__inner,
+ .drop-secondary-sidebar-for-full-width-content .sb-article,
+ .drop-secondary-sidebar-for-full-width-content .match-content-width {
+ width: 63rem;
+ }
+}
+
+@media (min-width: 84rem) {
+ .sb-article,
+ .match-content-width {
+ width: 50rem;
+ }
+ .sb-footer-content__inner,
+ .drop-secondary-sidebar-for-full-width-content .sb-article,
+ .drop-secondary-sidebar-for-full-width-content .match-content-width {
+ width: 67rem;
+ }
+}
+
+@media (min-width: 88rem) {
+ .sb-footer-content__inner,
+ .drop-secondary-sidebar-for-full-width-content .sb-article,
+ .drop-secondary-sidebar-for-full-width-content .match-content-width {
+ width: 67rem;
+ }
+ .sb-page-width {
+ width: 88rem;
+ }
+}
diff --git a/docs/_static/sphinx_highlight.js b/docs/_static/sphinx_highlight.js
new file mode 100644
index 0000000..aae669d
--- /dev/null
+++ b/docs/_static/sphinx_highlight.js
@@ -0,0 +1,144 @@
+/* Highlighting utilities for Sphinx HTML documentation. */
+"use strict";
+
+const SPHINX_HIGHLIGHT_ENABLED = true
+
+/**
+ * highlight a given string on a node by wrapping it in
+ * span elements with the given class name.
+ */
+const _highlight = (node, addItems, text, className) => {
+ if (node.nodeType === Node.TEXT_NODE) {
+ const val = node.nodeValue;
+ const parent = node.parentNode;
+ const pos = val.toLowerCase().indexOf(text);
+ if (
+ pos >= 0 &&
+ !parent.classList.contains(className) &&
+ !parent.classList.contains("nohighlight")
+ ) {
+ let span;
+
+ const closestNode = parent.closest("body, svg, foreignObject");
+ const isInSVG = closestNode && closestNode.matches("svg");
+ if (isInSVG) {
+ span = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
+ } else {
+ span = document.createElement("span");
+ span.classList.add(className);
+ }
+
+ span.appendChild(document.createTextNode(val.substr(pos, text.length)));
+ parent.insertBefore(
+ span,
+ parent.insertBefore(
+ document.createTextNode(val.substr(pos + text.length)),
+ node.nextSibling
+ )
+ );
+ node.nodeValue = val.substr(0, pos);
+
+ if (isInSVG) {
+ const rect = document.createElementNS(
+ "http://www.w3.org/2000/svg",
+ "rect"
+ );
+ const bbox = parent.getBBox();
+ rect.x.baseVal.value = bbox.x;
+ rect.y.baseVal.value = bbox.y;
+ rect.width.baseVal.value = bbox.width;
+ rect.height.baseVal.value = bbox.height;
+ rect.setAttribute("class", className);
+ addItems.push({ parent: parent, target: rect });
+ }
+ }
+ } else if (node.matches && !node.matches("button, select, textarea")) {
+ node.childNodes.forEach((el) => _highlight(el, addItems, text, className));
+ }
+};
+const _highlightText = (thisNode, text, className) => {
+ let addItems = [];
+ _highlight(thisNode, addItems, text, className);
+ addItems.forEach((obj) =>
+ obj.parent.insertAdjacentElement("beforebegin", obj.target)
+ );
+};
+
+/**
+ * Small JavaScript module for the documentation.
+ */
+const SphinxHighlight = {
+
+ /**
+ * highlight the search words provided in localstorage in the text
+ */
+ highlightSearchWords: () => {
+ if (!SPHINX_HIGHLIGHT_ENABLED) return; // bail if no highlight
+
+ // get and clear terms from localstorage
+ const url = new URL(window.location);
+ const highlight =
+ localStorage.getItem("sphinx_highlight_terms")
+ || url.searchParams.get("highlight")
+ || "";
+ localStorage.removeItem("sphinx_highlight_terms")
+ url.searchParams.delete("highlight");
+ window.history.replaceState({}, "", url);
+
+ // get individual terms from highlight string
+ const terms = highlight.toLowerCase().split(/\s+/).filter(x => x);
+ if (terms.length === 0) return; // nothing to do
+
+ // There should never be more than one element matching "div.body"
+ const divBody = document.querySelectorAll("div.body");
+ const body = divBody.length ? divBody[0] : document.querySelector("body");
+ window.setTimeout(() => {
+ terms.forEach((term) => _highlightText(body, term, "highlighted"));
+ }, 10);
+
+ const searchBox = document.getElementById("searchbox");
+ if (searchBox === null) return;
+ searchBox.appendChild(
+ document
+ .createRange()
+ .createContextualFragment(
+ ' ' +
+ '' +
+ _("Hide Search Matches") +
+ "
"
+ )
+ );
+ },
+
+ /**
+ * helper function to hide the search marks again
+ */
+ hideSearchWords: () => {
+ document
+ .querySelectorAll("#searchbox .highlight-link")
+ .forEach((el) => el.remove());
+ document
+ .querySelectorAll("span.highlighted")
+ .forEach((el) => el.classList.remove("highlighted"));
+ localStorage.removeItem("sphinx_highlight_terms")
+ },
+
+ initEscapeListener: () => {
+ // only install a listener if it is really needed
+ if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) return;
+
+ document.addEventListener("keydown", (event) => {
+ // bail for input elements
+ if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return;
+ // bail with special keys
+ if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return;
+ if (DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS && (event.key === "Escape")) {
+ SphinxHighlight.hideSearchWords();
+ event.preventDefault();
+ }
+ });
+ },
+};
+
+_ready(SphinxHighlight.highlightSearchWords);
+_ready(SphinxHighlight.initEscapeListener);
diff --git a/docs/_static/styles/furo-extensions.css b/docs/_static/styles/furo-extensions.css
new file mode 100644
index 0000000..bc447f2
--- /dev/null
+++ b/docs/_static/styles/furo-extensions.css
@@ -0,0 +1,2 @@
+#furo-sidebar-ad-placement{padding:var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal)}#furo-sidebar-ad-placement .ethical-sidebar{background:var(--color-background-secondary);border:none;box-shadow:none}#furo-sidebar-ad-placement .ethical-sidebar:hover{background:var(--color-background-hover)}#furo-sidebar-ad-placement .ethical-sidebar a{color:var(--color-foreground-primary)}#furo-sidebar-ad-placement .ethical-callout a{color:var(--color-foreground-secondary)!important}#furo-readthedocs-versions{background:transparent;display:block;position:static;width:100%}#furo-readthedocs-versions .rst-versions{background:#1a1c1e}#furo-readthedocs-versions .rst-current-version{background:var(--color-sidebar-item-background);cursor:unset}#furo-readthedocs-versions .rst-current-version:hover{background:var(--color-sidebar-item-background)}#furo-readthedocs-versions .rst-current-version .fa-book{color:var(--color-foreground-primary)}#furo-readthedocs-versions>.rst-other-versions{padding:0}#furo-readthedocs-versions>.rst-other-versions small{opacity:1}#furo-readthedocs-versions .injected .rst-versions{position:unset}#furo-readthedocs-versions:focus-within,#furo-readthedocs-versions:hover{box-shadow:0 0 0 1px var(--color-sidebar-background-border)}#furo-readthedocs-versions:focus-within .rst-current-version,#furo-readthedocs-versions:hover .rst-current-version{background:#1a1c1e;font-size:inherit;height:auto;line-height:inherit;padding:12px;text-align:right}#furo-readthedocs-versions:focus-within .rst-current-version .fa-book,#furo-readthedocs-versions:hover .rst-current-version .fa-book{color:#fff;float:left}#furo-readthedocs-versions:focus-within .fa-caret-down,#furo-readthedocs-versions:hover .fa-caret-down{display:none}#furo-readthedocs-versions:focus-within .injected,#furo-readthedocs-versions:focus-within .rst-current-version,#furo-readthedocs-versions:focus-within .rst-other-versions,#furo-readthedocs-versions:hover .injected,#furo-readthedocs-versions:hover .rst-current-version,#furo-readthedocs-versions:hover .rst-other-versions{display:block}#furo-readthedocs-versions:focus-within>.rst-current-version,#furo-readthedocs-versions:hover>.rst-current-version{display:none}.highlight:hover button.copybtn{color:var(--color-code-foreground)}.highlight button.copybtn{align-items:center;background-color:var(--color-code-background);border:none;color:var(--color-background-item);cursor:pointer;height:1.25em;opacity:1;right:.5rem;top:.625rem;transition:color .3s,opacity .3s;width:1.25em}.highlight button.copybtn:hover{background-color:var(--color-code-background);color:var(--color-brand-content)}.highlight button.copybtn:after{background-color:transparent;color:var(--color-code-foreground);display:none}.highlight button.copybtn.success{color:#22863a;transition:color 0ms}.highlight button.copybtn.success:after{display:block}.highlight button.copybtn svg{padding:0}body{--sd-color-primary:var(--color-brand-primary);--sd-color-primary-highlight:var(--color-brand-content);--sd-color-primary-text:var(--color-background-primary);--sd-color-shadow:rgba(0,0,0,.05);--sd-color-card-border:var(--color-card-border);--sd-color-card-border-hover:var(--color-brand-content);--sd-color-card-background:var(--color-card-background);--sd-color-card-text:var(--color-foreground-primary);--sd-color-card-header:var(--color-card-marginals-background);--sd-color-card-footer:var(--color-card-marginals-background);--sd-color-tabs-label-active:var(--color-brand-content);--sd-color-tabs-label-hover:var(--color-foreground-muted);--sd-color-tabs-label-inactive:var(--color-foreground-muted);--sd-color-tabs-underline-active:var(--color-brand-content);--sd-color-tabs-underline-hover:var(--color-foreground-border);--sd-color-tabs-underline-inactive:var(--color-background-border);--sd-color-tabs-overline:var(--color-background-border);--sd-color-tabs-underline:var(--color-background-border)}.sd-tab-content{box-shadow:0 -2px var(--sd-color-tabs-overline),0 1px var(--sd-color-tabs-underline)}.sd-card{box-shadow:0 .1rem .25rem var(--sd-color-shadow),0 0 .0625rem rgba(0,0,0,.1)}.sd-shadow-sm{box-shadow:0 .1rem .25rem var(--sd-color-shadow),0 0 .0625rem rgba(0,0,0,.1)!important}.sd-shadow-md{box-shadow:0 .3rem .75rem var(--sd-color-shadow),0 0 .0625rem rgba(0,0,0,.1)!important}.sd-shadow-lg{box-shadow:0 .6rem 1.5rem var(--sd-color-shadow),0 0 .0625rem rgba(0,0,0,.1)!important}.sd-card-hover:hover{transform:none}.sd-cards-carousel{gap:.25rem;padding:.25rem}body{--tabs--label-text:var(--color-foreground-muted);--tabs--label-text--hover:var(--color-foreground-muted);--tabs--label-text--active:var(--color-brand-content);--tabs--label-text--active--hover:var(--color-brand-content);--tabs--label-background:transparent;--tabs--label-background--hover:transparent;--tabs--label-background--active:transparent;--tabs--label-background--active--hover:transparent;--tabs--padding-x:0.25em;--tabs--margin-x:1em;--tabs--border:var(--color-background-border);--tabs--label-border:transparent;--tabs--label-border--hover:var(--color-foreground-muted);--tabs--label-border--active:var(--color-brand-content);--tabs--label-border--active--hover:var(--color-brand-content)}[role=main] .container{max-width:none;padding-left:0;padding-right:0}.shadow.docutils{border:none;box-shadow:0 .2rem .5rem rgba(0,0,0,.05),0 0 .0625rem rgba(0,0,0,.1)!important}.sphinx-bs .card{background-color:var(--color-background-secondary);color:var(--color-foreground)}
+/*# sourceMappingURL=furo-extensions.css.map*/
\ No newline at end of file
diff --git a/docs/_static/styles/furo-extensions.css.map b/docs/_static/styles/furo-extensions.css.map
new file mode 100644
index 0000000..9ba5637
--- /dev/null
+++ b/docs/_static/styles/furo-extensions.css.map
@@ -0,0 +1 @@
+{"version":3,"file":"styles/furo-extensions.css","mappings":"AAGA,2BACE,oFACA,4CAKE,6CAHA,YACA,eAEA,CACA,kDACE,yCAEF,8CACE,sCAEJ,8CACE,kDAEJ,2BAGE,uBACA,cAHA,gBACA,UAEA,CAGA,yCACE,mBAEF,gDAEE,gDADA,YACA,CACA,sDACE,gDACF,yDACE,sCAEJ,+CACE,UACA,qDACE,UAGF,mDACE,eAEJ,yEAEE,4DAEA,mHASE,mBAPA,kBAEA,YADA,oBAGA,aADA,gBAIA,CAEA,qIAEE,WADA,UACA,CAEJ,uGACE,aAEF,iUAGE,cAEF,mHACE,aC1EJ,gCACE,mCAEF,0BAKE,mBAUA,8CACA,YAFA,mCAKA,eAZA,cALA,UASA,YADA,YAYA,iCAdA,YAcA,CAEA,gCAEE,8CADA,gCACA,CAEF,gCAGE,6BADA,mCADA,YAEA,CAEF,kCAEE,cADA,oBACA,CACA,wCACE,cAEJ,8BACE,UC5CN,KAEE,6CAA8C,CAC9C,uDAAwD,CACxD,uDAAwD,CAGxD,iCAAsC,CAGtC,+CAAgD,CAChD,uDAAwD,CACxD,uDAAwD,CACxD,oDAAqD,CACrD,6DAA8D,CAC9D,6DAA8D,CAG9D,uDAAwD,CACxD,yDAA0D,CAC1D,4DAA6D,CAC7D,2DAA4D,CAC5D,8DAA+D,CAC/D,iEAAkE,CAClE,uDAAwD,CACxD,wDAAyD,CAG3D,gBACE,qFAGF,SACE,6EAEF,cACE,uFAEF,cACE,uFAEF,cACE,uFAGF,qBACE,eAEF,mBACE,WACA,eChDF,KACE,gDAAiD,CACjD,uDAAwD,CACxD,qDAAsD,CACtD,4DAA6D,CAC7D,oCAAqC,CACrC,2CAA4C,CAC5C,4CAA6C,CAC7C,mDAAoD,CACpD,wBAAyB,CACzB,oBAAqB,CACrB,6CAA8C,CAC9C,gCAAiC,CACjC,yDAA0D,CAC1D,uDAAwD,CACxD,8DAA+D,CCbjE,uBACE,eACA,eACA,gBAGF,iBACE,YACA,+EAGF,iBACE,mDACA","sources":["webpack:///./src/furo/assets/styles/extensions/_readthedocs.sass","webpack:///./src/furo/assets/styles/extensions/_copybutton.sass","webpack:///./src/furo/assets/styles/extensions/_sphinx-design.sass","webpack:///./src/furo/assets/styles/extensions/_sphinx-inline-tabs.sass","webpack:///./src/furo/assets/styles/extensions/_sphinx-panels.sass"],"sourcesContent":["// This file contains the styles used for tweaking how ReadTheDoc's embedded\n// contents would show up inside the theme.\n\n#furo-sidebar-ad-placement\n padding: var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal)\n .ethical-sidebar\n // Remove the border and box-shadow.\n border: none\n box-shadow: none\n // Manage the background colors.\n background: var(--color-background-secondary)\n &:hover\n background: var(--color-background-hover)\n // Ensure the text is legible.\n a\n color: var(--color-foreground-primary)\n\n .ethical-callout a\n color: var(--color-foreground-secondary) !important\n\n#furo-readthedocs-versions\n position: static\n width: 100%\n background: transparent\n display: block\n\n // Make the background color fit with the theme's aesthetic.\n .rst-versions\n background: rgb(26, 28, 30)\n\n .rst-current-version\n cursor: unset\n background: var(--color-sidebar-item-background)\n &:hover\n background: var(--color-sidebar-item-background)\n .fa-book\n color: var(--color-foreground-primary)\n\n > .rst-other-versions\n padding: 0\n small\n opacity: 1\n\n .injected\n .rst-versions\n position: unset\n\n &:hover,\n &:focus-within\n box-shadow: 0 0 0 1px var(--color-sidebar-background-border)\n\n .rst-current-version\n // Undo the tweaks done in RTD's CSS\n font-size: inherit\n line-height: inherit\n height: auto\n text-align: right\n padding: 12px\n\n // Match the rest of the body\n background: #1a1c1e\n\n .fa-book\n float: left\n color: white\n\n .fa-caret-down\n display: none\n\n .rst-current-version,\n .rst-other-versions,\n .injected\n display: block\n\n > .rst-current-version\n display: none\n",".highlight\n &:hover button.copybtn\n color: var(--color-code-foreground)\n\n button.copybtn\n // Make it visible\n opacity: 1\n\n // Align things correctly\n align-items: center\n\n height: 1.25em\n width: 1.25em\n\n top: 0.625rem // $code-spacing-vertical\n right: 0.5rem\n\n // Make it look better\n color: var(--color-background-item)\n background-color: var(--color-code-background)\n border: none\n\n // Change to cursor to make it obvious that you can click on it\n cursor: pointer\n\n // Transition smoothly, for aesthetics\n transition: color 300ms, opacity 300ms\n\n &:hover\n color: var(--color-brand-content)\n background-color: var(--color-code-background)\n\n &::after\n display: none\n color: var(--color-code-foreground)\n background-color: transparent\n\n &.success\n transition: color 0ms\n color: #22863a\n &::after\n display: block\n\n svg\n padding: 0\n","body\n // Colors\n --sd-color-primary: var(--color-brand-primary)\n --sd-color-primary-highlight: var(--color-brand-content)\n --sd-color-primary-text: var(--color-background-primary)\n\n // Shadows\n --sd-color-shadow: rgba(0, 0, 0, 0.05)\n\n // Cards\n --sd-color-card-border: var(--color-card-border)\n --sd-color-card-border-hover: var(--color-brand-content)\n --sd-color-card-background: var(--color-card-background)\n --sd-color-card-text: var(--color-foreground-primary)\n --sd-color-card-header: var(--color-card-marginals-background)\n --sd-color-card-footer: var(--color-card-marginals-background)\n\n // Tabs\n --sd-color-tabs-label-active: var(--color-brand-content)\n --sd-color-tabs-label-hover: var(--color-foreground-muted)\n --sd-color-tabs-label-inactive: var(--color-foreground-muted)\n --sd-color-tabs-underline-active: var(--color-brand-content)\n --sd-color-tabs-underline-hover: var(--color-foreground-border)\n --sd-color-tabs-underline-inactive: var(--color-background-border)\n --sd-color-tabs-overline: var(--color-background-border)\n --sd-color-tabs-underline: var(--color-background-border)\n\n// Tabs\n.sd-tab-content\n box-shadow: 0 -2px var(--sd-color-tabs-overline), 0 1px var(--sd-color-tabs-underline)\n\n// Shadows\n.sd-card // Have a shadow by default\n box-shadow: 0 0.1rem 0.25rem var(--sd-color-shadow), 0 0 0.0625rem rgba(0, 0, 0, 0.1)\n\n.sd-shadow-sm\n box-shadow: 0 0.1rem 0.25rem var(--sd-color-shadow), 0 0 0.0625rem rgba(0, 0, 0, 0.1) !important\n\n.sd-shadow-md\n box-shadow: 0 0.3rem 0.75rem var(--sd-color-shadow), 0 0 0.0625rem rgba(0, 0, 0, 0.1) !important\n\n.sd-shadow-lg\n box-shadow: 0 0.6rem 1.5rem var(--sd-color-shadow), 0 0 0.0625rem rgba(0, 0, 0, 0.1) !important\n\n// Cards\n.sd-card-hover:hover // Don't change scale on hover\n transform: none\n\n.sd-cards-carousel // Have a bit of gap in the carousel by default\n gap: 0.25rem\n padding: 0.25rem\n","// This file contains styles to tweak sphinx-inline-tabs to work well with Furo.\n\nbody\n --tabs--label-text: var(--color-foreground-muted)\n --tabs--label-text--hover: var(--color-foreground-muted)\n --tabs--label-text--active: var(--color-brand-content)\n --tabs--label-text--active--hover: var(--color-brand-content)\n --tabs--label-background: transparent\n --tabs--label-background--hover: transparent\n --tabs--label-background--active: transparent\n --tabs--label-background--active--hover: transparent\n --tabs--padding-x: 0.25em\n --tabs--margin-x: 1em\n --tabs--border: var(--color-background-border)\n --tabs--label-border: transparent\n --tabs--label-border--hover: var(--color-foreground-muted)\n --tabs--label-border--active: var(--color-brand-content)\n --tabs--label-border--active--hover: var(--color-brand-content)\n","// This file contains styles to tweak sphinx-panels to work well with Furo.\n\n// sphinx-panels includes Bootstrap 4, which uses .container which can conflict\n// with docutils' `.. container::` directive.\n[role=\"main\"] .container\n max-width: initial\n padding-left: initial\n padding-right: initial\n\n// Make the panels look nicer!\n.shadow.docutils\n border: none\n box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.05), 0 0 0.0625rem rgba(0, 0, 0, 0.1) !important\n\n// Make panel colors respond to dark mode\n.sphinx-bs .card\n background-color: var(--color-background-secondary)\n color: var(--color-foreground)\n"],"names":[],"sourceRoot":""}
\ No newline at end of file
diff --git a/docs/_static/styles/furo.css b/docs/_static/styles/furo.css
new file mode 100644
index 0000000..3d29a21
--- /dev/null
+++ b/docs/_static/styles/furo.css
@@ -0,0 +1,2 @@
+/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{-webkit-text-size-adjust:100%;line-height:1.15}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}[hidden],template{display:none}@media print{.content-icon-container,.headerlink,.mobile-header,.related-pages{display:none!important}.highlight{border:.1pt solid var(--color-foreground-border)}a,blockquote,dl,ol,pre,table,ul{page-break-inside:avoid}caption,figure,h1,h2,h3,h4,h5,h6,img{page-break-after:avoid;page-break-inside:avoid}dl,ol,ul{page-break-before:avoid}}.visually-hidden{clip:rect(0,0,0,0)!important;border:0!important;height:1px!important;margin:-1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;white-space:nowrap!important;width:1px!important}:-moz-focusring{outline:auto}body{--font-stack:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji;--font-stack--monospace:"SFMono-Regular",Menlo,Consolas,Monaco,Liberation Mono,Lucida Console,monospace;--font-size--normal:100%;--font-size--small:87.5%;--font-size--small--2:81.25%;--font-size--small--3:75%;--font-size--small--4:62.5%;--sidebar-caption-font-size:var(--font-size--small--2);--sidebar-item-font-size:var(--font-size--small);--sidebar-search-input-font-size:var(--font-size--small);--toc-font-size:var(--font-size--small--3);--toc-font-size--mobile:var(--font-size--normal);--toc-title-font-size:var(--font-size--small--4);--admonition-font-size:0.8125rem;--admonition-title-font-size:0.8125rem;--code-font-size:var(--font-size--small--2);--api-font-size:var(--font-size--small);--header-height:calc(var(--sidebar-item-line-height) + var(--sidebar-item-spacing-vertical)*4);--header-padding:0.5rem;--sidebar-tree-space-above:1.5rem;--sidebar-caption-space-above:1rem;--sidebar-item-line-height:1rem;--sidebar-item-spacing-vertical:0.5rem;--sidebar-item-spacing-horizontal:1rem;--sidebar-item-height:calc(var(--sidebar-item-line-height) + var(--sidebar-item-spacing-vertical)*2);--sidebar-expander-width:var(--sidebar-item-height);--sidebar-search-space-above:0.5rem;--sidebar-search-input-spacing-vertical:0.5rem;--sidebar-search-input-spacing-horizontal:0.5rem;--sidebar-search-input-height:1rem;--sidebar-search-icon-size:var(--sidebar-search-input-height);--toc-title-padding:0.25rem 0;--toc-spacing-vertical:1.5rem;--toc-spacing-horizontal:1.5rem;--toc-item-spacing-vertical:0.4rem;--toc-item-spacing-horizontal:1rem;--icon-search:url('data:image/svg+xml;charset=utf-8, ');--icon-pencil:url('data:image/svg+xml;charset=utf-8, ');--icon-abstract:url('data:image/svg+xml;charset=utf-8, ');--icon-info:url('data:image/svg+xml;charset=utf-8, ');--icon-flame:url('data:image/svg+xml;charset=utf-8, ');--icon-question:url('data:image/svg+xml;charset=utf-8, ');--icon-warning:url('data:image/svg+xml;charset=utf-8, ');--icon-failure:url('data:image/svg+xml;charset=utf-8, ');--icon-spark:url('data:image/svg+xml;charset=utf-8, ');--color-admonition-title--caution:#ff9100;--color-admonition-title-background--caution:rgba(255,145,0,.2);--color-admonition-title--warning:#ff9100;--color-admonition-title-background--warning:rgba(255,145,0,.2);--color-admonition-title--danger:#ff5252;--color-admonition-title-background--danger:rgba(255,82,82,.2);--color-admonition-title--attention:#ff5252;--color-admonition-title-background--attention:rgba(255,82,82,.2);--color-admonition-title--error:#ff5252;--color-admonition-title-background--error:rgba(255,82,82,.2);--color-admonition-title--hint:#00c852;--color-admonition-title-background--hint:rgba(0,200,82,.2);--color-admonition-title--tip:#00c852;--color-admonition-title-background--tip:rgba(0,200,82,.2);--color-admonition-title--important:#00bfa5;--color-admonition-title-background--important:rgba(0,191,165,.2);--color-admonition-title--note:#00b0ff;--color-admonition-title-background--note:rgba(0,176,255,.2);--color-admonition-title--seealso:#448aff;--color-admonition-title-background--seealso:rgba(68,138,255,.2);--color-admonition-title--admonition-todo:grey;--color-admonition-title-background--admonition-todo:hsla(0,0%,50%,.2);--color-admonition-title:#651fff;--color-admonition-title-background:rgba(101,31,255,.2);--icon-admonition-default:var(--icon-abstract);--color-topic-title:#14b8a6;--color-topic-title-background:rgba(20,184,166,.2);--icon-topic-default:var(--icon-pencil);--color-problematic:#b30000;--color-foreground-primary:#000;--color-foreground-secondary:#5a5c63;--color-foreground-muted:#646776;--color-foreground-border:#878787;--color-background-primary:#fff;--color-background-secondary:#f8f9fb;--color-background-hover:#efeff4;--color-background-hover--transparent:#efeff400;--color-background-border:#eeebee;--color-background-item:#ccc;--color-announcement-background:#000000dd;--color-announcement-text:#eeebee;--color-brand-primary:#2962ff;--color-brand-content:#2a5adf;--color-api-background:var(--color-background-hover--transparent);--color-api-background-hover:var(--color-background-hover);--color-api-overall:var(--color-foreground-secondary);--color-api-name:var(--color-problematic);--color-api-pre-name:var(--color-problematic);--color-api-paren:var(--color-foreground-secondary);--color-api-keyword:var(--color-foreground-primary);--color-highlight-on-target:#ffc;--color-inline-code-background:var(--color-background-secondary);--color-highlighted-background:#def;--color-highlighted-text:var(--color-foreground-primary);--color-guilabel-background:#ddeeff80;--color-guilabel-border:#bedaf580;--color-guilabel-text:var(--color-foreground-primary);--color-admonition-background:transparent;--color-table-header-background:var(--color-background-secondary);--color-table-border:var(--color-background-border);--color-card-border:var(--color-background-secondary);--color-card-background:transparent;--color-card-marginals-background:var(--color-background-secondary);--color-header-background:var(--color-background-primary);--color-header-border:var(--color-background-border);--color-header-text:var(--color-foreground-primary);--color-sidebar-background:var(--color-background-secondary);--color-sidebar-background-border:var(--color-background-border);--color-sidebar-brand-text:var(--color-foreground-primary);--color-sidebar-caption-text:var(--color-foreground-muted);--color-sidebar-link-text:var(--color-foreground-secondary);--color-sidebar-link-text--top-level:var(--color-brand-primary);--color-sidebar-item-background:var(--color-sidebar-background);--color-sidebar-item-background--current:var( --color-sidebar-item-background );--color-sidebar-item-background--hover:linear-gradient(90deg,var(--color-background-hover--transparent) 0%,var(--color-background-hover) var(--sidebar-item-spacing-horizontal),var(--color-background-hover) 100%);--color-sidebar-item-expander-background:transparent;--color-sidebar-item-expander-background--hover:var( --color-background-hover );--color-sidebar-search-text:var(--color-foreground-primary);--color-sidebar-search-background:var(--color-background-secondary);--color-sidebar-search-background--focus:var(--color-background-primary);--color-sidebar-search-border:var(--color-background-border);--color-sidebar-search-icon:var(--color-foreground-muted);--color-toc-background:var(--color-background-primary);--color-toc-title-text:var(--color-foreground-muted);--color-toc-item-text:var(--color-foreground-secondary);--color-toc-item-text--hover:var(--color-foreground-primary);--color-toc-item-text--active:var(--color-brand-primary);--color-content-foreground:var(--color-foreground-primary);--color-content-background:transparent;--color-link:var(--color-brand-content);--color-link--hover:var(--color-brand-content);--color-link-underline:var(--color-background-border);--color-link-underline--hover:var(--color-foreground-border)}.only-light{display:block!important}html body .only-dark{display:none!important}@media not print{body[data-theme=dark]{--color-problematic:#ee5151;--color-foreground-primary:#ffffffcc;--color-foreground-secondary:#9ca0a5;--color-foreground-muted:#81868d;--color-foreground-border:#666;--color-background-primary:#131416;--color-background-secondary:#1a1c1e;--color-background-hover:#1e2124;--color-background-hover--transparent:#1e212400;--color-background-border:#303335;--color-background-item:#444;--color-announcement-background:#000000dd;--color-announcement-text:#eeebee;--color-brand-primary:#2b8cee;--color-brand-content:#368ce2;--color-highlighted-background:#083563;--color-guilabel-background:#08356380;--color-guilabel-border:#13395f80;--color-api-keyword:var(--color-foreground-secondary);--color-highlight-on-target:#330;--color-admonition-background:#18181a;--color-card-border:var(--color-background-secondary);--color-card-background:#18181a;--color-card-marginals-background:var(--color-background-hover)}html body[data-theme=dark] .only-light{display:none!important}body[data-theme=dark] .only-dark{display:block!important}@media(prefers-color-scheme:dark){body:not([data-theme=light]){--color-problematic:#ee5151;--color-foreground-primary:#ffffffcc;--color-foreground-secondary:#9ca0a5;--color-foreground-muted:#81868d;--color-foreground-border:#666;--color-background-primary:#131416;--color-background-secondary:#1a1c1e;--color-background-hover:#1e2124;--color-background-hover--transparent:#1e212400;--color-background-border:#303335;--color-background-item:#444;--color-announcement-background:#000000dd;--color-announcement-text:#eeebee;--color-brand-primary:#2b8cee;--color-brand-content:#368ce2;--color-highlighted-background:#083563;--color-guilabel-background:#08356380;--color-guilabel-border:#13395f80;--color-api-keyword:var(--color-foreground-secondary);--color-highlight-on-target:#330;--color-admonition-background:#18181a;--color-card-border:var(--color-background-secondary);--color-card-background:#18181a;--color-card-marginals-background:var(--color-background-hover)}html body:not([data-theme=light]) .only-light{display:none!important}body:not([data-theme=light]) .only-dark{display:block!important}}}body[data-theme=auto] .theme-toggle svg.theme-icon-when-auto,body[data-theme=dark] .theme-toggle svg.theme-icon-when-dark,body[data-theme=light] .theme-toggle svg.theme-icon-when-light{display:block}body{font-family:var(--font-stack)}code,kbd,pre,samp{font-family:var(--font-stack--monospace)}body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}article{line-height:1.5}h1,h2,h3,h4,h5,h6{border-radius:.5rem;font-weight:700;line-height:1.25;margin:.5rem -.5rem;padding-left:.5rem;padding-right:.5rem}h1+p,h2+p,h3+p,h4+p,h5+p,h6+p{margin-top:0}h1{font-size:2.5em;margin-bottom:1rem}h1,h2{margin-top:1.75rem}h2{font-size:2em}h3{font-size:1.5em}h4{font-size:1.25em}h5{font-size:1.125em}h6{font-size:1em}small{font-size:80%;opacity:75%}p{margin-bottom:.75rem;margin-top:.5rem}hr.docutils{background-color:var(--color-background-border);border:0;height:1px;margin:2rem 0;padding:0}.centered{text-align:center}a{color:var(--color-link);text-decoration:underline;text-decoration-color:var(--color-link-underline)}a:hover{color:var(--color-link--hover);text-decoration-color:var(--color-link-underline--hover)}a.muted-link{color:inherit}a.muted-link:hover{color:var(--color-link);text-decoration-color:var(--color-link-underline--hover)}html{overflow-x:hidden;overflow-y:scroll;scroll-behavior:smooth}.sidebar-scroll,.toc-scroll,article[role=main] *{scrollbar-color:var(--color-foreground-border) transparent;scrollbar-width:thin}.sidebar-scroll::-webkit-scrollbar,.toc-scroll::-webkit-scrollbar,article[role=main] ::-webkit-scrollbar{height:.25rem;width:.25rem}.sidebar-scroll::-webkit-scrollbar-thumb,.toc-scroll::-webkit-scrollbar-thumb,article[role=main] ::-webkit-scrollbar-thumb{background-color:var(--color-foreground-border);border-radius:.125rem}body,html{background:var(--color-background-primary);color:var(--color-foreground-primary);height:100%}article{background:var(--color-content-background);color:var(--color-content-foreground);overflow-wrap:break-word}.page{display:flex;min-height:100%}.mobile-header{background-color:var(--color-header-background);border-bottom:1px solid var(--color-header-border);color:var(--color-header-text);display:none;height:var(--header-height);width:100%;z-index:10}.mobile-header.scrolled{border-bottom:none;box-shadow:0 0 .2rem rgba(0,0,0,.1),0 .2rem .4rem rgba(0,0,0,.2)}.mobile-header .header-center a{color:var(--color-header-text);text-decoration:none}.main{display:flex;flex:1}.sidebar-drawer{background:var(--color-sidebar-background);border-right:1px solid var(--color-sidebar-background-border);box-sizing:border-box;display:flex;justify-content:flex-end;min-width:15em;width:calc(50% - 26em)}.sidebar-container,.toc-drawer{box-sizing:border-box;width:15em}.toc-drawer{background:var(--color-toc-background);padding-right:1rem}.sidebar-sticky,.toc-sticky{display:flex;flex-direction:column;height:min(100%,100vh);height:100vh;position:sticky;top:0}.sidebar-scroll,.toc-scroll{flex-grow:1;flex-shrink:1;overflow:auto;scroll-behavior:smooth}.content{display:flex;flex-direction:column;justify-content:space-between;padding:0 3em;width:46em}.icon{display:inline-block;height:1rem;width:1rem}.icon svg{height:100%;width:100%}.announcement{align-items:center;background-color:var(--color-announcement-background);color:var(--color-announcement-text);display:flex;height:var(--header-height);overflow-x:auto}.announcement+.page{min-height:calc(100% - var(--header-height))}.announcement-content{box-sizing:border-box;min-width:100%;padding:.5rem;text-align:center;white-space:nowrap}.announcement-content a{color:var(--color-announcement-text);text-decoration-color:var(--color-announcement-text)}.announcement-content a:hover{color:var(--color-announcement-text);text-decoration-color:var(--color-link--hover)}.no-js .theme-toggle-container{display:none}.theme-toggle-container{vertical-align:middle}.theme-toggle{background:transparent;border:none;cursor:pointer;padding:0}.theme-toggle svg{color:var(--color-foreground-primary);display:none;height:1rem;vertical-align:middle;width:1rem}.theme-toggle-header{float:left;padding:1rem .5rem}.nav-overlay-icon,.toc-overlay-icon{cursor:pointer;display:none}.nav-overlay-icon .icon,.toc-overlay-icon .icon{color:var(--color-foreground-secondary);height:1rem;width:1rem}.nav-overlay-icon,.toc-header-icon{align-items:center;justify-content:center}.toc-content-icon{height:1.5rem;width:1.5rem}.content-icon-container{display:flex;float:right;gap:.5rem;margin-bottom:1rem;margin-left:1rem;margin-top:1.5rem}.content-icon-container .edit-this-page svg{color:inherit;height:1rem;width:1rem}.sidebar-toggle{display:none;position:absolute}.sidebar-toggle[name=__toc]{left:20px}.sidebar-toggle:checked{left:40px}.overlay{background-color:rgba(0,0,0,.54);height:0;opacity:0;position:fixed;top:0;transition:width 0ms,height 0ms,opacity .25s ease-out;width:0}.sidebar-overlay{z-index:20}.toc-overlay{z-index:40}.sidebar-drawer{transition:left .25s ease-in-out;z-index:30}.toc-drawer{transition:right .25s ease-in-out;z-index:50}#__navigation:checked~.sidebar-overlay{height:100%;opacity:1;width:100%}#__navigation:checked~.page .sidebar-drawer{left:0;top:0}#__toc:checked~.toc-overlay{height:100%;opacity:1;width:100%}#__toc:checked~.page .toc-drawer{right:0;top:0}.back-to-top{background:var(--color-background-primary);border-radius:1rem;box-shadow:0 .2rem .5rem rgba(0,0,0,.05),0 0 1px 0 hsla(220,9%,46%,.502);display:none;font-size:.8125rem;left:0;margin-left:50%;padding:.5rem .75rem .5rem .5rem;position:fixed;text-decoration:none;top:1rem;transform:translateX(-50%);z-index:10}.back-to-top svg{fill:currentColor;display:inline-block;height:1rem;width:1rem}.back-to-top span{margin-left:.25rem}.show-back-to-top .back-to-top{align-items:center;display:flex}@media(min-width:97em){html{font-size:110%}}@media(max-width:82em){.toc-content-icon{display:flex}.toc-drawer{border-left:1px solid var(--color-background-muted);height:100vh;position:fixed;right:-15em;top:0}.toc-tree{border-left:none;font-size:var(--toc-font-size--mobile)}.sidebar-drawer{width:calc(50% - 18.5em)}}@media(max-width:67em){.nav-overlay-icon{display:flex}.sidebar-drawer{height:100vh;left:-15em;position:fixed;top:0;width:15em}.toc-header-icon{display:flex}.theme-toggle-content,.toc-content-icon{display:none}.theme-toggle-header{display:block}.mobile-header{align-items:center;display:flex;justify-content:space-between;position:sticky;top:0}.mobile-header .header-left,.mobile-header .header-right{display:flex;height:var(--header-height);padding:0 var(--header-padding)}.mobile-header .header-left label,.mobile-header .header-right label{height:100%;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%}.nav-overlay-icon .icon,.theme-toggle svg{height:1.25rem;width:1.25rem}:target{scroll-margin-top:var(--header-height)}.back-to-top{top:calc(var(--header-height) + .5rem)}.page{flex-direction:column;justify-content:center}.content{margin-left:auto;margin-right:auto}}@media(max-width:52em){.content{overflow-x:auto;width:100%}}@media(max-width:46em){.content{padding:0 1em}article aside.sidebar{float:none;margin:1rem 0;width:100%}}.admonition,.topic{background:var(--color-admonition-background);border-radius:.2rem;box-shadow:0 .2rem .5rem rgba(0,0,0,.05),0 0 .0625rem rgba(0,0,0,.1);font-size:var(--admonition-font-size);margin:1rem auto;overflow:hidden;padding:0 .5rem .5rem;page-break-inside:avoid}.admonition>:nth-child(2),.topic>:nth-child(2){margin-top:0}.admonition>:last-child,.topic>:last-child{margin-bottom:0}.admonition p.admonition-title,p.topic-title{font-size:var(--admonition-title-font-size);font-weight:500;line-height:1.3;margin:0 -.5rem .5rem;padding:.4rem .5rem .4rem 2rem;position:relative}.admonition p.admonition-title:before,p.topic-title:before{content:"";height:1rem;left:.5rem;position:absolute;width:1rem}p.admonition-title{background-color:var(--color-admonition-title-background)}p.admonition-title:before{background-color:var(--color-admonition-title);-webkit-mask-image:var(--icon-admonition-default);mask-image:var(--icon-admonition-default);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}p.topic-title{background-color:var(--color-topic-title-background)}p.topic-title:before{background-color:var(--color-topic-title);-webkit-mask-image:var(--icon-topic-default);mask-image:var(--icon-topic-default);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.admonition{border-left:.2rem solid var(--color-admonition-title)}.admonition.caution{border-left-color:var(--color-admonition-title--caution)}.admonition.caution>.admonition-title{background-color:var(--color-admonition-title-background--caution)}.admonition.caution>.admonition-title:before{background-color:var(--color-admonition-title--caution);-webkit-mask-image:var(--icon-spark);mask-image:var(--icon-spark)}.admonition.warning{border-left-color:var(--color-admonition-title--warning)}.admonition.warning>.admonition-title{background-color:var(--color-admonition-title-background--warning)}.admonition.warning>.admonition-title:before{background-color:var(--color-admonition-title--warning);-webkit-mask-image:var(--icon-warning);mask-image:var(--icon-warning)}.admonition.danger{border-left-color:var(--color-admonition-title--danger)}.admonition.danger>.admonition-title{background-color:var(--color-admonition-title-background--danger)}.admonition.danger>.admonition-title:before{background-color:var(--color-admonition-title--danger);-webkit-mask-image:var(--icon-spark);mask-image:var(--icon-spark)}.admonition.attention{border-left-color:var(--color-admonition-title--attention)}.admonition.attention>.admonition-title{background-color:var(--color-admonition-title-background--attention)}.admonition.attention>.admonition-title:before{background-color:var(--color-admonition-title--attention);-webkit-mask-image:var(--icon-warning);mask-image:var(--icon-warning)}.admonition.error{border-left-color:var(--color-admonition-title--error)}.admonition.error>.admonition-title{background-color:var(--color-admonition-title-background--error)}.admonition.error>.admonition-title:before{background-color:var(--color-admonition-title--error);-webkit-mask-image:var(--icon-failure);mask-image:var(--icon-failure)}.admonition.hint{border-left-color:var(--color-admonition-title--hint)}.admonition.hint>.admonition-title{background-color:var(--color-admonition-title-background--hint)}.admonition.hint>.admonition-title:before{background-color:var(--color-admonition-title--hint);-webkit-mask-image:var(--icon-question);mask-image:var(--icon-question)}.admonition.tip{border-left-color:var(--color-admonition-title--tip)}.admonition.tip>.admonition-title{background-color:var(--color-admonition-title-background--tip)}.admonition.tip>.admonition-title:before{background-color:var(--color-admonition-title--tip);-webkit-mask-image:var(--icon-info);mask-image:var(--icon-info)}.admonition.important{border-left-color:var(--color-admonition-title--important)}.admonition.important>.admonition-title{background-color:var(--color-admonition-title-background--important)}.admonition.important>.admonition-title:before{background-color:var(--color-admonition-title--important);-webkit-mask-image:var(--icon-flame);mask-image:var(--icon-flame)}.admonition.note{border-left-color:var(--color-admonition-title--note)}.admonition.note>.admonition-title{background-color:var(--color-admonition-title-background--note)}.admonition.note>.admonition-title:before{background-color:var(--color-admonition-title--note);-webkit-mask-image:var(--icon-pencil);mask-image:var(--icon-pencil)}.admonition.seealso{border-left-color:var(--color-admonition-title--seealso)}.admonition.seealso>.admonition-title{background-color:var(--color-admonition-title-background--seealso)}.admonition.seealso>.admonition-title:before{background-color:var(--color-admonition-title--seealso);-webkit-mask-image:var(--icon-info);mask-image:var(--icon-info)}.admonition.admonition-todo{border-left-color:var(--color-admonition-title--admonition-todo)}.admonition.admonition-todo>.admonition-title{background-color:var(--color-admonition-title-background--admonition-todo)}.admonition.admonition-todo>.admonition-title:before{background-color:var(--color-admonition-title--admonition-todo);-webkit-mask-image:var(--icon-pencil);mask-image:var(--icon-pencil)}.admonition-todo>.admonition-title{text-transform:uppercase}dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple) dd{margin-left:2rem}dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple) dd>:first-child{margin-top:.125rem}dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple) .field-list,dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple) dd>:last-child{margin-bottom:.75rem}dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple) .field-list>dt{font-size:var(--font-size--small);text-transform:uppercase}dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple) .field-list dd:empty{margin-bottom:.5rem}dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple) .field-list dd>ul{margin-left:-1.2rem}dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple) .field-list dd>ul>li>p:nth-child(2){margin-top:0}dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple) .field-list dd>ul>li>p+p:last-child:empty{margin-bottom:0;margin-top:0}dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple)>dt{color:var(--color-api-overall)}.sig:not(.sig-inline){background:var(--color-api-background);border-radius:.25rem;font-family:var(--font-stack--monospace);font-size:var(--api-font-size);font-weight:700;margin-left:-.25rem;margin-right:-.25rem;padding:.25rem .5rem .25rem 3em;text-indent:-2.5em;transition:background .1s ease-out}.sig:not(.sig-inline):hover{background:var(--color-api-background-hover)}.sig:not(.sig-inline) a.reference .viewcode-link{font-weight:400;width:3.5rem}em.property{font-style:normal}em.property:first-child{color:var(--color-api-keyword)}.sig-name{color:var(--color-api-name)}.sig-prename{color:var(--color-api-pre-name);font-weight:400}.sig-paren{color:var(--color-api-paren)}.sig-param{font-style:normal}.versionmodified{font-style:italic}div.deprecated p,div.versionadded p,div.versionchanged p{margin-bottom:.125rem;margin-top:.125rem}.viewcode-back,.viewcode-link{float:right;text-align:right}.line-block{margin-bottom:.75rem;margin-top:.5rem}.line-block .line-block{margin-bottom:0;margin-top:0;padding-left:1rem}.code-block-caption,article p.caption,table>caption{font-size:var(--font-size--small);text-align:center}.toctree-wrapper.compound .caption,.toctree-wrapper.compound :not(.caption)>.caption-text{font-size:var(--font-size--small);margin-bottom:0;text-align:initial;text-transform:uppercase}.toctree-wrapper.compound>ul{margin-bottom:0;margin-top:0}.sig-inline,code.literal{background:var(--color-inline-code-background);border-radius:.2em;font-size:var(--font-size--small--2);padding:.1em .2em}pre.literal-block .sig-inline,pre.literal-block code.literal{font-size:inherit;padding:0}p .sig-inline,p code.literal{border:1px solid var(--color-background-border)}.sig-inline{font-family:var(--font-stack--monospace)}div[class*=" highlight-"],div[class^=highlight-]{display:flex;margin:1em 0}div[class*=" highlight-"] .table-wrapper,div[class^=highlight-] .table-wrapper,pre{margin:0;padding:0}pre{overflow:auto}article[role=main] .highlight pre{line-height:1.5}.highlight pre,pre.literal-block{font-size:var(--code-font-size);padding:.625rem .875rem}pre.literal-block{background-color:var(--color-code-background);border-radius:.2rem;color:var(--color-code-foreground);margin-bottom:1rem;margin-top:1rem}.highlight{border-radius:.2rem;width:100%}.highlight .gp,.highlight span.linenos{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.highlight .hll{display:block;margin-left:-.875rem;margin-right:-.875rem;padding-left:.875rem;padding-right:.875rem}.code-block-caption{background-color:var(--color-code-background);border-bottom:1px solid;border-radius:.25rem;border-bottom-left-radius:0;border-bottom-right-radius:0;border-color:var(--color-background-border);color:var(--color-code-foreground);display:flex;font-weight:300;padding:.625rem .875rem}.code-block-caption+div[class]{margin-top:0}.code-block-caption+div[class] pre{border-top-left-radius:0;border-top-right-radius:0}.highlighttable{display:block;width:100%}.highlighttable tbody{display:block}.highlighttable tr{display:flex}.highlighttable td.linenos{background-color:var(--color-code-background);border-bottom-left-radius:.2rem;border-top-left-radius:.2rem;color:var(--color-code-foreground);padding:.625rem 0 .625rem .875rem}.highlighttable .linenodiv{box-shadow:-.0625rem 0 var(--color-foreground-border) inset;font-size:var(--code-font-size);padding-right:.875rem}.highlighttable td.code{display:block;flex:1;overflow:hidden;padding:0}.highlighttable td.code .highlight{border-bottom-left-radius:0;border-top-left-radius:0}.highlight span.linenos{box-shadow:-.0625rem 0 var(--color-foreground-border) inset;display:inline-block;margin-right:.875rem;padding-left:0;padding-right:.875rem}.footnote-reference{font-size:var(--font-size--small--4);vertical-align:super}dl.footnote.brackets{color:var(--color-foreground-secondary);display:grid;font-size:var(--font-size--small);grid-template-columns:max-content auto}dl.footnote.brackets dt{margin:0}dl.footnote.brackets dt>.fn-backref{margin-left:.25rem}dl.footnote.brackets dt:after{content:":"}dl.footnote.brackets dt .brackets:before{content:"["}dl.footnote.brackets dt .brackets:after{content:"]"}dl.footnote.brackets dd{margin:0;padding:0 1rem}aside.footnote{color:var(--color-foreground-secondary);font-size:var(--font-size--small)}aside.footnote>span,div.citation>span{float:left;font-weight:500;padding-right:.25rem}aside.footnote>p,div.citation>p{margin-left:2rem}img{box-sizing:border-box;height:auto;max-width:100%}article .figure,article figure{border-radius:.2rem;margin:0}article .figure :last-child,article figure :last-child{margin-bottom:0}article .align-left{clear:left;float:left;margin:0 1rem 1rem}article .align-right{clear:right;float:right;margin:0 1rem 1rem}article .align-center,article .align-default{display:block;margin-left:auto;margin-right:auto;text-align:center}article table.align-default{display:table;text-align:initial}.domainindex-jumpbox,.genindex-jumpbox{border-bottom:1px solid var(--color-background-border);border-top:1px solid var(--color-background-border);padding:.25rem}.domainindex-section h2,.genindex-section h2{margin-bottom:.5rem;margin-top:.75rem}.domainindex-section ul,.genindex-section ul{margin-bottom:0;margin-top:0}ol,ul{margin-bottom:1rem;margin-top:1rem;padding-left:1.2rem}ol li>p:first-child,ul li>p:first-child{margin-bottom:.25rem;margin-top:.25rem}ol li>p:last-child,ul li>p:last-child{margin-top:.25rem}ol li>ol,ol li>ul,ul li>ol,ul li>ul{margin-bottom:.5rem;margin-top:.5rem}ol.arabic{list-style:decimal}ol.loweralpha{list-style:lower-alpha}ol.upperalpha{list-style:upper-alpha}ol.lowerroman{list-style:lower-roman}ol.upperroman{list-style:upper-roman}.simple li>ol,.simple li>ul,.toctree-wrapper li>ol,.toctree-wrapper li>ul{margin-bottom:0;margin-top:0}.field-list dt,.option-list dt,dl.footnote dt,dl.glossary dt,dl.simple dt,dl:not([class]) dt{font-weight:500;margin-top:.25rem}.field-list dt+dt,.option-list dt+dt,dl.footnote dt+dt,dl.glossary dt+dt,dl.simple dt+dt,dl:not([class]) dt+dt{margin-top:0}.field-list dt .classifier:before,.option-list dt .classifier:before,dl.footnote dt .classifier:before,dl.glossary dt .classifier:before,dl.simple dt .classifier:before,dl:not([class]) dt .classifier:before{content:":";margin-left:.2rem;margin-right:.2rem}.field-list dd ul,.field-list dd>p:first-child,.option-list dd ul,.option-list dd>p:first-child,dl.footnote dd ul,dl.footnote dd>p:first-child,dl.glossary dd ul,dl.glossary dd>p:first-child,dl.simple dd ul,dl.simple dd>p:first-child,dl:not([class]) dd ul,dl:not([class]) dd>p:first-child{margin-top:.125rem}.field-list dd ul,.option-list dd ul,dl.footnote dd ul,dl.glossary dd ul,dl.simple dd ul,dl:not([class]) dd ul{margin-bottom:.125rem}.math-wrapper{overflow-x:auto;width:100%}div.math{position:relative;text-align:center}div.math .headerlink,div.math:focus .headerlink{display:none}div.math:hover .headerlink{display:inline-block}div.math span.eqno{position:absolute;right:.5rem;top:50%;transform:translateY(-50%);z-index:1}abbr[title]{cursor:help}.problematic{color:var(--color-problematic)}kbd:not(.compound){background-color:var(--color-background-secondary);border:1px solid var(--color-foreground-border);border-radius:.2rem;box-shadow:0 .0625rem 0 rgba(0,0,0,.2),inset 0 0 0 .125rem var(--color-background-primary);color:var(--color-foreground-primary);display:inline-block;font-size:var(--font-size--small--3);margin:0 .2rem;padding:0 .2rem;vertical-align:text-bottom}blockquote{background:var(--color-background-secondary);border-left:4px solid var(--color-background-border);margin-left:0;margin-right:0;padding:.5rem 1rem}blockquote .attribution{font-weight:600;text-align:right}blockquote.highlights,blockquote.pull-quote{font-size:1.25em}blockquote.epigraph,blockquote.pull-quote{border-left-width:0;border-radius:.5rem}blockquote.highlights{background:transparent;border-left-width:0}p .reference img{vertical-align:middle}p.rubric{font-size:1.125em;font-weight:700;line-height:1.25}dd p.rubric{font-size:var(--font-size--small);font-weight:inherit;line-height:inherit;text-transform:uppercase}article .sidebar{background-color:var(--color-background-secondary);border:1px solid var(--color-background-border);border-radius:.2rem;clear:right;float:right;margin-left:1rem;margin-right:0;width:30%}article .sidebar>*{padding-left:1rem;padding-right:1rem}article .sidebar>ol,article .sidebar>ul{padding-left:2.2rem}article .sidebar .sidebar-title{border-bottom:1px solid var(--color-background-border);font-weight:500;margin:0;padding:.5rem 1rem}.table-wrapper{margin-bottom:.5rem;margin-top:1rem;overflow-x:auto;padding:.2rem .2rem .75rem;width:100%}table.docutils{border-collapse:collapse;border-radius:.2rem;border-spacing:0;box-shadow:0 .2rem .5rem rgba(0,0,0,.05),0 0 .0625rem rgba(0,0,0,.1)}table.docutils th{background:var(--color-table-header-background)}table.docutils td,table.docutils th{border-bottom:1px solid var(--color-table-border);border-left:1px solid var(--color-table-border);border-right:1px solid var(--color-table-border);padding:0 .25rem}table.docutils td p,table.docutils th p{margin:.25rem}table.docutils td:first-child,table.docutils th:first-child{border-left:none}table.docutils td:last-child,table.docutils th:last-child{border-right:none}table.docutils td.text-left,table.docutils th.text-left{text-align:left}table.docutils td.text-right,table.docutils th.text-right{text-align:right}table.docutils td.text-center,table.docutils th.text-center{text-align:center}:target{scroll-margin-top:.5rem}@media(max-width:67em){:target{scroll-margin-top:calc(.5rem + var(--header-height))}section>span:target{scroll-margin-top:calc(.8rem + var(--header-height))}}.headerlink{font-weight:100;-webkit-user-select:none;-moz-user-select:none;user-select:none}.code-block-caption>.headerlink,dl dt>.headerlink,figcaption p>.headerlink,h1>.headerlink,h2>.headerlink,h3>.headerlink,h4>.headerlink,h5>.headerlink,h6>.headerlink,p.caption>.headerlink,table>caption>.headerlink{margin-left:.5rem;visibility:hidden}.code-block-caption:hover>.headerlink,dl dt:hover>.headerlink,figcaption p:hover>.headerlink,h1:hover>.headerlink,h2:hover>.headerlink,h3:hover>.headerlink,h4:hover>.headerlink,h5:hover>.headerlink,h6:hover>.headerlink,p.caption:hover>.headerlink,table>caption:hover>.headerlink{visibility:visible}.code-block-caption>.toc-backref,dl dt>.toc-backref,figcaption p>.toc-backref,h1>.toc-backref,h2>.toc-backref,h3>.toc-backref,h4>.toc-backref,h5>.toc-backref,h6>.toc-backref,p.caption>.toc-backref,table>caption>.toc-backref{color:inherit;text-decoration-line:none}figure:hover>figcaption>p>.headerlink,table:hover>caption>.headerlink{visibility:visible}:target>h1:first-of-type,:target>h2:first-of-type,:target>h3:first-of-type,:target>h4:first-of-type,:target>h5:first-of-type,:target>h6:first-of-type,span:target~h1:first-of-type,span:target~h2:first-of-type,span:target~h3:first-of-type,span:target~h4:first-of-type,span:target~h5:first-of-type,span:target~h6:first-of-type{background-color:var(--color-highlight-on-target)}:target>h1:first-of-type code.literal,:target>h2:first-of-type code.literal,:target>h3:first-of-type code.literal,:target>h4:first-of-type code.literal,:target>h5:first-of-type code.literal,:target>h6:first-of-type code.literal,span:target~h1:first-of-type code.literal,span:target~h2:first-of-type code.literal,span:target~h3:first-of-type code.literal,span:target~h4:first-of-type code.literal,span:target~h5:first-of-type code.literal,span:target~h6:first-of-type code.literal{background-color:transparent}.literal-block-wrapper:target .code-block-caption,.this-will-duplicate-information-and-it-is-still-useful-here li :target,figure:target,table:target>caption{background-color:var(--color-highlight-on-target)}dt:target{background-color:var(--color-highlight-on-target)!important}.footnote-reference:target,.footnote>dt:target+dd{background-color:var(--color-highlight-on-target)}.guilabel{background-color:var(--color-guilabel-background);border:1px solid var(--color-guilabel-border);border-radius:.5em;color:var(--color-guilabel-text);font-size:.9em;padding:0 .3em}footer{display:flex;flex-direction:column;font-size:var(--font-size--small);margin-top:2rem}.bottom-of-page{align-items:center;border-top:1px solid var(--color-background-border);color:var(--color-foreground-secondary);display:flex;justify-content:space-between;line-height:1.5;margin-top:1rem;padding-bottom:1rem;padding-top:1rem}@media(max-width:46em){.bottom-of-page{flex-direction:column-reverse;gap:.25rem;text-align:center}}.bottom-of-page .left-details{font-size:var(--font-size--small)}.bottom-of-page .right-details{display:flex;flex-direction:column;gap:.25rem;text-align:right}.bottom-of-page .icons{display:flex;font-size:1rem;gap:.25rem;justify-content:flex-end}.bottom-of-page .icons a{text-decoration:none}.bottom-of-page .icons img,.bottom-of-page .icons svg{font-size:1.125rem;height:1em;width:1em}.related-pages a{align-items:center;display:flex;text-decoration:none}.related-pages a:hover .page-info .title{color:var(--color-link);text-decoration:underline;text-decoration-color:var(--color-link-underline)}.related-pages a svg.furo-related-icon,.related-pages a svg.furo-related-icon>use{color:var(--color-foreground-border);flex-shrink:0;height:.75rem;margin:0 .5rem;width:.75rem}.related-pages a.next-page{clear:right;float:right;max-width:50%;text-align:right}.related-pages a.prev-page{clear:left;float:left;max-width:50%}.related-pages a.prev-page svg{transform:rotate(180deg)}.page-info{display:flex;flex-direction:column;overflow-wrap:anywhere}.next-page .page-info{align-items:flex-end}.page-info .context{align-items:center;color:var(--color-foreground-muted);display:flex;font-size:var(--font-size--small);padding-bottom:.1rem;text-decoration:none}ul.search{list-style:none;padding-left:0}ul.search li{border-bottom:1px solid var(--color-background-border);padding:1rem 0}[role=main] .highlighted{background-color:var(--color-highlighted-background);color:var(--color-highlighted-text)}.sidebar-brand{display:flex;flex-direction:column;flex-shrink:0;padding:var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal);text-decoration:none}.sidebar-brand-text{color:var(--color-sidebar-brand-text);font-size:1.5rem;overflow-wrap:break-word}.sidebar-brand-text,.sidebar-logo-container{margin:var(--sidebar-item-spacing-vertical) 0}.sidebar-logo{display:block;margin:0 auto;max-width:100%}.sidebar-search-container{align-items:center;background:var(--color-sidebar-search-background);display:flex;margin-top:var(--sidebar-search-space-above);position:relative}.sidebar-search-container:focus-within,.sidebar-search-container:hover{background:var(--color-sidebar-search-background--focus)}.sidebar-search-container:before{background-color:var(--color-sidebar-search-icon);content:"";height:var(--sidebar-search-icon-size);left:var(--sidebar-item-spacing-horizontal);-webkit-mask-image:var(--icon-search);mask-image:var(--icon-search);position:absolute;width:var(--sidebar-search-icon-size)}.sidebar-search{background:transparent;border:none;border-bottom:1px solid var(--color-sidebar-search-border);border-top:1px solid var(--color-sidebar-search-border);box-sizing:border-box;color:var(--color-sidebar-search-foreground);padding:var(--sidebar-search-input-spacing-vertical) var(--sidebar-search-input-spacing-horizontal) var(--sidebar-search-input-spacing-vertical) calc(var(--sidebar-item-spacing-horizontal) + var(--sidebar-search-input-spacing-horizontal) + var(--sidebar-search-icon-size));width:100%;z-index:10}.sidebar-search:focus{outline:none}.sidebar-search::-moz-placeholder{font-size:var(--sidebar-search-input-font-size)}.sidebar-search::placeholder{font-size:var(--sidebar-search-input-font-size)}#searchbox .highlight-link{margin:0;padding:var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal) 0;text-align:center}#searchbox .highlight-link a{color:var(--color-sidebar-search-icon);font-size:var(--font-size--small--2)}.sidebar-tree{font-size:var(--sidebar-item-font-size);margin-bottom:var(--sidebar-item-spacing-vertical);margin-top:var(--sidebar-tree-space-above)}.sidebar-tree ul{display:flex;flex-direction:column;list-style:none;margin-bottom:0;margin-top:0;padding:0}.sidebar-tree li{margin:0;position:relative}.sidebar-tree li>ul{margin-left:var(--sidebar-item-spacing-horizontal)}.sidebar-tree .icon,.sidebar-tree .reference{color:var(--color-sidebar-link-text)}.sidebar-tree .reference{box-sizing:border-box;display:inline-block;height:100%;line-height:var(--sidebar-item-line-height);overflow-wrap:anywhere;padding:var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal);text-decoration:none;width:100%}.sidebar-tree .reference:hover{background:var(--color-sidebar-item-background--hover)}.sidebar-tree .reference.external:after{color:var(--color-sidebar-link-text);content:url("data:image/svg+xml;charset=utf-8,%3Csvg width='12' height='12' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' stroke-width='1.5' stroke='%23607D8B' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M0 0h24v24H0z' stroke='none'/%3E%3Cpath d='M11 7H6a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2v-5M10 14 20 4M15 4h5v5'/%3E%3C/svg%3E");margin:0 .25rem;vertical-align:middle}.sidebar-tree .current-page>.reference{font-weight:700}.sidebar-tree label{align-items:center;cursor:pointer;display:flex;height:var(--sidebar-item-height);justify-content:center;position:absolute;right:0;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:var(--sidebar-expander-width)}.sidebar-tree .caption,.sidebar-tree :not(.caption)>.caption-text{color:var(--color-sidebar-caption-text);font-size:var(--sidebar-caption-font-size);font-weight:700;margin:var(--sidebar-caption-space-above) 0 0 0;padding:var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal);text-transform:uppercase}.sidebar-tree li.has-children>.reference{padding-right:var(--sidebar-expander-width)}.sidebar-tree .toctree-l1>.reference,.sidebar-tree .toctree-l1>label .icon{color:var(--color-sidebar-link-text--top-level)}.sidebar-tree label{background:var(--color-sidebar-item-expander-background)}.sidebar-tree label:hover{background:var(--color-sidebar-item-expander-background--hover)}.sidebar-tree .current>.reference{background:var(--color-sidebar-item-background--current)}.sidebar-tree .current>.reference:hover{background:var(--color-sidebar-item-background--hover)}.toctree-checkbox{display:none;position:absolute}.toctree-checkbox~ul{display:none}.toctree-checkbox~label .icon svg{transform:rotate(90deg)}.toctree-checkbox:checked~ul{display:block}.toctree-checkbox:checked~label .icon svg{transform:rotate(-90deg)}.toc-title-container{padding:var(--toc-title-padding);padding-top:var(--toc-spacing-vertical)}.toc-title{color:var(--color-toc-title-text);font-size:var(--toc-title-font-size);padding-left:var(--toc-spacing-horizontal);text-transform:uppercase}.no-toc{display:none}.toc-tree-container{padding-bottom:var(--toc-spacing-vertical)}.toc-tree{border-left:1px solid var(--color-background-border);font-size:var(--toc-font-size);line-height:1.3;padding-left:calc(var(--toc-spacing-horizontal) - var(--toc-item-spacing-horizontal))}.toc-tree>ul>li:first-child{padding-top:0}.toc-tree>ul>li:first-child>ul{padding-left:0}.toc-tree>ul>li:first-child>a{display:none}.toc-tree ul{list-style-type:none;margin-bottom:0;margin-top:0;padding-left:var(--toc-item-spacing-horizontal)}.toc-tree li{padding-top:var(--toc-item-spacing-vertical)}.toc-tree li.scroll-current>.reference{color:var(--color-toc-item-text--active);font-weight:700}.toc-tree .reference{color:var(--color-toc-item-text);overflow-wrap:anywhere;text-decoration:none}.toc-scroll{max-height:100vh;overflow-y:scroll}.contents:not(.this-will-duplicate-information-and-it-is-still-useful-here){background:rgba(255,0,0,.25);color:var(--color-problematic)}.contents:not(.this-will-duplicate-information-and-it-is-still-useful-here):before{content:"ERROR: Adding a table of contents in Furo-based documentation is unnecessary, and does not work well with existing styling.Add a 'this-will-duplicate-information-and-it-is-still-useful-here' class, if you want an escape hatch."}.text-align\:left>p{text-align:left}.text-align\:center>p{text-align:center}.text-align\:right>p{text-align:right}
+/*# sourceMappingURL=furo.css.map*/
\ No newline at end of file
diff --git a/docs/_static/styles/furo.css.map b/docs/_static/styles/furo.css.map
new file mode 100644
index 0000000..d1dfb10
--- /dev/null
+++ b/docs/_static/styles/furo.css.map
@@ -0,0 +1 @@
+{"version":3,"file":"styles/furo.css","mappings":"AAAA,2EAA2E,CAU3E,KAEE,6BAA8B,CAD9B,gBAEF,CASA,KACE,QACF,CAMA,KACE,aACF,CAOA,GACE,aAAc,CACd,cACF,CAUA,GACE,sBAAuB,CACvB,QAAS,CACT,gBACF,CAOA,IACE,+BAAiC,CACjC,aACF,CASA,EACE,4BACF,CAOA,YACE,kBAAmB,CACnB,yBAA0B,CAC1B,gCACF,CAMA,SAEE,kBACF,CAOA,cAGE,+BAAiC,CACjC,aACF,CAeA,QAEE,aAAc,CACd,aAAc,CACd,iBAAkB,CAClB,uBACF,CAEA,IACE,aACF,CAEA,IACE,SACF,CASA,IACE,iBACF,CAUA,sCAKE,mBAAoB,CACpB,cAAe,CACf,gBAAiB,CACjB,QACF,CAOA,aAEE,gBACF,CAOA,cAEE,mBACF,CAMA,gDAIE,yBACF,CAMA,wHAIE,iBAAkB,CAClB,SACF,CAMA,4GAIE,6BACF,CAMA,SACE,0BACF,CASA,OACE,qBAAsB,CACtB,aAAc,CACd,aAAc,CACd,cAAe,CACf,SAAU,CACV,kBACF,CAMA,SACE,uBACF,CAMA,SACE,aACF,CAOA,6BAEE,qBAAsB,CACtB,SACF,CAMA,kFAEE,WACF,CAOA,cACE,4BAA6B,CAC7B,mBACF,CAMA,yCACE,uBACF,CAOA,6BACE,yBAA0B,CAC1B,YACF,CASA,QACE,aACF,CAMA,QACE,iBACF,CAiBA,kBACE,YACF,CCvVA,aAcE,kEACE,uBAOF,WACE,iDAMF,gCACE,wBAEF,qCAEE,uBADA,uBACA,CAEF,SACE,wBAtBA,CCpBJ,iBAOE,6BAEA,mBANA,qBAEA,sBACA,0BAFA,oBAHA,4BAOA,6BANA,mBAOA,CAEF,gBACE,aCPF,KCGE,mHAEA,wGAGA,wBAAyB,CACzB,wBAAyB,CACzB,4BAA6B,CAC7B,yBAA0B,CAC1B,2BAA4B,CAG5B,sDAAuD,CACvD,gDAAiD,CACjD,wDAAyD,CAGzD,0CAA2C,CAC3C,gDAAiD,CACjD,gDAAiD,CAKjD,gCAAiC,CACjC,sCAAuC,CAGvC,2CAA4C,CAG5C,uCAAwC,CChCxC,+FAGA,uBAAwB,CAGxB,iCAAkC,CAClC,kCAAmC,CAEnC,+BAAgC,CAChC,sCAAuC,CACvC,sCAAuC,CACvC,qGAIA,mDAAoD,CAEpD,mCAAoC,CACpC,8CAA+C,CAC/C,gDAAiD,CACjD,kCAAmC,CACnC,6DAA8D,CAG9D,6BAA8B,CAC9B,6BAA8B,CAC9B,+BAAgC,CAChC,kCAAmC,CACnC,kCAAmC,CCPjC,ukBCYA,srCAZF,kaCVA,mLAOA,oTAWA,2UAaA,0CACA,gEACA,0CAGA,gEAUA,yCACA,+DAGA,4CACA,CACA,iEAGA,sGACA,uCACA,4DAGA,sCACA,2DAEA,4CACA,kEACA,oGACA,CAEA,0GACA,+CAGA,+MAOA,+EACA,wCAIA,4DACA,sEACA,kEACA,sEACA,gDAGA,+DACA,0CACA,gEACA,gGACA,CAGA,2DACA,qDAGA,0CACA,8CACA,oDACA,oDL7GF,iCAEA,iEAME,oCKyGA,yDAIA,sCACA,kCACA,sDAGA,0CACA,kEACA,oDAEA,sDAGA,oCACA,oEAIA,CAGA,yDAGA,qDACA,oDAGA,6DAIA,iEAGA,2DAEA,2DL9IE,4DAEA,gEAIF,gEKgGA,gFAIA,oNAOA,qDAEA,gFAIA,4DAIA,oEAMA,yEAIA,6DACA,0DAGA,uDAGA,qDAEA,wDLpII,6DAEA,yDACE,2DAMN,uCAIA,yCACE,8CAGF,sDMjDA,6DAKA,oCAIA,4CACA,kBAGF,sBAMA,2BAME,qCAGA,qCAEA,iCAEA,+BAEA,mCAEA,qCAIA,CACA,gCACA,gDAKA,kCAIA,6BAEA,0CAQA,kCAIF,8BAGE,8BACA,uCAGF,sCAKE,kCAEA,sDAGA,iCACE,CACA,2FAGA,gCACE,CACA,+DCzEJ,wCAEA,sBAEF,yDAEE,mCACA,wDAGA,2GAGA,wIACE,gDAMJ,kCAGE,6BACA,0CAGA,gEACA,8BACA,uCAKA,sCAIA,kCACA,sDACA,iCACA,sCAOA,sDAKE,gGAIE,+CAGN,sBAEE,yCAMA,0BAMA,yLAMA,aACA,MAEF,6BACE,2DAIF,wCAIE,kCAGA,SACA,kCAKA,mBAGA,CAJA,eACA,CAHF,gBAEE,CAWA,mBACA,mBACA,mDAGA,YACA,CACA,kBACA,CAEE,kBAKJ,OAPE,kBAQA,CADF,GACE,iCACA,wCAEA,wBACA,aACA,CAFA,WAEA,GACA,oBACA,CAFA,gBAEA,aACE,+CAIF,UAJE,kCAIF,WACA,iBACA,GAGA,uBACE,CAJF,yBAGA,CACE,iDACA,uCAEA,yDACE,cACA,wDAKN,yDAIE,uBAEF,kBACE,uBAEA,kDAIA,0DAGA,CAHA,oBAGA,0GAYA,aAEA,CAHA,YAGA,4HAKF,+CAGE,sBAEF,WAKE,0CAEA,CALA,qCAGA,CAJA,WAOA,SAIA,2CAJA,qCAIA,CACE,wBACA,OACA,YAEJ,gBACE,gBAIA,+CAKF,CAGE,kDAGA,CANF,8BAGE,CAGA,YAEA,CAdF,2BACE,CAHA,UAEF,CAYE,UAEA,CACA,0CACF,iEAOE,iCACA,8BAGA,wCAIA,wBAKE,0CAKF,CARE,6DAGA,CALF,qBAEE,CASA,YACA,yBAGA,CAEE,cAKN,CAPI,sBAOJ,gCAGE,qBAEA,WACA,aACA,sCAEA,mBACA,6BAGA,uEADA,qBACA,6BAIA,yBACA,qCAEE,UAEA,YACA,sBAEF,8BAGA,CAPE,aACA,WAMF,4BACE,sBACA,WAMJ,uBACE,cAYE,mBAXA,qDAKA,qCAGA,CAEA,YACA,CAHA,2BAEA,CACA,oCAEA,4CACA,uBAIA,oCAEJ,CAFI,cAIF,iBACE,CAHJ,kBAGI,yBAEA,oCAIA,qDAMF,mEAEA,CACE,8CAKA,gCAEA,qCAGA,oCAGE,sBACA,CAJF,WAEE,CAFF,eAEE,SAEA,mBACA,qCACE,aACA,CAFF,YADA,qBACA,WAEE,sBACA,kEAEN,2BAEE,iDAKA,uCAGF,CACE,0DAKA,kBACF,CAFE,sBAGA,mBACA,0BAEJ,yBAII,aADA,WACA,CAMF,UAFE,kBAEF,CAJF,gBACE,CAHE,iBAMF,6CC9ZF,yBACE,WACA,iBAEA,aAFA,iBAEA,6BAEA,kCACA,mBAKA,gCAGA,CARA,QAEA,CAGA,UALA,qBAEA,qDAGA,CALA,OAQA,4BACE,cAGF,2BACE,gCAEJ,CAHE,UAGF,8CAGE,CAHF,UAGE,wCAGA,qBACA,CAFA,UAEA,6CAGA,yCAIA,sBAHA,UAGA,kCACE,OACA,CAFF,KAEE,cAQF,0CACE,CAFF,kBACA,CACE,wEACA,CARA,YACA,CAKF,mBAFF,OAII,eACA,CAJF,iCAJE,cAGJ,CANI,oBAEA,CAKF,SAIE,2BADA,UACA,kBAGF,sCACA,CAFF,WACE,WACA,qCACE,gCACA,2EACA,sDAKJ,aACE,mDAII,CAJJ,6CAII,kEACA,iBACE,iDACA,+CACE,aACA,WADA,+BACA,uEANN,YACE,mDAEE,mBADF,0CACE,CADF,qBACE,0DACA,YACE,4DACA,sEANN,YACE,8CACA,kBADA,UACA,2CACE,2EACA,cACE,kEACA,mEANN,yBACE,4DACA,sBACE,+EAEE,iEACA,qEANN,sCACE,CAGE,iBAHF,gBAGE,qBACE,CAJJ,uBACA,gDACE,wDACA,6DAHF,2CACA,CADA,gBACA,eACE,CAGE,sBANN,8BACE,CAII,iBAFF,4DACA,WACE,YADF,uCACE,6EACA,2BANN,8CACE,kDACA,0CACE,8BACA,yFACE,sBACA,sFALJ,mEACA,sBACE,kEACA,6EACE,uCACA,kEALJ,qGAEE,kEACA,6EACE,uCACA,kEALJ,8CACA,uDACE,sEACA,2EACE,sCACA,iEALJ,mGACA,qCACE,oDACA,0DACE,6GACA,gDAGR,yDCrEA,sEACE,CACA,6GACE,gEACF,iGAIF,wFACE,qDAGA,mGAEE,2CAEF,4FACE,gCACF,wGACE,8DAEE,6FAIA,iJAKN,6GACE,gDAKF,yDACA,qCAGA,6BACA,kBACA,qDAKA,oCAEA,+DAGA,2CAGE,oDAIA,oEAEE,qBAGJ,wDAEE,uCAEF,kEAGA,8CAEA,uDAKA,oCAEA,yDAEE,gEAKF,+CC5FA,0EAGE,CACA,qDCLJ,+DAIE,sCAIA,kEACE,yBACA,2FAMA,gBACA,yGCbF,mBAOA,2MAIA,4HAYA,0DACE,8GAYF,8HAQE,mBAEA,6HAOF,YAGA,mIAME,eACA,CAFF,YAEE,4FAMJ,8BAEE,uBAYA,sCAEE,CAJF,oBAEA,CARA,wCAEA,CAHA,8BACA,CAFA,eACA,CAGA,wCAEA,CAEA,mDAIE,kCACE,6BACA,4CAKJ,kDAIA,eACE,aAGF,8BACE,uDACA,sCACA,cAEA,+BACA,CAFA,eAEA,wCAEF,YACE,iBACA,mCACA,0DAGF,qBAEE,CAFF,kBAEE,+BAIA,yCAEE,qBADA,gBACA,yBAKF,eACA,CAFF,YACE,CACA,iBACA,qDAEA,mDCvIJ,2FAOE,iCACA,CAEA,eACA,CAHA,kBAEA,CAFA,wBAGA,8BACA,eACE,CAFF,YAEE,0BACA,8CAGA,oBACE,oCAGA,kBACE,8DAEA,iBAEN,UACE,8BAIJ,+CAEE,qDAEF,kDAIE,YAEF,CAFE,YAEF,CCjCE,mFAJA,QACA,UAIE,CADF,iBACE,mCAGA,iDACE,+BAGF,wBAEA,mBAKA,6CAEF,CAHE,mBACA,CAEF,kCAIE,CARA,kBACA,CAFF,eASE,YACA,mBAGF,CAJE,UAIF,wCCjCA,oBDmCE,wBCpCJ,uCACE,8BACA,4CACA,oBAGA,2CCAA,6CAGE,CAPF,uBAIA,CDGA,gDACE,6BCVJ,CAWM,2CAEF,CAJA,kCAEE,CDJF,aCLF,gBDKE,uBCMA,gCAGA,gDAGE,wBAGJ,0BAEA,iBACE,aACF,CADE,UACF,uBACE,aACF,oBACE,YACF,4BACE,6CAMA,CAYF,6DAZE,mCAGE,iCASJ,4BAGE,4DADA,+BACA,CAFA,qBAEA,yBACE,aAEF,wBAHA,SAGA,iHACE,2DAKF,CANA,yCACE,CADF,oCAMA,uSAIA,sGACE,oDChEJ,WAEF,yBACE,QACA,eAEA,gBAEE,uCAGA,CALF,iCAKE,uCAGA,0BACA,CACA,oBACA,iCClBJ,gBACE,KAGF,qBACE,YAGF,CAHE,cAGF,gCAEE,mBACA,iEAEA,oCACA,wCAEA,sBACA,WAEA,CAFA,YAEA,8EAEA,mCAFA,iBAEA,6BAIA,wEAKA,sDAIE,CARF,mDAIA,CAIE,cAEF,8CAIA,oBAFE,iBAEF,8CAGE,eAEF,CAFE,YAEF,OAEE,kBAGJ,CAJI,eACA,CAFF,mBAKF,yCCjDE,oBACA,CAFA,iBAEA,uCAKE,iBACA,qCAGA,mBCZJ,CDWI,gBCXJ,6BAEE,eACA,sBAGA,eAEA,sBACA,oDACA,iGAMA,gBAFE,YAEF,8FAME,iJClBF,YACA,gNAUE,6BAEF,oTAcI,kBACF,gHAIA,qBACE,eACF,qDACE,kBACF,6DACE,4BCxCJ,oBAEF,qCAEI,+CAGF,uBACE,uDAGJ,oBAkBE,mDAhBA,+CAaA,CAbA,oBAaA,0FAEE,CAFF,gGAbA,+BAaA,0BAGA,mQAIA,oNAEE,iBAGJ,CAHI,gBADA,gBAIJ,8CAYI,CAZJ,wCAYI,sVACE,iCAGA,uEAHA,QAGA,qXAKJ,iDAGF,CARM,+CACE,iDAIN,CALI,gBAQN,mHACE,gBAGF,2DACE,0EAOA,0EAKA,6EC/EA,iDACA,gCACA,oDAGA,qBACA,oDCFA,cACA,eAEA,yBAGF,sBAEE,iBACA,sNAWA,iBACE,kBACA,wRAgBA,kBAEA,iOAgBA,uCACE,uEAEA,kBAEF,qUAuBE,iDAIJ,CACA,geCxFF,4BAEE,CAQA,6JACA,iDAIA,sEAGA,mDAOF,iDAGE,4DAIA,8CACA,qDAEE,eAFF,cAEE,oBAEF,uBAFE,kCAGA,eACA,iBACA,mBAIA,mDACA,CAHA,uCAEA,CAJA,0CACA,CAIA,gBAJA,gBACA,oBADA,gBAIA,wBAEJ,gBAGE,6BACA,YAHA,iBAGA,gCACA,iEAEA,6CACA,sDACA,0BADA,wBACA,0BACA,oIAIA,mBAFA,YAEA,qBACA,0CAIE,uBAEF,CAHA,yBACE,CAEF,iDACE,mFAKJ,oCACE,CANE,aAKJ,CACE,qEAIA,YAFA,WAEA,CAHA,aACA,CAEA,gBACE,4BACA,sBADA,aACA,gCAMF,oCACA,yDACA,2CAEA,qBAGE,kBAEA,CACA,mCAIF,CARE,YACA,CAOF,iCAEE,CAPA,oBACA,CAQA,oBACE,uDAEJ,sDAGA,CAHA,cAGA,0BACE,oDAIA,oCACA,4BACA,sBAGA,cAEA,oFAGA,sBAEA,yDACE,CAIA,iBAJA,wBAIA,6CAJA,6CAOA,4BAGJ,CAHI,cAGJ,yCAGA,kBACE,CAIA,iDAEA,CATA,YAEF,CACE,4CAGA,kBAIA,wEAEA,wDAIF,kCAOE,iDACA,CARF,WAIE,sCAGA,CANA,2CACA,CAMA,oEARF,iBACE,CACA,qCAMA,iBAuBE,uBAlBF,YAKA,2DALA,uDAKA,CALA,sBAiBA,4CACE,CALA,gRAIF,YACE,UAEN,uBACE,YACA,mCAOE,+CAGA,8BAGF,+CAGA,4BCjNA,SDiNA,qFCjNA,gDAGA,sCACA,qCACA,sDAIF,CAIE,kDAGA,CAPF,0CAOE,kBAEA,kDAEA,CAHA,eACA,CAFA,YACA,CADA,SAIA,mHAIE,CAGA,6CAFA,oCAeE,CAbF,yBACE,qBAEJ,CAGE,oBACA,CAEA,YAFA,2CACF,CACE,uBAEA,mFAEE,CALJ,oBACE,CAEA,UAEE,gCAGF,sDAEA,yCC7CJ,oCAGA,CD6CE,yXAQE,sCCrDJ,wCAGA,oCACE","sources":["webpack:///./node_modules/normalize.css/normalize.css","webpack:///./src/furo/assets/styles/base/_print.sass","webpack:///./src/furo/assets/styles/base/_screen-readers.sass","webpack:///./src/furo/assets/styles/base/_theme.sass","webpack:///./src/furo/assets/styles/variables/_fonts.scss","webpack:///./src/furo/assets/styles/variables/_spacing.scss","webpack:///./src/furo/assets/styles/variables/_icons.scss","webpack:///./src/furo/assets/styles/variables/_admonitions.scss","webpack:///./src/furo/assets/styles/variables/_colors.scss","webpack:///./src/furo/assets/styles/base/_typography.sass","webpack:///./src/furo/assets/styles/_scaffold.sass","webpack:///./src/furo/assets/styles/content/_admonitions.sass","webpack:///./src/furo/assets/styles/content/_api.sass","webpack:///./src/furo/assets/styles/content/_blocks.sass","webpack:///./src/furo/assets/styles/content/_captions.sass","webpack:///./src/furo/assets/styles/content/_code.sass","webpack:///./src/furo/assets/styles/content/_footnotes.sass","webpack:///./src/furo/assets/styles/content/_images.sass","webpack:///./src/furo/assets/styles/content/_indexes.sass","webpack:///./src/furo/assets/styles/content/_lists.sass","webpack:///./src/furo/assets/styles/content/_math.sass","webpack:///./src/furo/assets/styles/content/_misc.sass","webpack:///./src/furo/assets/styles/content/_rubrics.sass","webpack:///./src/furo/assets/styles/content/_sidebar.sass","webpack:///./src/furo/assets/styles/content/_tables.sass","webpack:///./src/furo/assets/styles/content/_target.sass","webpack:///./src/furo/assets/styles/content/_gui-labels.sass","webpack:///./src/furo/assets/styles/components/_footer.sass","webpack:///./src/furo/assets/styles/components/_sidebar.sass","webpack:///./src/furo/assets/styles/components/_table_of_contents.sass","webpack:///./src/furo/assets/styles/_shame.sass"],"sourcesContent":["/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */\n\n/* Document\n ========================================================================== */\n\n/**\n * 1. Correct the line height in all browsers.\n * 2. Prevent adjustments of font size after orientation changes in iOS.\n */\n\nhtml {\n line-height: 1.15; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n}\n\n/* Sections\n ========================================================================== */\n\n/**\n * Remove the margin in all browsers.\n */\n\nbody {\n margin: 0;\n}\n\n/**\n * Render the `main` element consistently in IE.\n */\n\nmain {\n display: block;\n}\n\n/**\n * Correct the font size and margin on `h1` elements within `section` and\n * `article` contexts in Chrome, Firefox, and Safari.\n */\n\nh1 {\n font-size: 2em;\n margin: 0.67em 0;\n}\n\n/* Grouping content\n ========================================================================== */\n\n/**\n * 1. Add the correct box sizing in Firefox.\n * 2. Show the overflow in Edge and IE.\n */\n\nhr {\n box-sizing: content-box; /* 1 */\n height: 0; /* 1 */\n overflow: visible; /* 2 */\n}\n\n/**\n * 1. Correct the inheritance and scaling of font size in all browsers.\n * 2. Correct the odd `em` font sizing in all browsers.\n */\n\npre {\n font-family: monospace, monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/* Text-level semantics\n ========================================================================== */\n\n/**\n * Remove the gray background on active links in IE 10.\n */\n\na {\n background-color: transparent;\n}\n\n/**\n * 1. Remove the bottom border in Chrome 57-\n * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.\n */\n\nabbr[title] {\n border-bottom: none; /* 1 */\n text-decoration: underline; /* 2 */\n text-decoration: underline dotted; /* 2 */\n}\n\n/**\n * Add the correct font weight in Chrome, Edge, and Safari.\n */\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/**\n * 1. Correct the inheritance and scaling of font size in all browsers.\n * 2. Correct the odd `em` font sizing in all browsers.\n */\n\ncode,\nkbd,\nsamp {\n font-family: monospace, monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/**\n * Add the correct font size in all browsers.\n */\n\nsmall {\n font-size: 80%;\n}\n\n/**\n * Prevent `sub` and `sup` elements from affecting the line height in\n * all browsers.\n */\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/* Embedded content\n ========================================================================== */\n\n/**\n * Remove the border on images inside links in IE 10.\n */\n\nimg {\n border-style: none;\n}\n\n/* Forms\n ========================================================================== */\n\n/**\n * 1. Change the font styles in all browsers.\n * 2. Remove the margin in Firefox and Safari.\n */\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-size: 100%; /* 1 */\n line-height: 1.15; /* 1 */\n margin: 0; /* 2 */\n}\n\n/**\n * Show the overflow in IE.\n * 1. Show the overflow in Edge.\n */\n\nbutton,\ninput { /* 1 */\n overflow: visible;\n}\n\n/**\n * Remove the inheritance of text transform in Edge, Firefox, and IE.\n * 1. Remove the inheritance of text transform in Firefox.\n */\n\nbutton,\nselect { /* 1 */\n text-transform: none;\n}\n\n/**\n * Correct the inability to style clickable types in iOS and Safari.\n */\n\nbutton,\n[type=\"button\"],\n[type=\"reset\"],\n[type=\"submit\"] {\n -webkit-appearance: button;\n}\n\n/**\n * Remove the inner border and padding in Firefox.\n */\n\nbutton::-moz-focus-inner,\n[type=\"button\"]::-moz-focus-inner,\n[type=\"reset\"]::-moz-focus-inner,\n[type=\"submit\"]::-moz-focus-inner {\n border-style: none;\n padding: 0;\n}\n\n/**\n * Restore the focus styles unset by the previous rule.\n */\n\nbutton:-moz-focusring,\n[type=\"button\"]:-moz-focusring,\n[type=\"reset\"]:-moz-focusring,\n[type=\"submit\"]:-moz-focusring {\n outline: 1px dotted ButtonText;\n}\n\n/**\n * Correct the padding in Firefox.\n */\n\nfieldset {\n padding: 0.35em 0.75em 0.625em;\n}\n\n/**\n * 1. Correct the text wrapping in Edge and IE.\n * 2. Correct the color inheritance from `fieldset` elements in IE.\n * 3. Remove the padding so developers are not caught out when they zero out\n * `fieldset` elements in all browsers.\n */\n\nlegend {\n box-sizing: border-box; /* 1 */\n color: inherit; /* 2 */\n display: table; /* 1 */\n max-width: 100%; /* 1 */\n padding: 0; /* 3 */\n white-space: normal; /* 1 */\n}\n\n/**\n * Add the correct vertical alignment in Chrome, Firefox, and Opera.\n */\n\nprogress {\n vertical-align: baseline;\n}\n\n/**\n * Remove the default vertical scrollbar in IE 10+.\n */\n\ntextarea {\n overflow: auto;\n}\n\n/**\n * 1. Add the correct box sizing in IE 10.\n * 2. Remove the padding in IE 10.\n */\n\n[type=\"checkbox\"],\n[type=\"radio\"] {\n box-sizing: border-box; /* 1 */\n padding: 0; /* 2 */\n}\n\n/**\n * Correct the cursor style of increment and decrement buttons in Chrome.\n */\n\n[type=\"number\"]::-webkit-inner-spin-button,\n[type=\"number\"]::-webkit-outer-spin-button {\n height: auto;\n}\n\n/**\n * 1. Correct the odd appearance in Chrome and Safari.\n * 2. Correct the outline style in Safari.\n */\n\n[type=\"search\"] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/**\n * Remove the inner padding in Chrome and Safari on macOS.\n */\n\n[type=\"search\"]::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/**\n * 1. Correct the inability to style clickable types in iOS and Safari.\n * 2. Change font properties to `inherit` in Safari.\n */\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/* Interactive\n ========================================================================== */\n\n/*\n * Add the correct display in Edge, IE 10+, and Firefox.\n */\n\ndetails {\n display: block;\n}\n\n/*\n * Add the correct display in all browsers.\n */\n\nsummary {\n display: list-item;\n}\n\n/* Misc\n ========================================================================== */\n\n/**\n * Add the correct display in IE 10+.\n */\n\ntemplate {\n display: none;\n}\n\n/**\n * Add the correct display in IE 10.\n */\n\n[hidden] {\n display: none;\n}\n","// This file contains styles for managing print media.\n\n////////////////////////////////////////////////////////////////////////////////\n// Hide elements not relevant to print media.\n////////////////////////////////////////////////////////////////////////////////\n@media print\n // Hide icon container.\n .content-icon-container\n display: none !important\n\n // Hide showing header links if hovering over when printing.\n .headerlink\n display: none !important\n\n // Hide mobile header.\n .mobile-header\n display: none !important\n\n // Hide navigation links.\n .related-pages\n display: none !important\n\n////////////////////////////////////////////////////////////////////////////////\n// Tweaks related to decolorization.\n////////////////////////////////////////////////////////////////////////////////\n@media print\n // Apply a border around code which no longer have a color background.\n .highlight\n border: 0.1pt solid var(--color-foreground-border)\n\n////////////////////////////////////////////////////////////////////////////////\n// Avoid page break in some relevant cases.\n////////////////////////////////////////////////////////////////////////////////\n@media print\n ul, ol, dl, a, table, pre, blockquote\n page-break-inside: avoid\n\n h1, h2, h3, h4, h5, h6, img, figure, caption\n page-break-inside: avoid\n page-break-after: avoid\n\n ul, ol, dl\n page-break-before: avoid\n",".visually-hidden\n position: absolute !important\n width: 1px !important\n height: 1px !important\n padding: 0 !important\n margin: -1px !important\n overflow: hidden !important\n clip: rect(0,0,0,0) !important\n white-space: nowrap !important\n border: 0 !important\n\n:-moz-focusring\n outline: auto\n","// This file serves as the \"skeleton\" of the theming logic.\n//\n// This contains the bulk of the logic for handling dark mode, color scheme\n// toggling and the handling of color-scheme-specific hiding of elements.\n\nbody\n @include fonts\n @include spacing\n @include icons\n @include admonitions\n @include default-admonition(#651fff, \"abstract\")\n @include default-topic(#14B8A6, \"pencil\")\n\n @include colors\n\n.only-light\n display: block !important\nhtml body .only-dark\n display: none !important\n\n// Ignore dark-mode hints if print media.\n@media not print\n // Enable dark-mode, if requested.\n body[data-theme=\"dark\"]\n @include colors-dark\n\n html & .only-light\n display: none !important\n .only-dark\n display: block !important\n\n // Enable dark mode, unless explicitly told to avoid.\n @media (prefers-color-scheme: dark)\n body:not([data-theme=\"light\"])\n @include colors-dark\n\n html & .only-light\n display: none !important\n .only-dark\n display: block !important\n\n//\n// Theme toggle presentation\n//\nbody[data-theme=\"auto\"]\n .theme-toggle svg.theme-icon-when-auto\n display: block\n\nbody[data-theme=\"dark\"]\n .theme-toggle svg.theme-icon-when-dark\n display: block\n\nbody[data-theme=\"light\"]\n .theme-toggle svg.theme-icon-when-light\n display: block\n","// Fonts used by this theme.\n//\n// There are basically two things here -- using the system font stack and\n// defining sizes for various elements in %ages. We could have also used `em`\n// but %age is easier to reason about for me.\n\n@mixin fonts {\n // These are adapted from https://systemfontstack.com/\n --font-stack: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial,\n sans-serif, Apple Color Emoji, Segoe UI Emoji;\n --font-stack--monospace: \"SFMono-Regular\", Menlo, Consolas, Monaco,\n Liberation Mono, Lucida Console, monospace;\n\n --font-size--normal: 100%;\n --font-size--small: 87.5%;\n --font-size--small--2: 81.25%;\n --font-size--small--3: 75%;\n --font-size--small--4: 62.5%;\n\n // Sidebar\n --sidebar-caption-font-size: var(--font-size--small--2);\n --sidebar-item-font-size: var(--font-size--small);\n --sidebar-search-input-font-size: var(--font-size--small);\n\n // Table of Contents\n --toc-font-size: var(--font-size--small--3);\n --toc-font-size--mobile: var(--font-size--normal);\n --toc-title-font-size: var(--font-size--small--4);\n\n // Admonitions\n //\n // These aren't defined in terms of %ages, since nesting these is permitted.\n --admonition-font-size: 0.8125rem;\n --admonition-title-font-size: 0.8125rem;\n\n // Code\n --code-font-size: var(--font-size--small--2);\n\n // API\n --api-font-size: var(--font-size--small);\n}\n","// Spacing for various elements on the page\n//\n// If the user wants to tweak things in a certain way, they are permitted to.\n// They also have to deal with the consequences though!\n\n@mixin spacing {\n // Header!\n --header-height: calc(\n var(--sidebar-item-line-height) + 4 * #{var(--sidebar-item-spacing-vertical)}\n );\n --header-padding: 0.5rem;\n\n // Sidebar\n --sidebar-tree-space-above: 1.5rem;\n --sidebar-caption-space-above: 1rem;\n\n --sidebar-item-line-height: 1rem;\n --sidebar-item-spacing-vertical: 0.5rem;\n --sidebar-item-spacing-horizontal: 1rem;\n --sidebar-item-height: calc(\n var(--sidebar-item-line-height) + 2 *#{var(--sidebar-item-spacing-vertical)}\n );\n\n --sidebar-expander-width: var(--sidebar-item-height); // be square\n\n --sidebar-search-space-above: 0.5rem;\n --sidebar-search-input-spacing-vertical: 0.5rem;\n --sidebar-search-input-spacing-horizontal: 0.5rem;\n --sidebar-search-input-height: 1rem;\n --sidebar-search-icon-size: var(--sidebar-search-input-height);\n\n // Table of Contents\n --toc-title-padding: 0.25rem 0;\n --toc-spacing-vertical: 1.5rem;\n --toc-spacing-horizontal: 1.5rem;\n --toc-item-spacing-vertical: 0.4rem;\n --toc-item-spacing-horizontal: 1rem;\n}\n","// Expose theme icons as CSS variables.\n\n$icons: (\n // Adapted from tabler-icons\n // url: https://tablericons.com/\n \"search\":\n url('data:image/svg+xml;charset=utf-8, '),\n // Factored out from mkdocs-material on 24-Aug-2020.\n // url: https://squidfunk.github.io/mkdocs-material/reference/admonitions/\n \"pencil\":\n url('data:image/svg+xml;charset=utf-8, '),\n \"abstract\":\n url('data:image/svg+xml;charset=utf-8, '),\n \"info\":\n url('data:image/svg+xml;charset=utf-8, '),\n \"flame\":\n url('data:image/svg+xml;charset=utf-8, '),\n \"question\":\n url('data:image/svg+xml;charset=utf-8, '),\n \"warning\":\n url('data:image/svg+xml;charset=utf-8, '),\n \"failure\":\n url('data:image/svg+xml;charset=utf-8, '),\n \"spark\":\n url('data:image/svg+xml;charset=utf-8, ')\n);\n\n@mixin icons {\n @each $name, $glyph in $icons {\n --icon-#{$name}: #{$glyph};\n }\n}\n","// Admonitions\n\n// Structure of these is:\n// admonition-class: color \"icon-name\";\n//\n// The colors are translated into CSS variables below. The icons are\n// used directly in the main declarations to set the `mask-image` in\n// the title.\n\n// prettier-ignore\n$admonitions: (\n // Each of these has an reST directives for it.\n \"caution\": #ff9100 \"spark\",\n \"warning\": #ff9100 \"warning\",\n \"danger\": #ff5252 \"spark\",\n \"attention\": #ff5252 \"warning\",\n \"error\": #ff5252 \"failure\",\n \"hint\": #00c852 \"question\",\n \"tip\": #00c852 \"info\",\n \"important\": #00bfa5 \"flame\",\n \"note\": #00b0ff \"pencil\",\n \"seealso\": #448aff \"info\",\n \"admonition-todo\": #808080 \"pencil\"\n);\n\n@mixin default-admonition($color, $icon-name) {\n --color-admonition-title: #{$color};\n --color-admonition-title-background: #{rgba($color, 0.2)};\n\n --icon-admonition-default: var(--icon-#{$icon-name});\n}\n\n@mixin default-topic($color, $icon-name) {\n --color-topic-title: #{$color};\n --color-topic-title-background: #{rgba($color, 0.2)};\n\n --icon-topic-default: var(--icon-#{$icon-name});\n}\n\n@mixin admonitions {\n @each $name, $values in $admonitions {\n --color-admonition-title--#{$name}: #{nth($values, 1)};\n --color-admonition-title-background--#{$name}: #{rgba(\n nth($values, 1),\n 0.2\n )};\n }\n}\n","// Colors used throughout this theme.\n//\n// The aim is to give the user more control. Thus, instead of hard-coding colors\n// in various parts of the stylesheet, the approach taken is to define all\n// colors as CSS variables and reusing them in all the places.\n//\n// `colors-dark` depends on `colors` being included at a lower specificity.\n\n@mixin colors {\n --color-problematic: #b30000;\n\n // Base Colors\n --color-foreground-primary: black; // for main text and headings\n --color-foreground-secondary: #5a5c63; // for secondary text\n --color-foreground-muted: #646776; // for muted text\n --color-foreground-border: #878787; // for content borders\n\n --color-background-primary: white; // for content\n --color-background-secondary: #f8f9fb; // for navigation + ToC\n --color-background-hover: #efeff4ff; // for navigation-item hover\n --color-background-hover--transparent: #efeff400;\n --color-background-border: #eeebee; // for UI borders\n --color-background-item: #ccc; // for \"background\" items (eg: copybutton)\n\n // Announcements\n --color-announcement-background: #000000dd;\n --color-announcement-text: #eeebee;\n\n // Brand colors\n --color-brand-primary: #2962ff;\n --color-brand-content: #2a5adf;\n\n // API documentation\n --color-api-background: var(--color-background-hover--transparent);\n --color-api-background-hover: var(--color-background-hover);\n --color-api-overall: var(--color-foreground-secondary);\n --color-api-name: var(--color-problematic);\n --color-api-pre-name: var(--color-problematic);\n --color-api-paren: var(--color-foreground-secondary);\n --color-api-keyword: var(--color-foreground-primary);\n --color-highlight-on-target: #ffffcc;\n\n // Inline code background\n --color-inline-code-background: var(--color-background-secondary);\n\n // Highlighted text (search)\n --color-highlighted-background: #ddeeff;\n --color-highlighted-text: var(--color-foreground-primary);\n\n // GUI Labels\n --color-guilabel-background: #ddeeff80;\n --color-guilabel-border: #bedaf580;\n --color-guilabel-text: var(--color-foreground-primary);\n\n // Admonitions!\n --color-admonition-background: transparent;\n\n //////////////////////////////////////////////////////////////////////////////\n // Everything below this should be one of:\n // - var(...)\n // - *-gradient(...)\n // - special literal values (eg: transparent, none)\n //////////////////////////////////////////////////////////////////////////////\n\n // Tables\n --color-table-header-background: var(--color-background-secondary);\n --color-table-border: var(--color-background-border);\n\n // Cards\n --color-card-border: var(--color-background-secondary);\n --color-card-background: transparent;\n --color-card-marginals-background: var(--color-background-secondary);\n\n // Header\n --color-header-background: var(--color-background-primary);\n --color-header-border: var(--color-background-border);\n --color-header-text: var(--color-foreground-primary);\n\n // Sidebar (left)\n --color-sidebar-background: var(--color-background-secondary);\n --color-sidebar-background-border: var(--color-background-border);\n\n --color-sidebar-brand-text: var(--color-foreground-primary);\n --color-sidebar-caption-text: var(--color-foreground-muted);\n --color-sidebar-link-text: var(--color-foreground-secondary);\n --color-sidebar-link-text--top-level: var(--color-brand-primary);\n\n --color-sidebar-item-background: var(--color-sidebar-background);\n --color-sidebar-item-background--current: var(\n --color-sidebar-item-background\n );\n --color-sidebar-item-background--hover: linear-gradient(\n 90deg,\n var(--color-background-hover--transparent) 0%,\n var(--color-background-hover) var(--sidebar-item-spacing-horizontal),\n var(--color-background-hover) 100%\n );\n\n --color-sidebar-item-expander-background: transparent;\n --color-sidebar-item-expander-background--hover: var(\n --color-background-hover\n );\n\n --color-sidebar-search-text: var(--color-foreground-primary);\n --color-sidebar-search-background: var(--color-background-secondary);\n --color-sidebar-search-background--focus: var(--color-background-primary);\n --color-sidebar-search-border: var(--color-background-border);\n --color-sidebar-search-icon: var(--color-foreground-muted);\n\n // Table of Contents (right)\n --color-toc-background: var(--color-background-primary);\n --color-toc-title-text: var(--color-foreground-muted);\n --color-toc-item-text: var(--color-foreground-secondary);\n --color-toc-item-text--hover: var(--color-foreground-primary);\n --color-toc-item-text--active: var(--color-brand-primary);\n\n // Actual page contents\n --color-content-foreground: var(--color-foreground-primary);\n --color-content-background: transparent;\n\n // Links\n --color-link: var(--color-brand-content);\n --color-link--hover: var(--color-brand-content);\n --color-link-underline: var(--color-background-border);\n --color-link-underline--hover: var(--color-foreground-border);\n}\n\n@mixin colors-dark {\n --color-problematic: #ee5151;\n\n // Base Colors\n --color-foreground-primary: #ffffffcc; // for main text and headings\n --color-foreground-secondary: #9ca0a5; // for secondary text\n --color-foreground-muted: #81868d; // for muted text\n --color-foreground-border: #666666; // for content borders\n\n --color-background-primary: #131416; // for content\n --color-background-secondary: #1a1c1e; // for navigation + ToC\n --color-background-hover: #1e2124ff; // for navigation-item hover\n --color-background-hover--transparent: #1e212400;\n --color-background-border: #303335; // for UI borders\n --color-background-item: #444; // for \"background\" items (eg: copybutton)\n\n // Announcements\n --color-announcement-background: #000000dd;\n --color-announcement-text: #eeebee;\n\n // Brand colors\n --color-brand-primary: #2b8cee;\n --color-brand-content: #368ce2;\n\n // Highlighted text (search)\n --color-highlighted-background: #083563;\n\n // GUI Labels\n --color-guilabel-background: #08356380;\n --color-guilabel-border: #13395f80;\n\n // API documentation\n --color-api-keyword: var(--color-foreground-secondary);\n --color-highlight-on-target: #333300;\n\n // Admonitions\n --color-admonition-background: #18181a;\n\n // Cards\n --color-card-border: var(--color-background-secondary);\n --color-card-background: #18181a;\n --color-card-marginals-background: var(--color-background-hover);\n}\n","// This file contains the styling for making the content throughout the page,\n// including fonts, paragraphs, headings and spacing among these elements.\n\nbody\n font-family: var(--font-stack)\npre,\ncode,\nkbd,\nsamp\n font-family: var(--font-stack--monospace)\n\n// Make fonts look slightly nicer.\nbody\n -webkit-font-smoothing: antialiased\n -moz-osx-font-smoothing: grayscale\n\n// Line height from Bootstrap 4.1\narticle\n line-height: 1.5\n\n//\n// Headings\n//\nh1,\nh2,\nh3,\nh4,\nh5,\nh6\n line-height: 1.25\n font-weight: bold\n\n border-radius: 0.5rem\n margin-top: 0.5rem\n margin-bottom: 0.5rem\n margin-left: -0.5rem\n margin-right: -0.5rem\n padding-left: 0.5rem\n padding-right: 0.5rem\n\n + p\n margin-top: 0\n\nh1\n font-size: 2.5em\n margin-top: 1.75rem\n margin-bottom: 1rem\nh2\n font-size: 2em\n margin-top: 1.75rem\nh3\n font-size: 1.5em\nh4\n font-size: 1.25em\nh5\n font-size: 1.125em\nh6\n font-size: 1em\n\nsmall\n opacity: 75%\n font-size: 80%\n\n// Paragraph\np\n margin-top: 0.5rem\n margin-bottom: 0.75rem\n\n// Horizontal rules\nhr.docutils\n height: 1px\n padding: 0\n margin: 2rem 0\n background-color: var(--color-background-border)\n border: 0\n\n.centered\n text-align: center\n\n// Links\na\n text-decoration: underline\n\n color: var(--color-link)\n text-decoration-color: var(--color-link-underline)\n\n &:hover\n color: var(--color-link--hover)\n text-decoration-color: var(--color-link-underline--hover)\n &.muted-link\n color: inherit\n &:hover\n color: var(--color-link)\n text-decoration-color: var(--color-link-underline--hover)\n","// This file contains the styles for the overall layouting of the documentation\n// skeleton, including the responsive changes as well as sidebar toggles.\n//\n// This is implemented as a mobile-last design, which isn't ideal, but it is\n// reasonably good-enough and I got pretty tired by the time I'd finished this\n// to move the rules around to fix this. Shouldn't take more than 3-4 hours,\n// if you know what you're doing tho.\n\n// HACK: Not all browsers account for the scrollbar width in media queries.\n// This results in horizontal scrollbars in the breakpoint where we go\n// from displaying everything to hiding the ToC. We accomodate for this by\n// adding a bit of padding to the TOC drawer, disabling the horizontal\n// scrollbar and allowing the scrollbars to cover the padding.\n// https://www.456bereastreet.com/archive/201301/media_query_width_and_vertical_scrollbars/\n\n// HACK: Always having the scrollbar visible, prevents certain browsers from\n// causing the content to stutter horizontally between taller-than-viewport and\n// not-taller-than-viewport pages.\n\nhtml\n overflow-x: hidden\n overflow-y: scroll\n scroll-behavior: smooth\n\n.sidebar-scroll, .toc-scroll, article[role=main] *\n // Override Firefox scrollbar style\n scrollbar-width: thin\n scrollbar-color: var(--color-foreground-border) transparent\n\n // Override Chrome scrollbar styles\n &::-webkit-scrollbar\n width: 0.25rem\n height: 0.25rem\n &::-webkit-scrollbar-thumb\n background-color: var(--color-foreground-border)\n border-radius: 0.125rem\n\n//\n// Overalls\n//\nhtml,\nbody\n height: 100%\n color: var(--color-foreground-primary)\n background: var(--color-background-primary)\n\narticle\n color: var(--color-content-foreground)\n background: var(--color-content-background)\n overflow-wrap: break-word\n\n.page\n display: flex\n // fill the viewport for pages with little content.\n min-height: 100%\n\n.mobile-header\n width: 100%\n height: var(--header-height)\n background-color: var(--color-header-background)\n color: var(--color-header-text)\n border-bottom: 1px solid var(--color-header-border)\n\n // Looks like sub-script/super-script have this, and we need this to\n // be \"on top\" of those.\n z-index: 10\n\n // We don't show the header on large screens.\n display: none\n\n // Add shadow when scrolled\n &.scrolled\n border-bottom: none\n box-shadow: 0 0 0.2rem rgba(0, 0, 0, 0.1), 0 0.2rem 0.4rem rgba(0, 0, 0, 0.2)\n\n .header-center\n a\n color: var(--color-header-text)\n text-decoration: none\n\n.main\n display: flex\n flex: 1\n\n// Sidebar (left) also covers the entire left portion of screen.\n.sidebar-drawer\n box-sizing: border-box\n\n border-right: 1px solid var(--color-sidebar-background-border)\n background: var(--color-sidebar-background)\n\n display: flex\n justify-content: flex-end\n // These next two lines took me two days to figure out.\n width: calc((100% - #{$full-width}) / 2 + #{$sidebar-width})\n min-width: $sidebar-width\n\n// Scroll-along sidebars\n.sidebar-container,\n.toc-drawer\n box-sizing: border-box\n width: $sidebar-width\n\n.toc-drawer\n background: var(--color-toc-background)\n // See HACK described on top of this document\n padding-right: 1rem\n\n.sidebar-sticky,\n.toc-sticky\n position: sticky\n top: 0\n height: min(100%, 100vh)\n height: 100vh\n\n display: flex\n flex-direction: column\n\n.sidebar-scroll,\n.toc-scroll\n flex-grow: 1\n flex-shrink: 1\n\n overflow: auto\n scroll-behavior: smooth\n\n// Central items.\n.content\n padding: 0 $content-padding\n width: $content-width\n\n display: flex\n flex-direction: column\n justify-content: space-between\n\n.icon\n display: inline-block\n height: 1rem\n width: 1rem\n svg\n width: 100%\n height: 100%\n\n//\n// Accommodate announcement banner\n//\n.announcement\n background-color: var(--color-announcement-background)\n color: var(--color-announcement-text)\n\n height: var(--header-height)\n display: flex\n align-items: center\n overflow-x: auto\n & + .page\n min-height: calc(100% - var(--header-height))\n\n.announcement-content\n box-sizing: border-box\n padding: 0.5rem\n min-width: 100%\n white-space: nowrap\n text-align: center\n\n a\n color: var(--color-announcement-text)\n text-decoration-color: var(--color-announcement-text)\n\n &:hover\n color: var(--color-announcement-text)\n text-decoration-color: var(--color-link--hover)\n\n////////////////////////////////////////////////////////////////////////////////\n// Toggles for theme\n////////////////////////////////////////////////////////////////////////////////\n.no-js .theme-toggle-container // don't show theme toggle if there's no JS\n display: none\n\n.theme-toggle-container\n vertical-align: middle\n\n.theme-toggle\n cursor: pointer\n border: none\n padding: 0\n background: transparent\n\n.theme-toggle svg\n vertical-align: middle\n height: 1rem\n width: 1rem\n color: var(--color-foreground-primary)\n display: none\n\n.theme-toggle-header\n float: left\n padding: 1rem 0.5rem\n\n////////////////////////////////////////////////////////////////////////////////\n// Toggles for elements\n////////////////////////////////////////////////////////////////////////////////\n.toc-overlay-icon, .nav-overlay-icon\n display: none\n cursor: pointer\n\n .icon\n color: var(--color-foreground-secondary)\n height: 1rem\n width: 1rem\n\n.toc-header-icon, .nav-overlay-icon\n // for when we set display: flex\n justify-content: center\n align-items: center\n\n.toc-content-icon\n height: 1.5rem\n width: 1.5rem\n\n.content-icon-container\n float: right\n display: flex\n margin-top: 1.5rem\n margin-left: 1rem\n margin-bottom: 1rem\n gap: 0.5rem\n\n .edit-this-page svg\n color: inherit\n height: 1rem\n width: 1rem\n\n.sidebar-toggle\n position: absolute\n display: none\n// \n.sidebar-toggle[name=\"__toc\"]\n left: 20px\n.sidebar-toggle:checked\n left: 40px\n// \n\n.overlay\n position: fixed\n top: 0\n width: 0\n height: 0\n\n transition: width 0ms, height 0ms, opacity 250ms ease-out\n\n opacity: 0\n background-color: rgba(0, 0, 0, 0.54)\n.sidebar-overlay\n z-index: 20\n.toc-overlay\n z-index: 40\n\n// Keep things on top and smooth.\n.sidebar-drawer\n z-index: 30\n transition: left 250ms ease-in-out\n.toc-drawer\n z-index: 50\n transition: right 250ms ease-in-out\n\n// Show the Sidebar\n#__navigation:checked\n & ~ .sidebar-overlay\n width: 100%\n height: 100%\n opacity: 1\n & ~ .page\n .sidebar-drawer\n top: 0\n left: 0\n // Show the toc sidebar\n#__toc:checked\n & ~ .toc-overlay\n width: 100%\n height: 100%\n opacity: 1\n & ~ .page\n .toc-drawer\n top: 0\n right: 0\n\n////////////////////////////////////////////////////////////////////////////////\n// Back to top\n////////////////////////////////////////////////////////////////////////////////\n.back-to-top\n text-decoration: none\n\n display: none\n position: fixed\n left: 0\n top: 1rem\n padding: 0.5rem\n padding-right: 0.75rem\n border-radius: 1rem\n font-size: 0.8125rem\n\n background: var(--color-background-primary)\n box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.05), #6b728080 0px 0px 1px 0px\n\n z-index: 10\n\n margin-left: 50%\n transform: translateX(-50%)\n svg\n height: 1rem\n width: 1rem\n fill: currentColor\n display: inline-block\n\n span\n margin-left: 0.25rem\n\n .show-back-to-top &\n display: flex\n align-items: center\n\n////////////////////////////////////////////////////////////////////////////////\n// Responsive layouting\n////////////////////////////////////////////////////////////////////////////////\n// Make things a bit bigger on bigger screens.\n@media (min-width: $full-width + $sidebar-width)\n html\n font-size: 110%\n\n@media (max-width: $full-width)\n // Collapse \"toc\" into the icon.\n .toc-content-icon\n display: flex\n .toc-drawer\n position: fixed\n height: 100vh\n top: 0\n right: -$sidebar-width\n border-left: 1px solid var(--color-background-muted)\n .toc-tree\n border-left: none\n font-size: var(--toc-font-size--mobile)\n\n // Accomodate for a changed content width.\n .sidebar-drawer\n width: calc((100% - #{$full-width - $sidebar-width}) / 2 + #{$sidebar-width})\n\n@media (max-width: $full-width - $sidebar-width)\n // Collapse \"navigation\".\n .nav-overlay-icon\n display: flex\n .sidebar-drawer\n position: fixed\n height: 100vh\n width: $sidebar-width\n\n top: 0\n left: -$sidebar-width\n\n // Swap which icon is visible.\n .toc-header-icon\n display: flex\n .toc-content-icon, .theme-toggle-content\n display: none\n .theme-toggle-header\n display: block\n\n // Show the header.\n .mobile-header\n position: sticky\n top: 0\n display: flex\n justify-content: space-between\n align-items: center\n\n .header-left,\n .header-right\n display: flex\n height: var(--header-height)\n padding: 0 var(--header-padding)\n label\n height: 100%\n width: 100%\n user-select: none\n\n .nav-overlay-icon .icon,\n .theme-toggle svg\n height: 1.25rem\n width: 1.25rem\n\n // Add a scroll margin for the content\n :target\n scroll-margin-top: var(--header-height)\n\n // Show back-to-top below the header\n .back-to-top\n top: calc(var(--header-height) + 0.5rem)\n\n // Center the page, and accommodate for the header.\n .page\n flex-direction: column\n justify-content: center\n .content\n margin-left: auto\n margin-right: auto\n\n@media (max-width: $content-width + 2* $content-padding)\n // Content should respect window limits.\n .content\n width: 100%\n overflow-x: auto\n\n@media (max-width: $content-width)\n .content\n padding: 0 $content-padding--small\n // Don't float sidebars to the right.\n article aside.sidebar\n float: none\n width: 100%\n margin: 1rem 0\n","//\n// The design here is strongly inspired by mkdocs-material.\n.admonition, .topic\n margin: 1rem auto\n padding: 0 0.5rem 0.5rem 0.5rem\n\n background: var(--color-admonition-background)\n\n border-radius: 0.2rem\n box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.05), 0 0 0.0625rem rgba(0, 0, 0, 0.1)\n\n font-size: var(--admonition-font-size)\n\n overflow: hidden\n page-break-inside: avoid\n\n // First element should have no margin, since the title has it.\n > :nth-child(2)\n margin-top: 0\n\n // Last item should have no margin, since we'll control that w/ padding\n > :last-child\n margin-bottom: 0\n\n.admonition p.admonition-title,\np.topic-title\n position: relative\n margin: 0 -0.5rem 0.5rem\n padding-left: 2rem\n padding-right: .5rem\n padding-top: .4rem\n padding-bottom: .4rem\n\n font-weight: 500\n font-size: var(--admonition-title-font-size)\n line-height: 1.3\n\n // Our fancy icon\n &::before\n content: \"\"\n position: absolute\n left: 0.5rem\n width: 1rem\n height: 1rem\n\n// Default styles\np.admonition-title\n background-color: var(--color-admonition-title-background)\n &::before\n background-color: var(--color-admonition-title)\n mask-image: var(--icon-admonition-default)\n mask-repeat: no-repeat\n\np.topic-title\n background-color: var(--color-topic-title-background)\n &::before\n background-color: var(--color-topic-title)\n mask-image: var(--icon-topic-default)\n mask-repeat: no-repeat\n\n//\n// Variants\n//\n.admonition\n border-left: 0.2rem solid var(--color-admonition-title)\n\n @each $type, $value in $admonitions\n &.#{$type}\n border-left-color: var(--color-admonition-title--#{$type})\n > .admonition-title\n background-color: var(--color-admonition-title-background--#{$type})\n &::before\n background-color: var(--color-admonition-title--#{$type})\n mask-image: var(--icon-#{nth($value, 2)})\n\n.admonition-todo > .admonition-title\n text-transform: uppercase\n","// This file stylizes the API documentation (stuff generated by autodoc). It's\n// deeply nested due to how autodoc structures the HTML without enough classes\n// to select the relevant items.\n\n// API docs!\ndl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple)\n // Tweak the spacing of all the things!\n dd\n margin-left: 2rem\n > :first-child\n margin-top: 0.125rem\n > :last-child\n margin-bottom: 0.75rem\n\n // This is used for the arguments\n .field-list\n margin-bottom: 0.75rem\n\n // \"Headings\" (like \"Parameters\" and \"Return\")\n > dt\n text-transform: uppercase\n font-size: var(--font-size--small)\n\n dd:empty\n margin-bottom: 0.5rem\n dd > ul\n margin-left: -1.2rem\n > li\n > p:nth-child(2)\n margin-top: 0\n // When the last-empty-paragraph follows a paragraph, it doesn't need\n // to augument the existing spacing.\n > p + p:last-child:empty\n margin-top: 0\n margin-bottom: 0\n\n // Colorize the elements\n > dt\n color: var(--color-api-overall)\n\n.sig:not(.sig-inline)\n font-weight: bold\n\n font-size: var(--api-font-size)\n font-family: var(--font-stack--monospace)\n\n margin-left: -0.25rem\n margin-right: -0.25rem\n padding-top: 0.25rem\n padding-bottom: 0.25rem\n padding-right: 0.5rem\n\n // These are intentionally em, to properly match the font size.\n padding-left: 3em\n text-indent: -2.5em\n\n border-radius: 0.25rem\n\n background: var(--color-api-background)\n transition: background 100ms ease-out\n\n &:hover\n background: var(--color-api-background-hover)\n\n // adjust the size of the [source] link on the right.\n a.reference\n .viewcode-link\n font-weight: normal\n width: 3.5rem\n\nem.property\n font-style: normal\n &:first-child\n color: var(--color-api-keyword)\n.sig-name\n color: var(--color-api-name)\n.sig-prename\n font-weight: normal\n color: var(--color-api-pre-name)\n.sig-paren\n color: var(--color-api-paren)\n.sig-param\n font-style: normal\n\n.versionmodified\n font-style: italic\ndiv.versionadded, div.versionchanged, div.deprecated\n p\n margin-top: 0.125rem\n margin-bottom: 0.125rem\n\n// Align the [docs] and [source] to the right.\n.viewcode-link, .viewcode-back\n float: right\n text-align: right\n",".line-block\n margin-top: 0.5rem\n margin-bottom: 0.75rem\n .line-block\n margin-top: 0rem\n margin-bottom: 0rem\n padding-left: 1rem\n","// Captions\narticle p.caption,\ntable > caption,\n.code-block-caption\n font-size: var(--font-size--small)\n text-align: center\n\n// Caption above a TOCTree\n.toctree-wrapper.compound\n .caption, :not(.caption) > .caption-text\n font-size: var(--font-size--small)\n text-transform: uppercase\n\n text-align: initial\n margin-bottom: 0\n\n > ul\n margin-top: 0\n margin-bottom: 0\n","// Inline code\ncode.literal, .sig-inline\n background: var(--color-inline-code-background)\n border-radius: 0.2em\n // Make the font smaller, and use padding to recover.\n font-size: var(--font-size--small--2)\n padding: 0.1em 0.2em\n\n pre.literal-block &\n font-size: inherit\n padding: 0\n\n p &\n border: 1px solid var(--color-background-border)\n\n.sig-inline\n font-family: var(--font-stack--monospace)\n\n// Code and Literal Blocks\n$code-spacing-vertical: 0.625rem\n$code-spacing-horizontal: 0.875rem\n\n// Wraps every literal block + line numbers.\ndiv[class*=\" highlight-\"],\ndiv[class^=\"highlight-\"]\n margin: 1em 0\n display: flex\n\n .table-wrapper\n margin: 0\n padding: 0\n\npre\n margin: 0\n padding: 0\n overflow: auto\n\n // Needed to have more specificity than pygments' \"pre\" selector. :(\n article[role=\"main\"] .highlight &\n line-height: 1.5\n\n &.literal-block,\n .highlight &\n font-size: var(--code-font-size)\n padding: $code-spacing-vertical $code-spacing-horizontal\n\n // Make it look like all the other blocks.\n &.literal-block\n margin-top: 1rem\n margin-bottom: 1rem\n\n border-radius: 0.2rem\n background-color: var(--color-code-background)\n color: var(--color-code-foreground)\n\n// All code is always contained in this.\n.highlight\n width: 100%\n border-radius: 0.2rem\n\n // Make line numbers and prompts un-selectable.\n .gp, span.linenos\n user-select: none\n pointer-events: none\n\n // Expand the line-highlighting.\n .hll\n display: block\n margin-left: -$code-spacing-horizontal\n margin-right: -$code-spacing-horizontal\n padding-left: $code-spacing-horizontal\n padding-right: $code-spacing-horizontal\n\n/* Make code block captions be nicely integrated */\n.code-block-caption\n display: flex\n padding: $code-spacing-vertical $code-spacing-horizontal\n\n border-radius: 0.25rem\n border-bottom-left-radius: 0\n border-bottom-right-radius: 0\n font-weight: 300\n border-bottom: 1px solid\n\n background-color: var(--color-code-background)\n color: var(--color-code-foreground)\n border-color: var(--color-background-border)\n\n + div[class]\n margin-top: 0\n pre\n border-top-left-radius: 0\n border-top-right-radius: 0\n\n// When `html_codeblock_linenos_style` is table.\n.highlighttable\n width: 100%\n display: block\n tbody\n display: block\n\n tr\n display: flex\n\n // Line numbers\n td.linenos\n background-color: var(--color-code-background)\n color: var(--color-code-foreground)\n padding: $code-spacing-vertical $code-spacing-horizontal\n padding-right: 0\n border-top-left-radius: 0.2rem\n border-bottom-left-radius: 0.2rem\n\n .linenodiv\n padding-right: $code-spacing-horizontal\n font-size: var(--code-font-size)\n box-shadow: -0.0625rem 0 var(--color-foreground-border) inset\n\n // Actual code\n td.code\n padding: 0\n display: block\n flex: 1\n overflow: hidden\n\n .highlight\n border-top-left-radius: 0\n border-bottom-left-radius: 0\n\n// When `html_codeblock_linenos_style` is inline.\n.highlight\n span.linenos\n display: inline-block\n padding-left: 0\n padding-right: $code-spacing-horizontal\n margin-right: $code-spacing-horizontal\n box-shadow: -0.0625rem 0 var(--color-foreground-border) inset\n","// Inline Footnote Reference\n.footnote-reference\n font-size: var(--font-size--small--4)\n vertical-align: super\n\n// Definition list, listing the content of each note.\n// docutils <= 0.17\ndl.footnote.brackets\n font-size: var(--font-size--small)\n color: var(--color-foreground-secondary)\n\n display: grid\n grid-template-columns: max-content auto\n dt\n margin: 0\n > .fn-backref\n margin-left: 0.25rem\n\n &:after\n content: \":\"\n\n .brackets\n &:before\n content: \"[\"\n &:after\n content: \"]\"\n\n dd\n margin: 0\n padding: 0 1rem\n\n// docutils >= 0.18\naside.footnote\n font-size: var(--font-size--small)\n color: var(--color-foreground-secondary)\n\naside.footnote > span,\ndiv.citation > span\n float: left\n font-weight: 500\n padding-right: 0.25rem\n\naside.footnote > p,\ndiv.citation > p\n margin-left: 2rem\n","//\n// Figures\n//\nimg\n box-sizing: border-box\n max-width: 100%\n height: auto\n\narticle\n figure, .figure\n border-radius: 0.2rem\n\n margin: 0\n :last-child\n margin-bottom: 0\n\n .align-left\n float: left\n clear: left\n margin: 0 1rem 1rem\n\n .align-right\n float: right\n clear: right\n margin: 0 1rem 1rem\n\n .align-default,\n .align-center\n display: block\n text-align: center\n margin-left: auto\n margin-right: auto\n\n // WELL, table needs to be stylised like a table.\n table.align-default\n display: table\n text-align: initial\n",".genindex-jumpbox, .domainindex-jumpbox\n border-top: 1px solid var(--color-background-border)\n border-bottom: 1px solid var(--color-background-border)\n padding: 0.25rem\n\n.genindex-section, .domainindex-section\n h2\n margin-top: 0.75rem\n margin-bottom: 0.5rem\n ul\n margin-top: 0\n margin-bottom: 0\n","ul,\nol\n padding-left: 1.2rem\n\n // Space lists out like paragraphs\n margin-top: 1rem\n margin-bottom: 1rem\n // reduce margins within li.\n li\n > p:first-child\n margin-top: 0.25rem\n margin-bottom: 0.25rem\n\n > p:last-child\n margin-top: 0.25rem\n\n > ul,\n > ol\n margin-top: 0.5rem\n margin-bottom: 0.5rem\n\nol\n &.arabic\n list-style: decimal\n &.loweralpha\n list-style: lower-alpha\n &.upperalpha\n list-style: upper-alpha\n &.lowerroman\n list-style: lower-roman\n &.upperroman\n list-style: upper-roman\n\n// Don't space lists out when they're \"simple\" or in a `.. toctree::`\n.simple,\n.toctree-wrapper\n li\n > ul,\n > ol\n margin-top: 0\n margin-bottom: 0\n\n// Definition Lists\n.field-list,\n.option-list,\ndl:not([class]),\ndl.simple,\ndl.footnote,\ndl.glossary\n dt\n font-weight: 500\n margin-top: 0.25rem\n + dt\n margin-top: 0\n\n .classifier::before\n content: \":\"\n margin-left: 0.2rem\n margin-right: 0.2rem\n\n dd\n > p:first-child,\n ul\n margin-top: 0.125rem\n\n ul\n margin-bottom: 0.125rem\n",".math-wrapper\n width: 100%\n overflow-x: auto\n\ndiv.math\n position: relative\n text-align: center\n\n .headerlink,\n &:focus .headerlink\n display: none\n\n &:hover .headerlink\n display: inline-block\n\n span.eqno\n position: absolute\n right: 0.5rem\n top: 50%\n transform: translate(0, -50%)\n z-index: 1\n","// Abbreviations\nabbr[title]\n cursor: help\n\n// \"Problematic\" content, as identified by Sphinx\n.problematic\n color: var(--color-problematic)\n\n// Keyboard / Mouse \"instructions\"\nkbd:not(.compound)\n margin: 0 0.2rem\n padding: 0 0.2rem\n border-radius: 0.2rem\n border: 1px solid var(--color-foreground-border)\n color: var(--color-foreground-primary)\n vertical-align: text-bottom\n\n font-size: var(--font-size--small--3)\n display: inline-block\n\n box-shadow: 0 0.0625rem 0 rgba(0, 0, 0, 0.2), inset 0 0 0 0.125rem var(--color-background-primary)\n\n background-color: var(--color-background-secondary)\n\n// Blockquote\nblockquote\n border-left: 4px solid var(--color-background-border)\n background: var(--color-background-secondary)\n\n margin-left: 0\n margin-right: 0\n padding: 0.5rem 1rem\n\n .attribution\n font-weight: 600\n text-align: right\n\n &.pull-quote,\n &.highlights\n font-size: 1.25em\n\n &.epigraph,\n &.pull-quote\n border-left-width: 0\n border-radius: 0.5rem\n\n &.highlights\n border-left-width: 0\n background: transparent\n\n// Center align embedded-in-text images\np .reference img\n vertical-align: middle\n","p.rubric\n line-height: 1.25\n font-weight: bold\n font-size: 1.125em\n\n // For Numpy-style documentation that's got rubrics within it.\n // https://github.com/pradyunsg/furo/discussions/505\n dd &\n line-height: inherit\n font-weight: inherit\n\n font-size: var(--font-size--small)\n text-transform: uppercase\n","article .sidebar\n float: right\n clear: right\n width: 30%\n\n margin-left: 1rem\n margin-right: 0\n\n border-radius: 0.2rem\n background-color: var(--color-background-secondary)\n border: var(--color-background-border) 1px solid\n\n > *\n padding-left: 1rem\n padding-right: 1rem\n\n > ul, > ol // lists need additional padding, because bullets.\n padding-left: 2.2rem\n\n .sidebar-title\n margin: 0\n padding: 0.5rem 1rem\n border-bottom: var(--color-background-border) 1px solid\n\n font-weight: 500\n\n// TODO: subtitle\n// TODO: dedicated variables?\n",".table-wrapper\n width: 100%\n overflow-x: auto\n margin-top: 1rem\n margin-bottom: 0.5rem\n padding: 0.2rem 0.2rem 0.75rem\n\ntable.docutils\n border-radius: 0.2rem\n border-spacing: 0\n border-collapse: collapse\n\n box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.05), 0 0 0.0625rem rgba(0, 0, 0, 0.1)\n\n th\n background: var(--color-table-header-background)\n\n td,\n th\n // Space things out properly\n padding: 0 0.25rem\n\n // Get the borders looking just-right.\n border-left: 1px solid var(--color-table-border)\n border-right: 1px solid var(--color-table-border)\n border-bottom: 1px solid var(--color-table-border)\n\n p\n margin: 0.25rem\n\n &:first-child\n border-left: none\n &:last-child\n border-right: none\n\n // MyST-parser tables set these classes for control of column alignment\n &.text-left\n text-align: left\n &.text-right\n text-align: right\n &.text-center\n text-align: center\n",":target\n scroll-margin-top: 0.5rem\n\n@media (max-width: $full-width - $sidebar-width)\n :target\n scroll-margin-top: calc(0.5rem + var(--header-height))\n\n // When a heading is selected\n section > span:target\n scroll-margin-top: calc(0.8rem + var(--header-height))\n\n// Permalinks\n.headerlink\n font-weight: 100\n user-select: none\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\ndl dt,\np.caption,\nfigcaption p,\ntable > caption,\n.code-block-caption\n > .headerlink\n margin-left: 0.5rem\n visibility: hidden\n &:hover > .headerlink\n visibility: visible\n\n // Don't change to link-like, if someone adds the contents directive.\n > .toc-backref\n color: inherit\n text-decoration-line: none\n\n// Figure and table captions are special.\nfigure:hover > figcaption > p > .headerlink,\ntable:hover > caption > .headerlink\n visibility: visible\n\n:target >, // Regular section[id] style anchors\nspan:target ~ // Non-regular span[id] style \"extra\" anchors\n h1,\n h2,\n h3,\n h4,\n h5,\n h6\n &:nth-of-type(1)\n background-color: var(--color-highlight-on-target)\n // .headerlink\n // visibility: visible\n code.literal\n background-color: transparent\n\ntable:target > caption,\nfigure:target\n background-color: var(--color-highlight-on-target)\n\n// Inline page contents\n.this-will-duplicate-information-and-it-is-still-useful-here li :target\n background-color: var(--color-highlight-on-target)\n\n// Code block permalinks\n.literal-block-wrapper:target .code-block-caption\n background-color: var(--color-highlight-on-target)\n\n// When a definition list item is selected\n//\n// There isn't really an alternative to !important here, due to the\n// high-specificity of API documentation's selector.\ndt:target\n background-color: var(--color-highlight-on-target) !important\n\n// When a footnote reference is selected\n.footnote > dt:target + dd,\n.footnote-reference:target\n background-color: var(--color-highlight-on-target)\n",".guilabel\n background-color: var(--color-guilabel-background)\n border: 1px solid var(--color-guilabel-border)\n color: var(--color-guilabel-text)\n\n padding: 0 0.3em\n border-radius: 0.5em\n font-size: 0.9em\n","// This file contains the styles used for stylizing the footer that's shown\n// below the content.\n\nfooter\n font-size: var(--font-size--small)\n display: flex\n flex-direction: column\n\n margin-top: 2rem\n\n// Bottom of page information\n.bottom-of-page\n display: flex\n align-items: center\n justify-content: space-between\n\n margin-top: 1rem\n padding-top: 1rem\n padding-bottom: 1rem\n\n color: var(--color-foreground-secondary)\n border-top: 1px solid var(--color-background-border)\n\n line-height: 1.5\n\n @media (max-width: $content-width)\n text-align: center\n flex-direction: column-reverse\n gap: 0.25rem\n\n .left-details\n font-size: var(--font-size--small)\n\n .right-details\n display: flex\n flex-direction: column\n gap: 0.25rem\n text-align: right\n\n .icons\n display: flex\n justify-content: flex-end\n gap: 0.25rem\n font-size: 1rem\n\n a\n text-decoration: none\n\n svg,\n img\n font-size: 1.125rem\n height: 1em\n width: 1em\n\n// Next/Prev page information\n.related-pages\n a\n display: flex\n align-items: center\n\n text-decoration: none\n &:hover .page-info .title\n text-decoration: underline\n color: var(--color-link)\n text-decoration-color: var(--color-link-underline)\n\n svg.furo-related-icon,\n svg.furo-related-icon > use\n flex-shrink: 0\n\n color: var(--color-foreground-border)\n\n width: 0.75rem\n height: 0.75rem\n margin: 0 0.5rem\n\n &.next-page\n max-width: 50%\n\n float: right\n clear: right\n text-align: right\n\n &.prev-page\n max-width: 50%\n\n float: left\n clear: left\n\n svg\n transform: rotate(180deg)\n\n.page-info\n display: flex\n flex-direction: column\n overflow-wrap: anywhere\n\n .next-page &\n align-items: flex-end\n\n .context\n display: flex\n align-items: center\n\n padding-bottom: 0.1rem\n\n color: var(--color-foreground-muted)\n font-size: var(--font-size--small)\n text-decoration: none\n","// This file contains the styles for the contents of the left sidebar, which\n// contains the navigation tree, logo, search etc.\n\n////////////////////////////////////////////////////////////////////////////////\n// Brand on top of the scrollable tree.\n////////////////////////////////////////////////////////////////////////////////\n.sidebar-brand\n display: flex\n flex-direction: column\n flex-shrink: 0\n\n padding: var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal)\n text-decoration: none\n\n.sidebar-brand-text\n color: var(--color-sidebar-brand-text)\n overflow-wrap: break-word\n margin: var(--sidebar-item-spacing-vertical) 0\n font-size: 1.5rem\n\n.sidebar-logo-container\n margin: var(--sidebar-item-spacing-vertical) 0\n\n.sidebar-logo\n margin: 0 auto\n display: block\n max-width: 100%\n\n////////////////////////////////////////////////////////////////////////////////\n// Search\n////////////////////////////////////////////////////////////////////////////////\n.sidebar-search-container\n display: flex\n align-items: center\n margin-top: var(--sidebar-search-space-above)\n\n position: relative\n\n background: var(--color-sidebar-search-background)\n &:hover,\n &:focus-within\n background: var(--color-sidebar-search-background--focus)\n\n &::before\n content: \"\"\n position: absolute\n left: var(--sidebar-item-spacing-horizontal)\n width: var(--sidebar-search-icon-size)\n height: var(--sidebar-search-icon-size)\n\n background-color: var(--color-sidebar-search-icon)\n mask-image: var(--icon-search)\n\n.sidebar-search\n box-sizing: border-box\n\n border: none\n border-top: 1px solid var(--color-sidebar-search-border)\n border-bottom: 1px solid var(--color-sidebar-search-border)\n\n padding-top: var(--sidebar-search-input-spacing-vertical)\n padding-bottom: var(--sidebar-search-input-spacing-vertical)\n padding-right: var(--sidebar-search-input-spacing-horizontal)\n padding-left: calc(var(--sidebar-item-spacing-horizontal) + var(--sidebar-search-input-spacing-horizontal) + var(--sidebar-search-icon-size))\n\n width: 100%\n\n color: var(--color-sidebar-search-foreground)\n background: transparent\n z-index: 10\n\n &:focus\n outline: none\n\n &::placeholder\n font-size: var(--sidebar-search-input-font-size)\n\n//\n// Hide Search Matches link\n//\n#searchbox .highlight-link\n padding: var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal) 0\n margin: 0\n text-align: center\n\n a\n color: var(--color-sidebar-search-icon)\n font-size: var(--font-size--small--2)\n\n////////////////////////////////////////////////////////////////////////////////\n// Structure/Skeleton of the navigation tree (left)\n////////////////////////////////////////////////////////////////////////////////\n.sidebar-tree\n font-size: var(--sidebar-item-font-size)\n margin-top: var(--sidebar-tree-space-above)\n margin-bottom: var(--sidebar-item-spacing-vertical)\n\n ul\n padding: 0\n margin-top: 0\n margin-bottom: 0\n\n display: flex\n flex-direction: column\n\n list-style: none\n\n li\n position: relative\n margin: 0\n\n > ul\n margin-left: var(--sidebar-item-spacing-horizontal)\n\n .icon\n color: var(--color-sidebar-link-text)\n\n .reference\n box-sizing: border-box\n color: var(--color-sidebar-link-text)\n\n // Fill the parent.\n display: inline-block\n line-height: var(--sidebar-item-line-height)\n text-decoration: none\n\n // Don't allow long words to cause wrapping.\n overflow-wrap: anywhere\n\n height: 100%\n width: 100%\n\n padding: var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal)\n\n &:hover\n background: var(--color-sidebar-item-background--hover)\n\n // Add a nice little \"external-link\" arrow here.\n &.external::after\n content: url('data:image/svg+xml, ')\n margin: 0 0.25rem\n vertical-align: middle\n color: var(--color-sidebar-link-text)\n\n // Make the current page reference bold.\n .current-page > .reference\n font-weight: bold\n\n label\n position: absolute\n top: 0\n right: 0\n height: var(--sidebar-item-height)\n width: var(--sidebar-expander-width)\n\n cursor: pointer\n user-select: none\n\n display: flex\n justify-content: center\n align-items: center\n\n .caption, :not(.caption) > .caption-text\n font-size: var(--sidebar-caption-font-size)\n color: var(--color-sidebar-caption-text)\n\n font-weight: bold\n text-transform: uppercase\n\n margin: var(--sidebar-caption-space-above) 0 0 0\n padding: var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal)\n\n // If it has children, add a bit more padding to wrap the content to avoid\n // overlapping with the \n li.has-children\n > .reference\n padding-right: var(--sidebar-expander-width)\n\n // Colorize the top-level list items and icon.\n .toctree-l1\n & > .reference,\n & > label .icon\n color: var(--color-sidebar-link-text--top-level)\n\n // Color changes on hover\n label\n background: var(--color-sidebar-item-expander-background)\n &:hover\n background: var(--color-sidebar-item-expander-background--hover)\n\n .current > .reference\n background: var(--color-sidebar-item-background--current)\n &:hover\n background: var(--color-sidebar-item-background--hover)\n\n.toctree-checkbox\n position: absolute\n display: none\n\n////////////////////////////////////////////////////////////////////////////////\n// Togglable expand/collapse\n////////////////////////////////////////////////////////////////////////////////\n.toctree-checkbox\n ~ ul\n display: none\n\n ~ label .icon svg\n transform: rotate(90deg)\n\n.toctree-checkbox:checked\n ~ ul\n display: block\n\n ~ label .icon svg\n transform: rotate(-90deg)\n","// This file contains the styles for the contents of the right sidebar, which\n// contains the table of contents for the current page.\n.toc-title-container\n padding: var(--toc-title-padding)\n padding-top: var(--toc-spacing-vertical)\n\n.toc-title\n color: var(--color-toc-title-text)\n font-size: var(--toc-title-font-size)\n padding-left: var(--toc-spacing-horizontal)\n text-transform: uppercase\n\n// If the ToC is not present, hide these elements coz they're not relevant.\n.no-toc\n display: none\n\n.toc-tree-container\n padding-bottom: var(--toc-spacing-vertical)\n\n.toc-tree\n font-size: var(--toc-font-size)\n line-height: 1.3\n border-left: 1px solid var(--color-background-border)\n\n padding-left: calc(var(--toc-spacing-horizontal) - var(--toc-item-spacing-horizontal))\n\n // Hide the first \"top level\" bullet.\n > ul > li:first-child\n padding-top: 0\n & > ul\n padding-left: 0\n & > a\n display: none\n\n ul\n list-style-type: none\n margin-top: 0\n margin-bottom: 0\n padding-left: var(--toc-item-spacing-horizontal)\n li\n padding-top: var(--toc-item-spacing-vertical)\n\n &.scroll-current >.reference\n color: var(--color-toc-item-text--active)\n font-weight: bold\n\n .reference\n color: var(--color-toc-item-text)\n text-decoration: none\n overflow-wrap: anywhere\n\n.toc-scroll\n max-height: 100vh\n overflow-y: scroll\n\n// Be very annoying when someone includes the table of contents\n.contents:not(.this-will-duplicate-information-and-it-is-still-useful-here)\n color: var(--color-problematic)\n background: rgba(255, 0, 0, 0.25)\n &::before\n content: \"ERROR: Adding a table of contents in Furo-based documentation is unnecessary, and does not work well with existing styling.Add a 'this-will-duplicate-information-and-it-is-still-useful-here' class, if you want an escape hatch.\"\n","// Shameful hacks, to work around bugs.\n\n// MyST parser doesn't correctly generate classes, to align table contents.\n// https://github.com/executablebooks/MyST-Parser/issues/412\n.text-align\\:left > p\n text-align: left\n\n.text-align\\:center > p\n text-align: center\n\n.text-align\\:right > p\n text-align: right\n"],"names":[],"sourceRoot":""}
\ No newline at end of file
diff --git a/docs/base_client.html b/docs/base_client.html
new file mode 100644
index 0000000..47f5487
--- /dev/null
+++ b/docs/base_client.html
@@ -0,0 +1,300 @@
+
+
+
+
+
+
+
+
+ Base Client - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+
+Base Client
+
+
+class base_client. Client [source]
+Bases: UserClient
+
+
+take_turn ( turn , actions , world , avatar ) [source]
+This is where your AI will decide what to do.
+:param turn: The current turn of the game.
+:param actions: This is the actions object that you will add effort allocations or decrees to.
+:param world: Generic world information
+
+
+
+
+team_name ( ) [source]
+Allows the team to set a team name.
+:return: Your team name
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/base_client_2.html b/docs/base_client_2.html
new file mode 100644
index 0000000..2d1c396
--- /dev/null
+++ b/docs/base_client_2.html
@@ -0,0 +1,300 @@
+
+
+
+
+
+
+
+
+ Base Client 2 - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+
+Base Client 2
+
+
+class base_client_2. Client [source]
+Bases: UserClient
+
+
+take_turn ( turn , actions , world , avatar ) [source]
+This is where your AI will decide what to do.
+:param turn: The current turn of the game.
+:param actions: This is the actions object that you will add effort allocations or decrees to.
+:param world: Generic world information
+
+
+
+
+team_name ( ) [source]
+Allows the team to set a team name.
+:return: Your team name
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/game.client.html b/docs/game.client.html
new file mode 100644
index 0000000..ff6ea60
--- /dev/null
+++ b/docs/game.client.html
@@ -0,0 +1,295 @@
+
+
+
+
+
+
+
+
+ Client Package - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/game.common.html b/docs/game.common.html
new file mode 100644
index 0000000..a25696d
--- /dev/null
+++ b/docs/game.common.html
@@ -0,0 +1,624 @@
+
+
+
+
+
+
+
+
+ Common Package - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+
+Common Package
+
+
+Action Class
+
+
+class game.common.action. Action [source]
+Bases: object
+Action Class:
+
+This class encapsulates the different actions a player can execute while playing the game.
+
NOTE : This is not currently implemented in this version of the Byte Engine. If you want more complex
+actions, you can use this class for Objects instead of the enums.
+
+
+
+
+
+
+Avatar Class
+
+
+class game.common.avatar. Avatar ( position : Vector | None = None , max_inventory_size : int = 10 ) [source]
+Bases: GameObject
+Avatar Inventory Notes:
+
+The avatar’s inventory is a list of items. Each item has a quantity and a stack_size (the max amount of an
+item that can be held in a stack. Think of the Minecraft inventory).
+
This upcoming example is just to facilitate understanding the concept. The Dispensing Station concept that will
+be mentioned is completely optional to implement if you desire. The Dispensing Station is used to help with the
+explanation.
+
+Items: Every Item has a quantity and a stack_size. The quantity is how much of the Item the player currently has.
+The stack_size is the max of that Item that can be in a stack. For example, if the quantity is 5, and the
+stack_size is 5 (5/5), the item cannot be added to that stack
+
+
+
Picking up items:
+
+
+Example 1: When you pick up an item (which will now be referred to as picked_up_item), picked_up_item has a given
+quantity. In this case, let’s say the quantity of picked_up_item is 2.
+Imagine you already have this item in your inventory (which will now be referred to as inventory_item),
+and inventory_item has a quantity of 1 and a stack_size of 10 (think of this as a fraction: 1/10).
+When you pick up picked_up_item, inventory_item will be checked.
+If picked_up_item’s quantity + inventory_item < stack_size, it’ll be added without issue.
+Remember, for this example: picked_up_item quantity is 2, and inventory_item quantity is 1, and
+stack_size is 10.
+
+Inventory_item quantity before picking up: 1/10
+
+
Inventory_item quantity after picking up: 3/10
+
+
+
+
+Example 2: For the next two examples, the total inventory size will be considered.
+Let’s say inventory_item has quantity 4 and a stack_size of 5. Now say that picked_up_item has
+quantity 3.
+Recall: if picked_up_item’s quantity + inventory_item < stack_size, it will be added without issue
+
+Inventory_item quantity before picking up: 4/5
+
+
+What do we do in this situation? If you want to add picked_up_item to inventory_item and there is an
+overflow of quantity, that is handled for you.
+Let’s say that your inventory size (which will now be referred to as max_inventory_size) is 5. You
+already have inventory_item in there that has a quantity of 4 and a stack_size of 5. An image of the
+inventory is below. ‘None’ is used to help show the max_inventory_size. Inventory_item quantity and
+stack_size will be listed in parentheses as a fraction.
+Inventory :
+[
+ inventory_item ( 4 / 5 ),
+ None ,
+ None ,
+ None ,
+ None
+]
+
+
+Now we will add picked_up_item and its quantity of 3:
+Inventory before :
+[
+ inventory_item ( 4 / 5 ),
+ None ,
+ None ,
+ None ,
+ None
+]
+
+3 + 4 < 5 --> False
+
+
+inventory_item (4/5) will now be inventory_item (5/5)
+picked_up_item now has a quantity of 2 instead of 3
+Since we have a surplus, we will append the same item with a quantity of 2 in the inventory.
+The result is :
+[
+ inventory_item ( 5 / 5 ),
+ inventory_item ( 2 / 5 ),
+ None ,
+ None ,
+ None
+]
+
+
+
+
+
Example 3:
+For this last example, assume your inventory looks like this:
+
[
+ inventory_item ( 5 / 5 ),
+ inventory_item ( 5 / 5 ),
+ inventory_item ( 5 / 5 ),
+ inventory_item ( 5 / 5 ),
+ inventory_item ( 4 / 5 )
+]
+
+
+
You can only fit one more inventory_item into the last stack before the inventory is full.
+Let’s say that picked_up_item has quantity of 3 again.
+
Inventory before :
+[
+ inventory_item ( 5 / 5 ),
+ inventory_item ( 5 / 5 ),
+ inventory_item ( 5 / 5 ),
+ inventory_item ( 5 / 5 ),
+ inventory_item ( 4 / 5 )
+]
+
+ 3 + 4 < 5 --> False
+
+
+
inventory_item (4/5) will now be inventory_item (5/5)
+picked_up_item now has a quantity of 2
+However, despite the surplus, we cannot add it into our inventory, so the remaining quantity of
+picked_up_item is left where it was first found.
+
Inventory after :
+[
+ inventory_item ( 5 / 5 ),
+ inventory_item ( 5 / 5 ),
+ inventory_item ( 5 / 5 ),
+ inventory_item ( 5 / 5 ),
+ inventory_item ( 5 / 5 )
+]
+
+
+
+
+
+
+drop_held_item ( ) → Item | None [source]
+Call this method when a station is taking the held item from the avatar.
+This method can be modified more for different scenarios where the held item would be dropped
+(e.g., you make a game where being attacked forces you to drop your held item).
+If you want the held item to go somewhere specifically and not become None, that can be changed too.
+Make sure to keep clean_inventory() in this method.
+
+
+
+
+take ( item : Item | None ) → Item | None [source]
+To use this method, pass in an item object. Whatever this item’s quantity is will be the amount subtracted from
+the avatar’s inventory. For example, if the item in the inventory is has a quantity of 5 and this method is
+called with the parameter having a quantity of 2, the item in the inventory will have a quantity of 3.
+Furthermore, when this method is called and the potential item is taken away, the clean_inventory method is
+called. It will consolidate all similar items together to ensure that the inventory is clean.
+Reference test_avatar_inventory.py and the clean_inventory method for further documentation on this method and
+how the inventory is managed.
+
+Parameters:
+item –
+
+Returns:
+Item or None
+
+
+
+
+
+
+
+
+
+Enums File
+NOTE: The use of the enum structure is to make is easier to execute certain tasks. It also helps with
+identifying types of Objects throughout the project.
+When developing the game, add any extra enums as necessary.
+
+
+class game.common.enums. ActionType ( value , names = None , * , module = None , qualname = None , type = None , start = 1 , boundary = None ) [source]
+Bases: Enum
+
+
+SELECT_SLOT_9 = 20
+These last 10 enums are for selecting a slot from the Avatar class’ inventory.
+You can add/remove these as needed for the purposes of your game.
+
+
+
+
+
+
+class game.common.enums. DebugLevel ( value , names = None , * , module = None , qualname = None , type = None , start = 1 , boundary = None ) [source]
+Bases: Enum
+
+
+
+
+class game.common.enums. ObjectType ( value , names = None , * , module = None , qualname = None , type = None , start = 1 , boundary = None ) [source]
+Bases: Enum
+
+
+
+
+
+GameObject Class
+
+
+class game.common.game_object. GameObject ( ** kwargs ) [source]
+Bases: object
+GameObject Class Notes:
+
+This class is widely used throughout the project to represent different types of Objects that are interacted
+with in the game. If a new class is created and needs to be logged to the JSON files, make sure it inherits
+from GameObject.
+
+
+
+
+
+
+Player Class
+
+
+class game.common.player. Player ( code : object | None = None , team_name : str | None = None , actions : list [ game.common.enums.ActionType ] = [] , avatar : Avatar | None = None ) [source]
+Bases: GameObject
+Player Class Notes:
+
+
+The Player class is what represents the team that’s competing. The player can contain a list of Actions to
+execute each turn. The avatar is what’s used to execute actions (e.g., interacting with stations, picking up
+items, etc.). For more details on the difference between the Player and Avatar classes, refer to the README
+document.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/game.common.items.html b/docs/game.common.items.html
new file mode 100644
index 0000000..87e30bf
--- /dev/null
+++ b/docs/game.common.items.html
@@ -0,0 +1,340 @@
+
+
+
+
+
+
+
+
+ Items Package - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+
+Items Package
+
+Item Class
+
+
+class game.common.items.item. Item ( value : int = 1 , durability : int | None = None , quantity : int = 1 , stack_size : int = 1 ) [source]
+Bases: GameObject
+Item Class Notes:
+
+Items have 4 different attributes: value, durability, quantity, stack-size.
+
+Value: The value of an item can be anything depending on the purpose of the game. For example, if a player can
+sell an item to a shop for monetary value, the value attribute would be used. However, this value may be
+used for anything to better fit the purpose of the game being created.
+
+
+
+Durability: The value of an item’s durability can be either None or an integer.
+If durability is an integer, the stack size must be 1. Think of Minecraft and the mechanics of tools. You
+can only have one sword with a durability (they don’t stack).
+If the durability is equal to None, it represents the item having infinite durability. The item can now be
+stacked with others of the same type. In the case the game being created needs items without durability,
+set this attribute to None to prevent any difficulties.
+
+
+
+Quantity and Stack Size: These two work in tandem. Fractions (x/y) will be used to better explain the concept.
+Quantity simply refers to the amount of the current item the player has. For example, having 5 gold, 10
+gold, or 0 gold all work for representing the quantity.
+The stack_size represents how much of an item can be in a stack. Think of this like the Minecraft inventory
+system. For example, you can have 64 blocks of dirt, and if you were to gain one more, you would have a new
+stack starting at 1.
+In the case of items here, it works with the avatar.py file’s inventory system (refer to those notes on how
+the inventory works in depth). The Minecraft analogy should help understand the concept.
+To better show this, quantity and stack size work like the following fraction model: quantity/stack_size.
+The quantity can never be 0 and must always be a minimum of 1. Furthermore, quantity cannot be greater than
+the stack_size. So 65/64 will not be possible.
+
+
+
+Pick Up Method: When picking up an item, it will first check the item’s ObjectType. If the Object interacted with is not of
+the ObjectType ITEM enum, an error will be thrown.
+Otherwise, the method will check if the picked up item will be able to fit in the inventory. If some of the
+item’s quantity can be picked up and a surplus will be left over, the player will be pick up what they can.
+Then, the same item they picked up will have its quantity modified to be what is left over. That surplus of
+the item is then returned to allow for it to be placed back where it was found on the map.
+If the player can pick up an item without any inventory issues, the entire item and its quantity will be added.
+
+
+
Refer to avatar.py for a more in-depth explanation of how picking up items work with examples.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/game.common.map.html b/docs/game.common.map.html
new file mode 100644
index 0000000..cae7b5c
--- /dev/null
+++ b/docs/game.common.map.html
@@ -0,0 +1,451 @@
+
+
+
+
+
+
+
+
+ Map Package - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+
+Map Package
+
+Gameboard Class
+
+
+class game.common.map.game_board. GameBoard ( seed: int | None = None, map_size: ~game.utils.vector.Vector = <game.utils.vector.Vector object>, locations: dict[slice(tuple[game.utils.vector.Vector], list[game.common.game_object.GameObject], None)] | None = None, walled: bool = False ) [source]
+Bases: GameObject
+GameBoard Class Notes:
+
+Map Size:
+
+map_size is a Vector object, allowing you to specify the size of the (x, y) plane of the game board.
+For example, a Vector object with an ‘x’ of 5 and a ‘y’ of 7 will create a board 5 tiles wide and
+7 tiles long.
+
Example:
+
_ _ _ _ _ y = 0
+| |
+| |
+| |
+| |
+| |
+| |
+_ _ _ _ _ y = 6
+
+
+
+
+
+
+Locations:
+
+This is the bulkiest part of the generation.
+
The locations field is a dictionary with a key of a tuple of Vectors, and the value being a list of
+GameObjects (the key must be a tuple instead of a list because Python requires dictionary keys to be
+immutable).
+
This is used to assign the given GameObjects the given coordinates via the Vectors. This is done in two ways:
+
+Statically: If you want a GameObject to be at a specific coordinate, ensure that the key-value pair is
+ONE Vector and ONE GameObject.
+An example of this would be the following:
+locations = { ( vector_2_4 ) : [ station_0 ] }
+
+
+In this example, vector_2_4 contains the coordinates (2, 4). (Note that this naming convention
+isn’t necessary, but was used to help with the concept). Furthermore, station_0 is the
+GameObject that will be at coordinates (2, 4).
+
+Dynamically: If you want to assign multiple GameObjects to different coordinates, use a key-value
+pair of any length.
+NOTE : The length of the tuple and list MUST be equal, otherwise it will not
+work. In this case, the assignments will be random. An example of this would be the following:
+locations =
+{
+ ( vector_0_0 , vector_1_1 , vector_2_2 ) : [ station_0 , station_1 , station_2 ]
+}
+
+
+(Note that the tuple and list both have a length of 3).
+When this is passed in, the three different vectors containing coordinates (0, 0), (1, 1), or
+(2, 2) will be randomly assigned station_0, station_1, or station_2.
+If station_0 is randomly assigned at (1, 1), station_1 could be at (2, 2), then station_2 will be at (0, 0).
+This is just one case of what could happen.
+
+
+
Lastly, another example will be shown to explain that you can combine both static and
+dynamic assignments in the same dictionary:
+
locations =
+ {
+ ( vector_0_0 ) : [ station_0 ],
+ ( vector_0_1 ) : [ station_1 ],
+ ( vector_1_1 , vector_1_2 , vector_1_3 ) : [ station_2 , station_3 , station_4 ]
+ }
+
+
+
In this example, station_0 will be at vector_0_0 without interference. The same applies to
+station_1 and vector_0_1. However, for vector_1_1, vector_1_2, and vector_1_3, they will randomly
+be assigned station_2, station_3, and station_4.
+
+
+
+
+Walled:
+
+This is simply a bool value that will create a wall barrier on the boundary of the game_board. If
+walled is True, the wall will be created for you.
+
For example, let the dimensions of the map be (5, 7). There will be wall Objects horizontally across
+x = 0 and x = 4. There will also be wall Objects vertically at y = 0 and y = 6
+
Below is a visual example of this, with ‘x’ being where the wall Objects are.
+
Example:
+
x x x x x y = 0
+x x
+x x
+x x
+x x
+x x
+x x x x x y = 6
+
+
+
+
+
+
+
+
+Occupiable Class
+
+
+class game.common.map.occupiable. Occupiable ( occupied_by : GameObject = None , ** kwargs ) [source]
+Bases: GameObject
+Occupiable Class Notes:
+
+Occupiable objects exist to encapsulate all objects that could be placed on the gameboard.
+
These objects can only be occupied by GameObjects, so inheritance is important. The None
value is
+acceptable for this too, showing that nothing is occupying the object.
+
Note: The class Item inherits from GameObject, but it is not allowed to be on an Occupiable object.
+
+
+
+
+
+Tile Class
+
+
+class game.common.map.tile. Tile ( occupied_by : GameObject = None ) [source]
+Bases: Occupiable
+Tile Class Notes:
+
+The Tile class exists to encapsulate all objects that could be placed on the gameboard.
+
Tiles will represent things like the floor in the game. They inherit from Occupiable, which allows for tiles to
+have certain GameObjects and the avatar on it.
+
If the game being developed requires different tiles with special properties, future classes may be added and
+inherit from this class.
+
+
+
+
+
+Wall Class
+
+
+class game.common.map.wall. Wall [source]
+Bases: GameObject
+Wall Class Note:
+
+The Wall class is used for creating objects that border the map. These are impassable.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/game.common.stations.html b/docs/game.common.stations.html
new file mode 100644
index 0000000..372b58d
--- /dev/null
+++ b/docs/game.common.stations.html
@@ -0,0 +1,407 @@
+
+
+
+
+
+
+
+
+ Stations Package - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+
+Stations Package
+
+Occupiable Station Class
+
+
+class game.common.stations.occupiable_station. OccupiableStation ( held_item : Item | None = None , occupied_by : GameObject | None = None ) [source]
+Bases: Occupiable
, Station
+OccupiableStation Class Notes:
+
+Occupiable Station objects inherit from both the Occupiable and Station classes. This allows for other objects to
+be “on top” of the Occupiable Station. For example, an Avatar object can be on top of this object. Since Stations
+can contain items, items can be stored in this object too.
+
Any GameObject or Item can be in an Occupiable Station.
+
Occupiable Station Example is a small file that shows an example of how this class can be
+used. The example class can be deleted or expanded upon if necessary.
+
+
+
+
+
+
+Occupiable Station Example Class
+
+
+class game.common.stations.occupiable_station_example. OccupiableStationExample ( held_item : Item | None = None ) [source]
+Bases: OccupiableStation
+
+
+take_action ( avatar : Avatar ) → Item | None [source]
+In this example of what an occupiable station could do, the avatar picks up the item from this station to
+show the station’s purpose.
+:param avatar:
+:return:
+
+
+
+
+
+
+
+Station Class
+
+
+class game.common.stations.station. Station ( held_item : Item | None = None , ** kwargs ) [source]
+Bases: GameObject
+Station Class Notes:
+
+Station objects inherit from GameObject and can contain Item objects in them.
+
Players can interact with Stations in different ways by using the take_action()
method. Whatever is specified
+in this method will control how players interact with the station. The Avatar and Item classes have methods that
+go through this process. Refer to them for more details.
+
The Occupiable Station Example class demonstrates an avatar object receiving the station’s stored item. The
+Station Receiver Example class demonstrates an avatar depositing its held item into a station. These are simple
+ideas for how stations can be used. These can be heavily added onto for more creative uses!
+
+
+
+
+
+
+Station Example Class
+
+
+class game.common.stations.station_example. StationExample ( held_item : Item | None = None ) [source]
+Bases: Station
+
+
+take_action ( avatar : Avatar ) → Item | None [source]
+In this example of what a station could do, the avatar picks up the item from this station to show the
+station’s purpose.
+:param avatar:
+:return:
+
+
+
+
+
+
+
+Station Receiver Example Class
+
+
+class game.common.stations.station_receiver_example. StationReceiverExample ( held_item : Item | None = None ) [source]
+Bases: Station
+
+
+take_action ( avatar : Avatar ) → None [source]
+In this example of what a type of station could do, the station takes the avatars held item and takes it for
+its own.
+:param avatar:
+:return:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/game.controllers.html b/docs/game.controllers.html
new file mode 100644
index 0000000..a4623e8
--- /dev/null
+++ b/docs/game.controllers.html
@@ -0,0 +1,436 @@
+
+
+
+
+
+
+
+
+ Controllers Package - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+
+Controllers Package
+
+Controller Class
+
+
+class game.controllers.controller. Controller [source]
+Bases: object
+Controller Class Notes:
+
+This is a super class for every controller type that is necessary for inheritance. Think of it as the GameObject
+class for Controllers.
+
The handle_actions method is important and will specify what each controller does when interacting with the
+Player object’s avatar.
+
Refer to the other controller files for a more detailed description on how they work.
+If more controllers are ever needed, add them to facilitate the flow of the game.
+
+
+
+
+
+
+Interact Controller Class
+
+
+class game.controllers.interact_controller. InteractController [source]
+Bases: Controller
+Interact Controller Notes:
+
+The Interact Controller manages the actions the player tries to execute. As the game is played, a player can
+interact with surrounding, adjacent stations and the space they’re currently standing on.
+
Example:
+
x x x x x x
+x x
+x O x
+x O A O x
+x O x
+x x x x x x
+
+
+
The given visual shows what players can interact with. “A” represents the avatar; “O” represents the spaces
+that can be interacted with (including where the “A” is); and “x” represents the walls and map border.
+
These interactions are managed by using the provided ActionType enums in the enums.py file.
+
+
+
+handle_actions ( action : ActionType , client : Player , world : GameBoard ) → None [source]
+Given the ActionType for interacting in a direction, the Player’s avatar will engage with the object.
+:param action:
+:param client:
+:param world:
+:return: None
+
+
+
+
+
+
+
+Inventory Controller Class
+
+
+class game.controllers.inventory_controller. InventoryController [source]
+Bases: Controller
+Interact Controller Notes:
+
+The Inventory Controller is how player’s can manage and interact with their inventory. When given the enum to
+select an item from a slot in the inventory, that will then become the held item.
+
If an enum is passed in that is not within the range of the inventory size, an error will be thrown.
+
+
+
+
+
+
+Master Controller Class
+
+
+class game.controllers.master_controller. MasterController [source]
+Bases: Controller
+Master Controller Notes:
+
+
+Give Client Objects: Takes a list of Player objects and places each one in the game world.
+
+Game Loop Logic: Increments the turn count as the game plays (look at the engine to see how it’s controlled more).
+
+Interpret Current Turn Data: This accesses the gameboard in the first turn of the game and generates the game’s seed.
+
+Client Turn Arguments: There are lines of code commented out that create Action Objects instead of using the enum. If your project
+needs Actions Objects instead of the enums, comment out the enums and use Objects as necessary.
+
+Turn Logic: This method executes every movement and interact behavior from every client in the game. This is done by
+using every other type of Controller object that was created in the project that needs to be managed
+here (InteractController, MovementController, other game-specific controllers, etc.).
+
+Create Turn Log: This method creates a dictionary that stores the turn, all client objects, and the gameboard’s JSON file to
+be used as the turn log.
+
+Return Final Results: This method creates a dictionary that stores a list of the clients’ JSON files. This represents the final
+results of the game.
+
+
+
+
+
+
+
+
+Movement Controller Class
+
+
+class game.controllers.movement_controller. MovementController [source]
+Bases: Controller
+Movement Controller Notes:
+
+The Movement Controller manages the movement actions the player tries to execute. Players can move up, down,
+left, and right. If the player tries to move into a space that’s impassable, they don’t move.
+
For example, if the player attempts to move into an Occupiable Station (something the player can be on) that is
+occupied by a Wall object (something the player can’t be on), the player doesn’t move; that is, if the player
+tries to move into anything that can’t be occupied by something, they won’t move.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/game.html b/docs/game.html
new file mode 100644
index 0000000..295f03d
--- /dev/null
+++ b/docs/game.html
@@ -0,0 +1,499 @@
+
+
+
+
+
+
+
+
+ Game Package Contents - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+
+Game Package Contents
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/game.test_suite.html b/docs/game.test_suite.html
new file mode 100644
index 0000000..c91511e
--- /dev/null
+++ b/docs/game.test_suite.html
@@ -0,0 +1,435 @@
+
+
+
+
+
+
+
+
+ Test Suite Package - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+
+Test Suite Package
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/game.test_suite.tests.html b/docs/game.test_suite.tests.html
new file mode 100644
index 0000000..e396655
--- /dev/null
+++ b/docs/game.test_suite.tests.html
@@ -0,0 +1,838 @@
+
+
+
+
+
+
+
+
+ Tests Package - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+
+Tests Package
+
+Test Example File
+
+
+class game.test_suite.tests.test_example. TestExample ( methodName = 'runTest' ) [source]
+Bases: TestCase
+Test Example Notes:
+
+This is a mock test class to model tests after.
+The setUp method MUST be in camel-case for every test file. Everything else can be in snake_case as normal.
+
+The command to run tests is: python -m game.test_suite.runner
+
+
+
+
+
+setUp ( ) [source]
+Hook method for setting up the test fixture before exercising it.
+
+
+
+
+
+
+
+Test Avatar Class
+
+
+class game.test_suite.tests.test_avatar. TestAvatar ( methodName = 'runTest' ) [source]
+Bases: TestCase
+Test Avatar Notes:
+
+This class tests the different methods in the Avatar class.
+
+
+
+setUp ( ) → None [source]
+Hook method for setting up the test fixture before exercising it.
+
+
+
+
+
+
+
+Test Avatar Inventory
+
+
+class game.test_suite.tests.test_avatar_inventory. TestAvatarInventory ( methodName = 'runTest' ) [source]
+Bases: TestCase
+Test Avatar Inventory Notes:
+
+This class tests the different methods in the Avatar class related to the inventory system. This is its own
+file since the inventory system has a lot of functionality. Look extensively at the different cases that are
+tested to better understand how it works if there is still confusion.
+
+
+
+setUp ( ) → None [source]
+Hook method for setting up the test fixture before exercising it.
+
+
+
+
+test_take ( ) [source]
+
+Take method test: When this test is performed, it works properly, but because the Item class is used and is very generic, it
+may not seem to be the case. However, it does work in the end. The first item in the inventory has its
+quantity decrease to 2 after the take method is executed. Then, the helper method, clean_inventory,
+consolidates all similar Items with each other. This means that inventory[1] will add its quantity to
+inventory[0], making it have a quantity of 5; inventory[1] now has a quantity of 4 instead of 7. Then,
+inventory[2] will add its quantity to inventory[1], making it have a quantity of 7; inventory[2] now has a
+quantity of 7.
+To recap:
+When the take method is used, it will work properly with more specific Item classes being created to
+consolidate the same Item object types together
+When more subclasses of Item are created, more specific tests can be created if needed.
+
+
+
+
+
+
+
+
+
+Test Gameboard Class
+
+
+class game.test_suite.tests.test_game_board. TestGameBoard ( methodName = 'runTest' ) [source]
+Bases: TestCase
+Test Gameboard Notes:
+
+This class tests the different methods in the Gameboard class. This file is worthwhile to look at to understand
+the GamebBoard class better if there is still confusion on it.
+
This class tests the Gameboard specifically when the map is generated.
+
+
+
+setUp ( ) → None [source]
+Hook method for setting up the test fixture before exercising it.
+
+
+
+
+
+
+
+Test Gameboard (No Generation)
+
+
+class game.test_suite.tests.test_game_board_no_gen. TestGameBoard ( methodName = 'runTest' ) [source]
+Bases: TestCase
+Test Gameboard Without Generation Notes:
+
+This class tests the different methods in the Gameboard class when the map is not generated.
+
+
+
+setUp ( ) → None [source]
+Hook method for setting up the test fixture before exercising it.
+
+
+
+
+
+
+
+Test Initialization File
+
+
+class game.test_suite.tests.test_initialization. TestInitialization ( methodName = 'runTest' ) [source]
+Bases: TestCase
+Test Avatar Notes:
+
+This class tests the instantiation of different Objects within the project. Recall that every new class created
+needs a respective ObjectType enum created for it.
+
+
+
+setUp ( ) → None [source]
+Hook method for setting up the test fixture before exercising it.
+
+
+
+
+
+
+
+Test Interact Controller File
+
+
+class game.test_suite.tests.test_interact_controller. TestInteractController ( methodName = 'runTest' ) [source]
+Bases: TestCase
+Test Avatar Notes:
+
+This class tests the different methods in the InteractController class.
+
+
+
+setUp ( ) → None [source]
+Hook method for setting up the test fixture before exercising it.
+
+
+
+
+
+
+
+Test Inventory Controller Class
+
+
+class game.test_suite.tests.test_inventory_controller. TestInventoryController ( methodName = 'runTest' ) [source]
+Bases: TestCase
+Test Inventory Controller Notes:
+
+This class tests the different methods in the Avatar class’ inventory.
+
+
+
+setUp ( ) → None [source]
+Hook method for setting up the test fixture before exercising it.
+
+
+
+
+
+
+
+Test Item Class
+
+
+class game.test_suite.tests.test_item. TestItem ( methodName = 'runTest' ) [source]
+Bases: TestCase
+Test Item Notes:
+
+This class tests the different methods in the Item class.
+
+
+
+setUp ( ) → None [source]
+Hook method for setting up the test fixture before exercising it.
+
+
+
+
+
+
+
+Test Master Controller Class
+
+
+class game.test_suite.tests.test_master_controller. TestMasterController ( methodName = 'runTest' ) [source]
+Bases: TestCase
+Test Master Controller Notes:
+
+Add tests to this class to tests any new functionality added to the Master Controller.
+
+
+
+setUp ( ) → None [source]
+Hook method for setting up the test fixture before exercising it.
+
+
+
+
+
+
+
+Test Movement Controller Class
+
+
+class game.test_suite.tests.test_movement_controller. TestMovementControllerIfWall ( methodName = 'runTest' ) [source]
+Bases: TestCase
+Test Movement Controller if Wall Notes:
+
+This class tests the Movement Controller specifically for when there are walls – or other impassable
+objects – near the Avatar.
+
+
+
+setUp ( ) → None [source]
+Hook method for setting up the test fixture before exercising it.
+
+
+
+
+
+
+
+Test Movement Controller with Occupiable Stations the Avatar can Occupy
+
+
+class game.test_suite.tests.test_movement_controller_if_occupiable_station_is_occupiable. TestMovementControllerIfOccupiableStationIsOccupiable ( methodName = 'runTest' ) [source]
+Bases: TestCase
+Test Movement Controller if Occupiable Stations are Occupiable Notes:
+
+This class tests the different methods in the Movement Controller class and the Avatar moving onto Occupiable
+Stations so that the Avatar can occupy it.
+
+
+
+setUp ( ) → None [source]
+Hook method for setting up the test fixture before exercising it.
+
+
+
+
+
+
+
+Test Movement Controller with Occupiable Stations
+
+
+class game.test_suite.tests.test_movement_controller_if_occupiable_stations. TestMovementControllerIfOccupiableStations ( methodName = 'runTest' ) [source]
+Bases: TestCase
+Test Movement Controller with Occupiable Stations that are Occupied Notes:
+
+This class tests the different methods in the Movement Controller and that the Avatar can’t move onto an
+Occupiable Station that is occupied by an unoccupiable object (e.g., a Wall or Station object).
+
+
+
+setUp ( ) → None [source]
+Hook method for setting up the test fixture before exercising it.
+
+
+
+
+
+
+
+Test Movement Controller with Stations the Avatar Occupy
+
+
+class game.test_suite.tests.test_movement_controller_if_stations. TestMovementControllerIfStations ( methodName = 'runTest' ) [source]
+Bases: TestCase
+Test Movement Controller with Stations Notes:
+
+This class tests the different methods in the Movement Controller and that the Avatar can’t move onto a Station
+object (an example of an impassable object).
+
+
+
+setUp ( ) → None [source]
+Hook method for setting up the test fixture before exercising it.
+
+
+
+
+
+
+
+Test Movement Controller with Walls
+
+
+class game.test_suite.tests.test_movement_controller_if_wall. TestMovementControllerIfWall ( methodName = 'runTest' ) [source]
+Bases: TestCase
+Test Movement Controller with Stations Notes:
+
+This class tests the different methods in the Movement Controller and that the Avatar can’t pass Wall objects.
+
+
+
+setUp ( ) → None [source]
+Hook method for setting up the test fixture before exercising it.
+
+
+
+
+
+
+
+Test Occupiable Station Class
+
+
+class game.test_suite.tests.test_occupiable_station. TestOccupiableStation ( methodName = 'runTest' ) [source]
+Bases: TestCase
+Test Item Notes:
+
+This class tests the different methods in the OccupiableStation class and ensures the objects that occupy them
+are properly set.
+
+
+
+setUp ( ) → None [source]
+Hook method for setting up the test fixture before exercising it.
+
+
+
+
+
+
+
+Test Player Class
+
+
+class game.test_suite.tests.test_player. TestPlayer ( methodName = 'runTest' ) [source]
+Bases: TestCase
+Test Player Notes:
+
+This class tests the different methods in the Player class.
+
+
+
+setUp ( ) → None [source]
+Hook method for setting up the test fixture before exercising it.
+
+
+
+
+
+
+
+Test Station Class
+
+
+class game.test_suite.tests.test_station. TestStation ( methodName = 'runTest' ) [source]
+Bases: TestCase
+Test Station Example Notes:
+
+This class tests the different methods in the Station Example class. This is used to show how Stations could
+work and how they can be tested.
+
+
+
+setUp ( ) → None [source]
+Hook method for setting up the test fixture before exercising it.
+
+
+
+
+
+
+
+Test Tile Class
+
+
+class game.test_suite.tests.test_tile. TestTile ( methodName = 'runTest' ) [source]
+Bases: TestCase
+Test Tile Notes:
+
+This class tests the different methods in the Tile class.
+
+
+
+setUp ( ) → None [source]
+Hook method for setting up the test fixture before exercising it.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/game.utils.html b/docs/game.utils.html
new file mode 100644
index 0000000..901702b
--- /dev/null
+++ b/docs/game.utils.html
@@ -0,0 +1,467 @@
+
+
+
+
+
+
+
+
+ Utils Package - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+
+Utils Package
+
+Generate Game
+
+
+game.utils.generate_game. generate ( seed : int = 955156504 ) [source]
+This method is what generates the game_map. This method is slow, so be mindful when using it. A seed can be set as
+the parameter; otherwise, a random one will be generated. Then, the method checks to make sure the location for
+storing logs exists. Lastly, the game map is written to the game file.
+:param seed:
+:return: None
+
+
+
+
+
+Helpers
+
+
+game.utils.helpers. write_json_file ( data , filename ) [source]
+This file contain the method write_json_file
. It opens the a file with the given name and writes all the given data
+to the file.
+
+
+
+
+
+Thread
+
+
+class game.utils.thread. CommunicationThread ( func , args = None , variable_type = None ) [source]
+Bases: Thread
+Communication Thread Class Notes:
+
+Communication Threads are bulkier than normal Threads. It also has error catching functionality, but tends
+to be used for single-use, single-variable communication.
+
For example, if a client tries to use malicious code in any methods, a Communication Thread is used to check
+any given parameters and throw an error if the type needed does not match what is given.
+
Communication Threads use a nested class to make the return value of the Communication Thread private. It helps
+to keep things secure. This is now achieved through getter and setter decorators. Since the code here was
+written long ago, the structure is different. For future note, use getter and setter decorators as needed.
+
+
+
+run ( ) [source]
+Method representing the thread’s activity.
+You may override this method in a subclass. The standard run() method
+invokes the callable object passed to the object’s constructor as the
+target argument, if any, with sequential and keyword arguments taken
+from the args and kwargs arguments, respectively.
+
+
+
+
+
+
+class game.utils.thread. Thread ( func , args ) [source]
+Bases: Thread
+
+Thread Class Notes: Threads are how the engine communicates with user clients. These Threads are built to catch errors. If an error
+is caught, it will be logged, but the program will continue to run.
+If multithreading is needed for whatever reason, this class would be used for that.
+
+
+
+
+run ( ) [source]
+Method representing the thread’s activity.
+You may override this method in a subclass. The standard run() method
+invokes the callable object passed to the object’s constructor as the
+target argument, if any, with sequential and keyword arguments taken
+from the args and kwargs arguments, respectively.
+
+
+
+
+
+
+
+Validation
+
+
+game.utils.validation. verify_code ( filename , already_string = False ) [source]
+This file is used to verify a client’s code. It helps to prevent certain attempts at purposefully interfering with the
+code and competition.
+
+
+
+
+
+Vector
+
+
+class game.utils.vector. Vector ( x : int = 0 , y : int = 0 ) [source]
+Bases: GameObject
+Vector Class Notes:
+This class is used universally in the project to handle anything related to coordinates. There are a few useful
+methods here to help in a few situations.
+
+
+Add Vectors Method: This method will take two Vector objects, combine their (x, y) coordinates, and return a new Vector object.
+
+Example: vector_1: (1, 1)
+vector_2: (1, 1)
+Result:
+vector_result: (2, 2)
+
+
+
+
+
+
+Add to Vector method: This method will take a different Vector object and add it to the current Self reference; that is, this method
+belongs to a Vector object and is not static.
+
+Example: self_vector: (0, 0)
+vector_1: (1, 3)
+Result:
+self_vector: (1, 3)
+
+
+
+
+
+
+Add X and Add Y methods: These methods act similarly to the add_vector()
method, but instead of changing both the x and y, these
+methods change their respective variables.
+
+Add X Example: self_vector: (0, 0)
+vector_1: (1, 3)
+Result:
+self_vector: (1, 0)
+
+Add Y Example: self_vector: (0, 0)
+vector_1: (1, 3)
+Result:
+self_vector: (0, 3)
+
+
+
+
+
+
+As Tuple Method: This method returns a tuple of the Vector object in the form of (x, y). This is to help with storing it easily
+or accessing it in an immutable structure.
+
+
+
+
+as_tuple ( ) → Tuple [ int , int ] [source]
+Returns (x: int, y: int)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/genindex.html b/docs/genindex.html
new file mode 100644
index 0000000..f3716bb
--- /dev/null
+++ b/docs/genindex.html
@@ -0,0 +1,954 @@
+
+
+
+
+
+
+ Index - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+ G
+
+
+
+ game.common.action
+
+
+
+ game.common.avatar
+
+
+
+ game.common.enums
+
+
+
+ game.common.game_object
+
+
+
+ game.common.items.item
+
+
+
+ game.common.map.game_board
+
+
+
+ game.common.map.occupiable
+
+
+
+ game.common.map.tile
+
+
+
+ game.common.map.wall
+
+
+
+ game.common.player
+
+
+
+ game.common.stations.occupiable_station
+
+
+
+ game.common.stations.occupiable_station_example
+
+
+
+ game.common.stations.station
+
+
+
+ game.common.stations.station_example
+
+
+
+ game.common.stations.station_receiver_example
+
+
+
+ game.controllers.controller
+
+
+
+ game.controllers.interact_controller
+
+
+
+ game.controllers.inventory_controller
+
+
+
+ game.controllers.master_controller
+
+
+
+ game.controllers.movement_controller
+
+
+
+ game.test_suite.runner
+
+
+
+ game.test_suite.tests.test_avatar
+
+
+
+ game.test_suite.tests.test_avatar_inventory
+
+
+
+
+
+ game.test_suite.tests.test_example
+
+
+
+ game.test_suite.tests.test_game_board
+
+
+
+ game.test_suite.tests.test_game_board_no_gen
+
+
+
+ game.test_suite.tests.test_initialization
+
+
+
+ game.test_suite.tests.test_interact_controller
+
+
+
+ game.test_suite.tests.test_inventory_controller
+
+
+
+ game.test_suite.tests.test_item
+
+
+
+ game.test_suite.tests.test_master_controller
+
+
+
+ game.test_suite.tests.test_movement_controller
+
+
+
+ game.test_suite.tests.test_movement_controller_if_occupiable_station_is_occupiable
+
+
+
+ game.test_suite.tests.test_movement_controller_if_occupiable_stations
+
+
+
+ game.test_suite.tests.test_movement_controller_if_stations
+
+
+
+ game.test_suite.tests.test_movement_controller_if_wall
+
+
+
+ game.test_suite.tests.test_occupiable_station
+
+
+
+ game.test_suite.tests.test_player
+
+
+
+ game.test_suite.tests.test_station
+
+
+
+ game.test_suite.tests.test_tile
+
+
+
+ game.utils.generate_game
+
+
+
+ game.utils.helpers
+
+
+
+ game.utils.thread
+
+
+
+ game.utils.validation
+
+
+
+ game.utils.vector
+
+
+ GameBoard (class in game.common.map.game_board)
+
+ GameObject (class in game.common.game_object)
+
+ generate() (in module game.utils.generate_game)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/index.html b/docs/index.html
new file mode 100644
index 0000000..df95ae4
--- /dev/null
+++ b/docs/index.html
@@ -0,0 +1,895 @@
+
+
+
+
+
+
+
+
+ Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+
+Welcome to NDACM’s Byte Engine Documentation!
+NDSU’s ACM chapter hosts an annual competition called “Byte-le Royale.” This competition was created by Riley Conlin,
+Jordan Goetze, Jacob Baumann, Ajay Brown, and Nick Hilger. It promotes working with others and developing critical
+thinking skills, while challenging competitors under a time limit.
+This project provides the framework for developing games for Byte-le. The README document is attached to this page.
+Refer to that for additional info to what’s here!
+
+README Document
+
+Byte Engine
+Revamped base game engine for use in NDACM Byte-le Royale games.
+Changes made in 2023.
+
+Important Changes
+
+Overall Change
+
+
+Item Class
+
+
+GameBoard Class
+
+GameBoard Seed Parameter
+
+
+Map Size Parameter
+
+
+Locations Parameter
+
+
+Walled Parameter
+
+
+
+
+Occupiable Class
+
+
+Tile Class
+
+
+Wall Class
+
+
+Stations
+
+Station Class
+
+
+Occupiable Station
+
+
+Example Classes
+
+The occupiable_station_example, station_example, and station_receiver_example classes
+are provided to show how their respective files can be used. These can be deleted or used
+as templates on how to expand on their functionality.
+
+
+
+
+Action Class
+
+
+Avatar Class
+
+The Avatar class is newly implemented in this version of the byte-engine and includes
+many new features.
+Position:
+
+
+Inventory:
+
+There is an inventory system implemented in the Avatar class now. You are able to specify
+the max size of it, and there are methods that are used to pick up items, take items from
+other objects, and drop the Avatar’s held item.
+
+
+Held Item:
+
+
+These changes are provided to allow for development to go smoothly. Developers are not obliged
+to use nor keep any of these changes. The inventory system and any other aspect of the class may be
+modified or removed as necessary for game development.
+
+
+Enums File
+
+
+Player Class
+
+
+Avatar VS Player Classes
+
+
+Controllers
+
+Interact Controller Class
+
+
+Inventory Controller Class
+
+
+Master Controller Class
+
+
+Movement Controller Class
+
+
+
+
+Generate Game File
+
+
+Vector Class
+
+The Vector class is used to simplify handling coordinates.
+Some new implementations include ways to increase the values of an already existing Vector,
+adding two Vectors to create a new one, and returning the Vector’s information as
+a tuple.
+
+
+Config File
+
+
+
+
+
+Development Notes
+
+Type Hinting
+
+Type hinting is very useful in Python because it prevents any confusion on
+what type an object is supposed to be, what value a method returns, etc. Make
+sure to type hint any and everything to eliminate any confusion.
+
+
+Planning
+
+When planning, it’s suggested to write out pseudocode, create UMLs, and any
+other documentation that will help with the process. It is easy to forget what
+is discussed between meetings without a plan.
+Write everything that should be implemented,
+what files need to be created, their purpose in the project, and more. UML diagrams
+help see how classes will interact and inherit from each other.
+Lastly, documentation is a great method to stay organized too. Having someone to
+write what is discussed in meetings can be useful; you won’t easily lose track of
+what’s discussed.
+
+
+
+
+
+How to run
+ .\b uild.bat - will build your code ( compile, pretty much)
+
+python .\l auncher.pyz g - will generate a map
+
+python .\l auncher.pyz r - will run the game
+
+
+
+
+Required Python Version
+
+
+
+Test Suite Commands:
+ python -m game.test_suite.runner
+
+
+
+
+Manual
+Usage Manual
+Referenced Examples - https://github.com/topoftheyear/Byte-le-Game-Examples
+
+
+Previous Byte-le Competitions
+2018 - Dungeon Delvers - https://github.com/jghibiki/Byte-le-Royale-2018
+2019 - Space Denizen - https://github.com/topoftheyear/Byte-le-Royale-2019
+2020 - Disaster Dispatcher - https://github.com/PixPanz/byte_le_royale_2020
+2021 - Traveling Trailsmen - https://github.com/PixPanz/byte_le_royale_2021
+2022 - FarTech - https://github.com/HagenSR/byte_le_royale_2022
+2023 - Undercooked - https://github.com/amanda-f-ndsu/byte_le_royale_2023
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/modules.html b/docs/modules.html
new file mode 100644
index 0000000..ad09c31
--- /dev/null
+++ b/docs/modules.html
@@ -0,0 +1,447 @@
+
+
+
+
+
+
+
+
+ byte_le_engine - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/objects.inv b/docs/objects.inv
new file mode 100644
index 0000000..d84be70
Binary files /dev/null and b/docs/objects.inv differ
diff --git a/docs/py-modindex.html b/docs/py-modindex.html
new file mode 100644
index 0000000..67a99a1
--- /dev/null
+++ b/docs/py-modindex.html
@@ -0,0 +1,531 @@
+
+
+
+
+
+
+ Python Module Index - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+
+
+ Python Module Index
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/readme.html b/docs/readme.html
new file mode 100644
index 0000000..c644f49
--- /dev/null
+++ b/docs/readme.html
@@ -0,0 +1,429 @@
+
+
+
+
+
+
+
+
+ README File - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+
+README File
+# Byte Engine
+Revamped base game engine for use in NDACM Byte-le Royale games.
+Changes made in 2023.
+## Important Changes
+
+Overall Change
+* Every file is now type hinted to facilitate the coding process. For future development,
+type hint any changes made for the same reason.
+
+Item Class
+for flexibility.
+
+Value:
+* This allows for an item to have a value of some sort. This can be used to determine
+points gained for collecting the item, or its sell price. The meaning can change depending
+on the project.
+Durability:
+* Durability can represent how many uses an item has. What happens after is determined by
+the development team.
+Quantity:
+* This allows for consolidating and representing multiple items in a single item object.
+Stack Size:
+* Stack Size determines how many item objects can be consolidated together into a single
+object at once. This can be thought of as a denominator in a fraction.
+Reference the Item class for further documentation.
+
+
+
+
+GameBoard Class
+* GameBoard Seed Parameter
+
+
+
a specific seed to be set. This can be used to help with testing during game development.
+
+
+Map Size Parameter
+* This is a Vector object that is not used as a coordinate, but the dimensions of the
+entire game map. Vectors are explained later.
+Locations Parameter
+* This parameter allows for user-defined specifications of where to put certain GameObjects
+on the game map. It is an extensive system used to do this, so refer to the file for
+further documentation.
+Walled Parameter
+* This is a boolean that determines whether to place Wall objects on the border of the game
+map.
+
+
+Occupiable Class
+* A new class was implemented called Occupiable. This class inherits from GameObject and
+allows for other GameObjects to “stack” on top of one another. As long as an object inherits
+this class, it can allow for many objects to be located on the same Tile.
+Tile Class
+* The Tile class inherits from Occupiable, allowing for other GameObjects to stack on top of
+it. A Tile can be used to represent the floor or any other basic object in the game.
+Wall Class
+* The Wall class is a GameObject that represent an impassable object. Use this object to help
+define the borders of the game map.
+Stations
+* Station Class
+
+
+
+Occupiable Station
+* Occupiable Stations represent basic Station objects that can be occupied by another
+GameObject.
+Example Classes
+* The occupiable_station_example, station_example, and station_receiver_example classes
+are provided to show how their respective files can be used. These can be deleted or used
+as templates on how to expand on their functionality.
+
+
+Action Class
+* This is a class to represent the actions a player takes each turn in object form. This is
+not implemented in this version of the engine since enums are primarily used.
+Avatar Class
+* The Avatar class is newly implemented in this version of the byte-engine and includes
+many new features.
+
+Position:
+* The Avatar class has a parameter called “position” which is a Vector object (explained
+later in this document). This simply stores the Avatar’s coordinate on the game map.
+Inventory:
+* There is an inventory system implemented in the Avatar class now. You are able to specify
+the max size of it, and there are methods that are used to pick up items, take items from
+other objects, and drop the Avatar’s held item.
+Held Item:
+* The held item of an Avatar is an item that the Avatar has in their inventory. This is done
+by using enums. Reference the enums.py file for more information.
+These changes are provided to allow for development to go smoothly. Developers are not obliged
+
+to use nor keep any of these changes. The inventory system and any other aspect of the class may be
+modified or removed as necessary for game development.
+
+Enums File
+* This file has every significant object being represented as an enum. There are also enums
+that help with the avatar’s inventory system. Refer to the file for a note on this.
+Player Class
+* The player class now receives a list of ActionType enums to allow for multiple actions
+to happen in one turn. The enum representation can be replaced with the Action object
+if needed.
+Avatar VS Player Classes
+* These two classes are often confused with each other. Here are their differences.
+* Avatar:
+
+
+
what moves around, interacts with other GameObjects, gains points, and whatever else
+the developers implement.
+
+
+
+Controllers
+* Interact Controller Class
+
+
+
+Inventory Controller Class
+* This class controls how players select a certain item in their inventory to then
+become their held item.
+Master Controller Class
+* This controller is used to manage what happens in each turn and update the
+overarching information of the game’s state.
+Movement Controller Class
+* This class manages moving the player through the game board by using the given enums.
+
+
+Generate Game File
+* This file has a single method that’s used to generate the game map. The
+generation is slow, so call the method when needed. Change the initialized
+GameBoard object’s parameters as necessary for the project.
+Vector Class
+* The Vector class is used to simplify handling coordinates.
+Some new implementations include ways to increase the values of an already existing Vector,
+adding two Vectors to create a new one, and returning the Vector’s information as
+a tuple.
+Config File
+* The most notable change in this file is MAX_NUMBER_OF_ACTIONS_PER_TURN. It is used for
+allowing multiple actions to be taken in one turn. Adjust as necessary.
+
+## Development Notes
+
+Type Hinting
+* Type hinting is very useful in Python because it prevents any confusion on
+what type an object is supposed to be, what value a method returns, etc. Make
+sure to type hint any and everything to eliminate any confusion.
+Planning
+* When planning, it’s suggested to write out pseudocode, create UMLs, and any
+other documentation that will help with the process. It is easy to forget what
+is discussed between meetings without a plan.
+* Write everything that should be implemented,
+what files need to be created, their purpose in the project, and more. UML diagrams
+help see how classes will interact and inherit from each other.
+* Lastly, documentation is a great method to stay organized too. Having someone to
+write what is discussed in meetings can be useful; you won’t easily lose track of
+what’s discussed.
+
+## How to run
+`` ` bash
+.build.bat - will build your code (compile, pretty much)
+python .launcher.pyz g - will generate a map
+python .launcher.pyz r - will run the game
+`` `
+## Required Python Version
+
+## Test Suite Commands:
+`bash
+python -m game.test_suite.runner
+`
+## Manual
+[Usage Manual](https://docs.google.com/document/d/1MGxvq5V9yGJbsbcBgDM26LugPbtQGlyNiaUOmjn85sc/edit?usp=sharing )
+Referenced Examples - https://github.com/topoftheyear/Byte-le-Game-Examples
+## Previous Byte-le Competitions
+2018 - Dungeon Delvers - https://github.com/jghibiki/Byte-le-Royale-2018
+2019 - Space Denizen - https://github.com/topoftheyear/Byte-le-Royale-2019
+2020 - Disaster Dispatcher - https://github.com/PixPanz/byte_le_royale_2020
+2021 - Traveling Trailsmen - https://github.com/PixPanz/byte_le_royale_2021
+2022 - FarTech - https://github.com/HagenSR/byte_le_royale_2022
+2023 - Undercooked - https://github.com/amanda-f-ndsu/byte_le_royale_2023
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/search.html b/docs/search.html
new file mode 100644
index 0000000..aaec941
--- /dev/null
+++ b/docs/search.html
@@ -0,0 +1,254 @@
+
+
+
+
+
+
+ Search - Byte Engine 1.0.0 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contents
+
+
+
+
+
+
+ Expand
+
+
+
+
+
+ Light mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dark mode
+
+
+
+
+
+
+ Auto light/dark mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hide table of contents sidebar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to top
+
+
+
+
+ Toggle Light / Dark / Auto color theme
+
+
+
+
+
+
+ Toggle table of contents sidebar
+
+
+
+
+
+
+
+
Error
+
+ Please activate JavaScript to enable the search functionality.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/searchindex.js b/docs/searchindex.js
new file mode 100644
index 0000000..22b8c9c
--- /dev/null
+++ b/docs/searchindex.js
@@ -0,0 +1 @@
+Search.setIndex({"docnames": ["game", "game.common", "game.common.items", "game.common.map", "game.common.stations", "game.controllers", "game.test_suite", "game.test_suite.tests", "game.utils", "index"], "filenames": ["game.rst", "game.common.rst", "game.common.items.rst", "game.common.map.rst", "game.common.stations.rst", "game.controllers.rst", "game.test_suite.rst", "game.test_suite.tests.rst", "game.utils.rst", "index.rst"], "titles": ["Game Package Contents", "Common Package", "Items Package", "Map Package", "Stations Package", "Controllers Package", "Test Suite Package", "Tests Package", "Utils Package", "Welcome to NDACM\u2019s Byte Engine Documentation!"], "terms": {"class": [0, 6, 8, 9], "client": [5, 8], "sourc": [1, 2, 3, 4, 5, 7, 8], "base": [1, 2, 3, 4, 5, 7, 8, 9], "usercli": [], "take_turn": [], "turn": [1, 5, 9], "action": [0, 5, 9], "world": 5, "avatar": [0, 2, 3, 4, 5, 6, 9], "thi": [1, 2, 3, 4, 5, 7, 8, 9], "i": [1, 2, 3, 4, 5, 7, 8, 9], "where": [1, 2, 3, 5, 9], "your": [1, 5, 9], "ai": [], "decid": [], "what": [1, 2, 3, 4, 5, 8, 9], "do": [1, 4, 9], "param": [4, 5, 8], "The": [1, 2, 3, 4, 5, 7, 8, 9], "current": [1, 2, 5, 8], "game": [1, 2, 3, 4, 5, 7, 9], "object": [1, 2, 3, 4, 5, 7, 8, 9], "you": [1, 2, 3, 8, 9], "add": [1, 5, 7, 8], "effort": [], "alloc": [], "decre": [], "gener": [0, 3, 5, 6, 9], "inform": 9, "team_nam": [1, 9], "allow": [2, 3, 4, 9], "team": [1, 9], "set": [2, 7, 8, 9], "name": [1, 3, 8], "return": [1, 2, 4, 5, 8, 9], "user_cli": [], "debug": [], "common": [0, 2, 3, 4, 9], "item": [0, 1, 3, 4, 5, 6, 9], "durabl": [2, 9], "from_json": [], "pick_up": [], "quantiti": [1, 2, 7, 9], "stack_siz": [1, 2], "take": [0, 1, 4, 5, 7, 8, 9], "to_json": [], "valu": [1, 2, 3, 8, 9], "gameboard": [0, 1, 5, 6, 9], "game_map": 8, "generate_ev": [], "generate_map": [], "get_object": [], "locat": [8, 9], "map_siz": 3, "seed": [3, 5, 8, 9], "wall": [0, 1, 5, 6, 9], "occupi": [0, 1, 5, 6, 9], "occupied_bi": [3, 4], "tile": [0, 1, 6, 9], "station": [0, 1, 5, 6, 9], "occupiablest": [0, 1, 4, 7, 9], "exampl": [0, 1, 2, 3, 5, 6, 8, 9], "occupiablestationexampl": [0, 1, 4, 9], "take_act": [0, 1, 4, 9], "held_item": 4, "stationexampl": [0, 1, 4, 9], "receiv": [0, 1, 9], "stationreceiverexampl": [0, 1, 4, 9], "set_act": [], "drop_held_item": [0, 1, 9], "inventori": [0, 1, 2, 6, 9], "max_inventory_s": 1, "posit": [1, 9], "score": [], "enum": [0, 2, 5, 7, 9], "actiontyp": [0, 1, 5, 9], "interact_cent": [], "interact_down": [], "interact_left": [], "interact_right": [], "interact_up": [], "move_down": [], "move_left": [], "move_right": [], "move_up": [], "none": [1, 2, 3, 4, 5, 7, 8], "select_slot_0": [], "select_slot_1": [], "select_slot_2": [], "select_slot_3": [], "select_slot_4": [], "select_slot_5": [], "select_slot_6": [], "select_slot_7": [], "select_slot_8": [], "select_slot_9": [0, 1, 9], "debuglevel": [0, 1, 9], "control": [0, 4, 6, 9], "objecttyp": [0, 1, 2, 7, 9], "occupiable_st": 4, "occupiable_station_exampl": [4, 9], "player": [0, 2, 4, 5, 6, 9], "station_exampl": [4, 9], "station_receiver_exampl": [4, 9], "vector": [0, 1, 3, 9], "gameobject": [0, 2, 3, 4, 5, 8, 9], "obfusc": [], "function": [7, 8, 9], "object_typ": [], "handle_act": [0, 5, 9], "interact_control": 5, "interactcontrol": [0, 5, 7, 9], "inventory_control": 5, "inventorycontrol": [0, 5, 9], "master_control": 5, "mastercontrol": [0, 5, 9], "client_turn_argu": [], "create_turn_log": [], "game_loop_log": [], "give_clients_object": [], "interpret_current_turn_data": [], "return_final_result": [], "turn_log": [], "movement_control": 5, "movementcontrol": [0, 5, 9], "test_suit": [7, 9], "subpackag": [], "test": 0, "test_avatar": 7, "test_avatar_inventori": [1, 7], "test_exampl": 7, "test_game_board": 7, "test_game_board_no_gen": 7, "test_initi": 7, "test_interact_control": 7, "test_inventory_control": 7, "test_item": 7, "test_master_control": 7, "test_movement_control": 7, "test_movement_controller_if_occupiable_station_is_occupi": 7, "test_movement_controller_if_occupiable_st": 7, "test_movement_controller_if_st": 7, "test_movement_controller_if_wal": 7, "test_occupiable_st": 7, "test_play": 7, "test_stat": 7, "test_til": 7, "runner": [0, 7, 9], "util": [0, 3, 9], "generate_gam": 8, "helper": [0, 7, 9], "write_json_fil": [0, 8, 9], "thread": [0, 9], "communicationthread": [0, 8, 9], "retrieve_valu": [], "run": [0, 7, 8], "valid": [0, 9], "verify_cod": [0, 8, 9], "verify_num_cli": [], "add_to_vector": [], "add_vector": 8, "add_x": [], "add_x_i": [], "add_i": [], "as_tupl": [0, 8, 9], "x": [2, 3, 5, 8], "y": [2, 3, 8], "level": [], "1": [1, 2, 3, 7, 8], "quiet_mod": [], "fals": [1, 3, 8], "use_filenames_as_team_nam": [], "boot": [], "load": [], "loop": 5, "post_tick": [], "pre_tick": [], "shutdown": [], "tick": [], "arg": 8, "encapsul": [1, 3, 9], "differ": [1, 2, 3, 4, 7, 8, 9], "can": [0, 1, 2, 3, 4, 5, 6, 8, 9], "execut": [1, 5, 7], "while": [1, 9], "plai": [1, 5], "note": [1, 2, 3, 4, 5, 7, 8], "implement": [1, 9], "version": 1, "byte": 1, "engin": [1, 5, 8], "If": [1, 2, 3, 5, 8], "want": [1, 3], "more": [1, 2, 4, 5, 7, 9], "complex": 1, "us": [1, 2, 3, 4, 5, 7, 8, 9], "instead": [1, 3, 5, 7, 8], "data": [5, 8], "int": [1, 2, 3, 8], "10": [1, 2], "": [1, 2, 4, 5, 8], "list": [1, 3, 5, 9], "each": [1, 5, 7, 9], "ha": [1, 2, 7, 8, 9], "max": [1, 9], "amount": [1, 2], "an": [1, 2, 3, 4, 5, 7, 8, 9], "held": [1, 4, 5, 9], "stack": [1, 2, 9], "think": [1, 2, 5, 9], "minecraft": [1, 2], "upcom": 1, "just": [1, 3], "facilit": [1, 5, 9], "understand": [1, 2, 7], "concept": [1, 2, 3], "dispens": 1, "mention": 1, "complet": 1, "option": 1, "desir": 1, "help": [1, 2, 3, 8, 9], "explan": [1, 2], "everi": [1, 5, 7, 9], "how": [1, 2, 4, 5, 7, 8], "much": [1, 2, 9], "For": [1, 2, 3, 4, 5, 8, 9], "5": [1, 2, 3, 7], "cannot": [1, 2], "ad": [1, 2, 3, 4, 7, 9], "pick": [1, 2, 4, 9], "up": [1, 2, 4, 5, 7, 9], "when": [1, 2, 3, 5, 7, 8, 9], "which": [1, 3, 9], "now": [1, 2, 7, 8, 9], "refer": [1, 2, 4, 5, 8, 9], "picked_up_item": 1, "given": [1, 3, 5, 8, 9], "In": [1, 2, 3, 4], "case": [1, 2, 3, 7], "let": [1, 3], "sai": 1, "2": [1, 3, 7, 8], "imagin": 1, "alreadi": [1, 9], "have": [1, 2, 3, 4, 7, 9], "inventory_item": 1, "fraction": [1, 2, 9], "check": [1, 2, 8], "ll": 1, "without": [1, 2, 3, 7, 9], "issu": [1, 2], "rememb": 1, "befor": [1, 7], "true": [1, 3], "after": [1, 7, 9], "3": [1, 3, 8, 9], "next": 1, "two": [1, 2, 3, 8, 9], "total": 1, "size": [1, 2, 5, 9], "consid": 1, "4": [1, 2, 3, 7], "recal": [1, 7], "we": 1, "situat": [1, 8], "overflow": 1, "handl": [1, 8, 9], "imag": 1, "below": [1, 3], "show": [1, 2, 3, 4, 5, 7, 9], "parenthes": 1, "its": [1, 2, 4, 7, 9], "sinc": [1, 4, 7, 8, 9], "surplu": [1, 2], "append": 1, "same": [1, 2, 3, 7, 9], "result": [1, 5, 8, 9], "last": 1, "assum": 1, "look": [1, 5, 7], "like": [1, 2, 3], "onli": [1, 2, 3], "fit": [1, 2], "one": [1, 2, 3, 5, 8, 9], "full": 1, "again": 1, "howev": [1, 2, 3, 7], "despit": 1, "our": 1, "so": [1, 2, 3, 7, 8, 9], "remain": 1, "left": [1, 2, 5], "wa": [1, 2, 3, 5, 8, 9], "first": [1, 2, 5, 7], "found": [1, 2], "call": [1, 9], "method": [1, 2, 4, 5, 7, 8, 9], "from": [1, 3, 4, 5, 8, 9], "modifi": [1, 2, 9], "scenario": 1, "would": [1, 2, 3, 8], "drop": [1, 9], "e": [1, 7], "g": [1, 7, 9], "make": [1, 7, 8, 9], "being": [1, 2, 3, 7, 9], "attack": 1, "forc": 1, "go": [1, 4, 9], "somewher": 1, "specif": [1, 3, 5, 7, 9], "becom": [1, 5, 9], "chang": [1, 8], "too": [1, 3, 4, 9], "sure": [1, 8, 9], "keep": [1, 8, 9], "clean_inventori": [1, 7], "dict": 3, "self": [8, 9], "properti": 3, "To": [1, 2, 7], "pass": [1, 3, 5, 7, 8], "whatev": [1, 4, 8, 9], "subtract": 1, "paramet": [1, 8, 9], "furthermor": [1, 2, 3], "potenti": 1, "taken": [1, 8, 9], "awai": 1, "It": [1, 8, 9], "consolid": [1, 7, 9], "all": [1, 2, 3, 5, 7, 8], "similar": [1, 7], "togeth": [1, 7, 9], "ensur": [1, 3, 7], "clean": 1, "py": [0, 1, 2, 5, 9], "further": [1, 9], "document": 1, "manag": [1, 5, 9], "structur": [1, 8], "easier": 1, "certain": [1, 3, 8, 9], "task": 1, "also": [1, 3, 8, 9], "identifi": 1, "type": [1, 2, 4, 5, 7, 8, 9], "throughout": 1, "project": [1, 5, 7, 8, 9], "develop": [1, 3], "ani": [1, 2, 3, 4, 7, 8, 9], "extra": 1, "necessari": [1, 3, 4, 5, 9], "qualnam": 1, "start": [1, 2], "boundari": [1, 3], "7": [3, 7], "8": [], "9": [], "6": 3, "11": 9, "12": [], "13": [], "14": [], "15": [], "16": [], "17": [], "18": [], "19": [], "20": 1, "These": [1, 2, 3, 4, 5, 8, 9], "ar": [1, 3, 4, 5, 7, 8, 9], "select": [1, 5, 9], "slot": [1, 5], "remov": [1, 9], "need": [1, 2, 5, 7, 8, 9], "purpos": [1, 2, 4, 9], "game_object": [1, 3], "kwarg": [1, 3, 4, 8], "wide": [1, 3], "repres": [1, 2, 3, 5, 8, 9], "interact": [0, 1, 2, 4, 6, 9], "new": [1, 2, 7, 8, 9], "creat": [1, 2, 3, 5, 7, 9], "log": [1, 5, 8], "json": [1, 5], "inherit": [1, 3, 4, 5, 9], "code": [1, 5, 8, 9], "str": 1, "compet": [1, 9], "contain": [1, 3, 4, 8, 9], "etc": [1, 5, 9], "detail": [1, 4, 5], "between": [1, 9], "readm": 1, "bool": 3, "attribut": 2, "anyth": [2, 5, 8], "depend": [2, 9], "sell": [2, 9], "shop": 2, "monetari": 2, "mai": [2, 3, 7, 8, 9], "better": [2, 7], "either": 2, "integ": 2, "must": [2, 3, 7], "mechan": 2, "tool": 2, "sword": 2, "thei": [2, 3, 5, 7, 9], "don": [2, 5], "t": [2, 3, 5, 7, 9], "equal": [2, 3], "infinit": 2, "other": [2, 4, 5, 7, 9], "prevent": [2, 8, 9], "difficulti": 2, "work": [2, 3, 5, 7, 9], "tandem": 2, "explain": [2, 3, 9], "simpli": [2, 3, 9], "gold": 2, "0": [2, 3, 7, 8], "system": [2, 7, 9], "64": 2, "block": 2, "dirt": 2, "were": 2, "gain": [2, 9], "here": [2, 5, 8, 9], "file": [0, 2, 4, 5, 8, 9], "those": 2, "depth": 2, "analogi": 2, "should": [2, 9], "follow": [2, 3], "model": [2, 7], "never": 2, "alwai": 2, "minimum": 2, "greater": 2, "than": [2, 8], "65": 2, "possibl": 2, "error": [2, 5, 8], "thrown": [2, 5], "otherwis": [2, 3, 8], "abl": [2, 9], "some": [2, 9], "over": 2, "Then": [2, 7, 8], "That": 2, "place": [2, 3, 5, 9], "back": 2, "map": [1, 2, 5, 7, 8, 9], "entir": [2, 9], "game_board": 3, "slice": 3, "tupl": [3, 8, 9], "specifi": [3, 4, 5, 9], "plane": 3, "board": [3, 9], "long": [3, 8, 9], "_": 3, "bulkiest": 3, "part": 3, "field": 3, "dictionari": [3, 5], "kei": 3, "becaus": [3, 7, 9], "python": [3, 7], "requir": 3, "immut": [3, 8], "assign": 3, "coordin": [3, 8, 9], "via": 3, "done": [3, 5, 9], "wai": [3, 4, 9], "static": [3, 8], "pair": 3, "ONE": 3, "vector_2_4": 3, "station_0": 3, "convent": 3, "isn": 3, "dynam": 3, "multipl": [3, 9], "length": 3, "random": [3, 8], "vector_0_0": 3, "vector_1_1": 3, "vector_2_2": 3, "station_1": 3, "station_2": 3, "both": [3, 4, 8], "three": 3, "randomli": 3, "could": [3, 4, 7], "happen": [3, 9], "lastli": [3, 8, 9], "anoth": [3, 9], "shown": 3, "combin": [3, 8], "vector_0_1": 3, "vector_1_2": 3, "vector_1_3": 3, "station_3": 3, "station_4": 3, "interfer": 3, "appli": 3, "barrier": 3, "dimens": [3, 9], "There": [3, 5, 8, 9], "horizont": 3, "across": 3, "vertic": 3, "visual": [3, 5], "end": 7, "look_for": [], "exist": [3, 8, 9], "import": [3, 5], "accept": 3, "noth": 3, "thing": [3, 8], "floor": [3, 9], "special": 3, "futur": [3, 8, 9], "border": [3, 5, 9], "impass": [3, 5, 7, 9], "top": [4, 9], "store": [4, 5, 8, 9], "small": 4, "delet": [4, 9], "expand": [4, 9], "upon": 4, "them": [4, 5, 7], "through": [4, 8, 9], "process": [4, 9], "demonstr": 4, "deposit": 4, "simpl": 4, "idea": 4, "heavili": 4, "onto": [4, 7], "creativ": 4, "own": [4, 7], "super": 5, "descript": 5, "tri": [5, 8], "As": [5, 8, 9], "surround": 5, "adjac": 5, "space": [5, 9], "re": 5, "stand": 5, "o": 5, "p": [], "includ": [5, 9], "within": [5, 7], "rang": 5, "give_client_object": [], "increment": 5, "count": 5, "see": [5, 9], "access": [5, 8], "line": 5, "comment": 5, "out": [5, 9], "movement": [0, 6, 9], "behavior": 5, "final": [5, 9], "move": [5, 7, 9], "down": 5, "right": 5, "attempt": [5, 8], "someth": 5, "doesn": 5, "won": [5, 9], "testavatar": [0, 6, 7, 9], "setup": [6, 7, 9], "test_avatar_json_with_item": [], "test_avatar_json_with_none_item": [], "test_avatar_set_item": [], "test_avatar_set_item_fail": [], "test_avatar_set_posit": [], "test_avatar_set_position_non": [], "test_avatar_set_position_fail": [], "test_avatar_set_scor": [], "test_avatar_set_score_fail": [], "testavatarinventori": [0, 6, 7, 9], "test_avatar_drop_held_item": [], "test_avatar_drop_held_item_non": [], "test_avatar_pick_up": [], "test_avatar_pick_up_extra": [], "test_avatar_pick_up_full_inventori": [], "test_avatar_pick_up_return_non": [], "test_avatar_pick_up_surplu": [], "test_avatar_set_inventori": [], "test_avatar_set_inventory_fail_1": [], "test_avatar_set_inventory_fail_2": [], "test_avatar_set_max_inventory_s": [], "test_avatar_set_max_inventory_size_fail": [], "test_tak": [6, 7, 9], "test_take_fail": [], "test_take_non": [], "testexampl": [0, 6, 7, 9], "test_dict_arrai": [], "test_dict_bool": [], "test_dict_integ": [], "test_dict_str": [], "testgameboard": [0, 6, 7, 9], "test_game_board_json": [], "test_get_objects_avatar": [], "test_get_objects_occupiable_st": [], "test_get_objects_st": [], "test_get_objects_wal": [], "test_locations_fail": [], "test_locations_incorrect_fail": [], "test_map_size_fail": [], "test_seed_fail": [], "test_walled_fail": [], "test_generate_map": [], "test_loc": [], "test_locations_fail_len": [], "test_locations_fail_typ": [], "test_map_s": [], "test_se": [], "test_wal": [], "testiniti": [0, 6, 7, 9], "test_object_init": [], "testinteractcontrol": [0, 6, 7, 9], "test_interact_dump_item": [], "test_interact_item_occupiable_st": [], "test_interact_item_st": [], "test_interact_noth": [], "testinventorycontrol": [0, 6, 7, 9], "check_inventory_item": [], "test_select_slot_0": [], "test_select_slot_1": [], "test_select_slot_2": [], "test_select_slot_3": [], "test_select_slot_4": [], "test_select_slot_5": [], "test_select_slot_6": [], "test_select_slot_7": [], "test_select_slot_8": [], "test_select_slot_9": [], "test_with_out_of_bound": [], "test_with_wrong_action_typ": [], "testitem": [0, 6, 7, 9], "test_item_json": [], "test_pick_up": [], "test_pick_up_surplu": [], "test_pick_up_wrong_object_typ": [], "test_set_dur": [], "test_set_durability_fail": [], "test_set_durability_non": [], "test_set_durability_stack_size_fail": [], "test_set_quant": [], "test_set_quantity_fail": [], "test_set_quantity_fail_greater_than_0": [], "test_set_quantity_fail_stack_s": [], "test_set_valu": [], "test_set_value_fail": [], "test_stack_s": [], "test_stack_size_fail": [], "test_stack_size_fail_quant": [], "testmastercontrol": [0, 6, 7, 9], "testmovementcontrollerifwal": [0, 6, 7, 9], "test_move_down": [], "test_move_left": [], "test_move_right": [], "test_move_up": [], "testmovementcontrollerifoccupiablestationisoccupi": [0, 6, 7, 9], "testmovementcontrollerifoccupiablest": [0, 6, 7, 9], "test_move_down_fail": [], "test_move_left_fail": [], "test_move_right_fail": [], "test_move_up_fail": [], "testmovementcontrollerifst": [0, 6, 7, 9], "testoccupiablest": [0, 6, 7, 9], "test_avatar_occ": [], "test_fail_item_occ": [], "test_item_occ": [], "test_nested_occ_json": [], "test_occ_json": [], "test_station_occ": [], "test_wall_occ": [], "testplay": [0, 6, 7, 9], "test_act": [], "test_actions_empty_list": [], "test_actions_fail_non": [], "test_actions_fail_not_action_typ": [], "test_avatar_fail_str": [], "test_avatar_non": [], "test_functional_fail_int": [], "test_functional_fals": [], "test_functional_tru": [], "test_object_typ": [], "test_object_type_fail_int": [], "test_object_type_fail_non": [], "test_player_json": [], "test_team_nam": [], "test_team_name_fail_int": [], "test_team_name_non": [], "teststat": [0, 6, 7, 9], "test_item_occ_fail": [], "test_json": [], "test_take_act": [], "testtil": [0, 6, 7, 9], "test_avatar_til": [], "test_nested_tile_json": [], "test_occupiable_station_til": [], "test_station_til": [], "test_tile_json": [], "test_wall_til": [], "methodnam": 7, "runtest": 7, "testcas": 7, "hook": 7, "fixtur": 7, "exercis": 7, "perform": 7, "properli": 7, "veri": [7, 9], "seem": 7, "doe": [5, 7, 8], "decreas": 7, "mean": [7, 9], "tl": [], "dr": [], "subclass": [7, 8], "mock": 7, "camel": 7, "everyth": [7, 9], "els": [7, 9], "snake_cas": 7, "normal": [7, 8], "initi": [0, 6, 9], "426924334": [], "filenam": 8, "func": 8, "variable_typ": 8, "activ": 8, "overrid": 8, "standard": 8, "invok": 8, "callabl": 8, "constructor": 8, "target": 8, "argument": [5, 8], "sequenti": 8, "keyword": 8, "respect": [7, 8, 9], "already_str": 8, "set_client": [], "min_client": [], "max_client": [], "other_vector": [], "vector_1": 8, "vector_2": 8, "ndsu": 9, "acm": 9, "chapter": 9, "host": 9, "annual": 9, "competit": 8, "le": [], "royal": 9, "promot": 9, "critic": 9, "skill": 9, "challeng": 9, "competitor": 9, "under": 9, "time": 9, "limit": 9, "provid": [5, 9], "framework": 9, "index": 9, "modul": [1, 9], "search": 9, "page": 9, "base_cli": [], "base_client_2": [], "packag": 9, "content": 9, "submodul": [], "config": 9, "revamp": 9, "ndacm": [], "made": 9, "2023": 9, "overal": 9, "hint": 9, "reason": [8, 9], "mani": 9, "few": [8, 9], "flexibl": 9, "sort": 9, "determin": 9, "point": 9, "collect": 9, "price": 9, "singl": [8, 9], "onc": 9, "thought": 9, "denomin": 9, "dure": 9, "later": 9, "user": [8, 9], "defin": 9, "put": 9, "extens": [7, 9], "boolean": 9, "whether": 9, "A": [5, 8, 9], "basic": 9, "templat": 9, "form": [8, 9], "primarili": 9, "newli": 9, "featur": 9, "smoothli": 9, "oblig": 9, "nor": 9, "aspect": 9, "signific": 9, "represent": 9, "replac": 9, "v": 9, "often": 9, "confus": [7, 9], "charact": 9, "around": 9, "physic": 9, "peopl": 9, "why": 9, "gather": 9, "individu": 9, "environ": 9, "master": [0, 6, 9], "updat": 9, "overarch": 9, "state": 9, "slow": [8, 9], "simplifi": 9, "increas": 9, "most": 9, "notabl": 9, "max_number_of_actions_per_turn": 9, "adjust": 9, "suppos": 9, "elimin": 9, "plan": 9, "suggest": 9, "write": [8, 9], "pseudocod": 9, "uml": 9, "easi": 9, "forget": 9, "discuss": 9, "meet": 9, "diagram": 9, "great": 9, "stai": 9, "organ": 9, "someon": 9, "easili": [8, 9], "lose": 9, "track": 9, "bash": [], "build": 9, "bat": 9, "compil": 9, "pretti": 9, "launcher": 9, "pyz": 9, "r": 9, "due": 9, "suit": 0, "command": 7, "m": [7, 9], "manual": [], "usag": 9, "http": 9, "doc": [], "googl": [], "com": 9, "d": [], "1mgxvq5v9ygjbsbcbgdm26lugpbtqglyniauomjn85sc": [], "edit": [], "usp": [], "share": [], "referenc": 9, "github": 9, "topoftheyear": 9, "previou": [], "2018": 9, "dungeon": 9, "delver": 9, "jghibiki": 9, "2019": 9, "denizen": 9, "2020": 9, "disast": 9, "dispatch": 9, "pixpanz": 9, "byte_le_royale_2020": 9, "2021": 9, "travel": 9, "trailsmen": 9, "byte_le_royale_2021": 9, "2022": 9, "fartech": 9, "hagensr": 9, "byte_le_royale_2022": 9, "undercook": 9, "amanda": 9, "f": 9, "byte_le_royale_2023": 9, "510516222": [], "No": [0, 6, 9], "attach": 9, "addit": 9, "info": 9, "44856802": [], "ever": 5, "flow": 5, "direct": 5, "engag": 5, "give": 5, "logic": 5, "interpret": 5, "avatarinventori": [], "relat": [7, 8], "lot": 7, "still": 7, "recap": 7, "worthwhil": 7, "gamebboard": 7, "instanti": 7, "unoccupi": 7, "235374909": [], "mind": 8, "written": 8, "univers": 8, "vector_result": 8, "belong": 8, "self_vector": 8, "act": 8, "similarli": 8, "variabl": 8, "617018043": [], "commun": 8, "built": 8, "catch": 8, "caught": 8, "program": 8, "continu": 8, "multithread": 8, "432990792": [], "bulkier": 8, "tend": 8, "malici": 8, "throw": 8, "match": 8, "nest": 8, "privat": 8, "secur": 8, "achiev": 8, "getter": 8, "setter": 8, "decor": 8, "ago": 8, "304947279": [], "rilei": 9, "conlin": 9, "jordan": 9, "goetz": 9, "jacob": 9, "baumann": 9, "ajai": 9, "brown": 9, "nick": 9, "hilger": 9, "280714165": [], "724276338": [], "308978735": [], "127653972": [], "661472915": [], "407360292": [], "394775363": [], "open": 8, "522032418": [], "62859565": [], "802051133": [], "701959575": [], "664794244": [], "715094695": [], "verifi": 8, "purposefulli": 8, "interf": 8, "955156504": 8}, "objects": {"game.common": [[1, 0, 0, "-", "action"], [1, 0, 0, "-", "avatar"], [1, 0, 0, "-", "enums"], [1, 0, 0, "-", "game_object"], [1, 0, 0, "-", "player"]], "game.common.action": [[1, 1, 1, "", "Action"]], "game.common.avatar": [[1, 1, 1, "", "Avatar"]], "game.common.avatar.Avatar": [[1, 2, 1, "", "drop_held_item"], [1, 2, 1, "", "take"]], "game.common.enums": [[1, 1, 1, "", "ActionType"], [1, 1, 1, "", "DebugLevel"], [1, 1, 1, "", "ObjectType"]], "game.common.enums.ActionType": [[1, 3, 1, "", "SELECT_SLOT_9"]], "game.common.game_object": [[1, 1, 1, "", "GameObject"]], "game.common.items": [[2, 0, 0, "-", "item"]], "game.common.items.item": [[2, 1, 1, "", "Item"]], "game.common.map": [[3, 0, 0, "-", "game_board"], [3, 0, 0, "-", "occupiable"], [3, 0, 0, "-", "tile"], [3, 0, 0, "-", "wall"]], "game.common.map.game_board": [[3, 1, 1, "", "GameBoard"]], "game.common.map.occupiable": [[3, 1, 1, "", "Occupiable"]], "game.common.map.tile": [[3, 1, 1, "", "Tile"]], "game.common.map.wall": [[3, 1, 1, "", "Wall"]], "game.common.player": [[1, 1, 1, "", "Player"]], "game.common.stations": [[4, 0, 0, "-", "occupiable_station"], [4, 0, 0, "-", "occupiable_station_example"], [4, 0, 0, "-", "station"], [4, 0, 0, "-", "station_example"], [4, 0, 0, "-", "station_receiver_example"]], "game.common.stations.occupiable_station": [[4, 1, 1, "", "OccupiableStation"]], "game.common.stations.occupiable_station_example": [[4, 1, 1, "", "OccupiableStationExample"]], "game.common.stations.occupiable_station_example.OccupiableStationExample": [[4, 2, 1, "", "take_action"]], "game.common.stations.station": [[4, 1, 1, "", "Station"]], "game.common.stations.station_example": [[4, 1, 1, "", "StationExample"]], "game.common.stations.station_example.StationExample": [[4, 2, 1, "", "take_action"]], "game.common.stations.station_receiver_example": [[4, 1, 1, "", "StationReceiverExample"]], "game.common.stations.station_receiver_example.StationReceiverExample": [[4, 2, 1, "", "take_action"]], "game.controllers": [[5, 0, 0, "-", "controller"], [5, 0, 0, "-", "interact_controller"], [5, 0, 0, "-", "inventory_controller"], [5, 0, 0, "-", "master_controller"], [5, 0, 0, "-", "movement_controller"]], "game.controllers.controller": [[5, 1, 1, "", "Controller"]], "game.controllers.interact_controller": [[5, 1, 1, "", "InteractController"]], "game.controllers.interact_controller.InteractController": [[5, 2, 1, "", "handle_actions"]], "game.controllers.inventory_controller": [[5, 1, 1, "", "InventoryController"]], "game.controllers.master_controller": [[5, 1, 1, "", "MasterController"]], "game.controllers.movement_controller": [[5, 1, 1, "", "MovementController"]], "game.test_suite": [[6, 0, 0, "-", "runner"]], "game.test_suite.tests": [[7, 0, 0, "-", "test_avatar"], [7, 0, 0, "-", "test_avatar_inventory"], [7, 0, 0, "-", "test_example"], [7, 0, 0, "-", "test_game_board"], [7, 0, 0, "-", "test_game_board_no_gen"], [7, 0, 0, "-", "test_initialization"], [7, 0, 0, "-", "test_interact_controller"], [7, 0, 0, "-", "test_inventory_controller"], [7, 0, 0, "-", "test_item"], [7, 0, 0, "-", "test_master_controller"], [7, 0, 0, "-", "test_movement_controller"], [7, 0, 0, "-", "test_movement_controller_if_occupiable_station_is_occupiable"], [7, 0, 0, "-", "test_movement_controller_if_occupiable_stations"], [7, 0, 0, "-", "test_movement_controller_if_stations"], [7, 0, 0, "-", "test_movement_controller_if_wall"], [7, 0, 0, "-", "test_occupiable_station"], [7, 0, 0, "-", "test_player"], [7, 0, 0, "-", "test_station"], [7, 0, 0, "-", "test_tile"]], "game.test_suite.tests.test_avatar": [[7, 1, 1, "", "TestAvatar"]], "game.test_suite.tests.test_avatar.TestAvatar": [[7, 2, 1, "", "setUp"]], "game.test_suite.tests.test_avatar_inventory": [[7, 1, 1, "", "TestAvatarInventory"]], "game.test_suite.tests.test_avatar_inventory.TestAvatarInventory": [[7, 2, 1, "", "setUp"], [7, 2, 1, "", "test_take"]], "game.test_suite.tests.test_example": [[7, 1, 1, "", "TestExample"]], "game.test_suite.tests.test_example.TestExample": [[7, 2, 1, "", "setUp"]], "game.test_suite.tests.test_game_board": [[7, 1, 1, "", "TestGameBoard"]], "game.test_suite.tests.test_game_board.TestGameBoard": [[7, 2, 1, "", "setUp"]], "game.test_suite.tests.test_game_board_no_gen": [[7, 1, 1, "", "TestGameBoard"]], "game.test_suite.tests.test_game_board_no_gen.TestGameBoard": [[7, 2, 1, "", "setUp"]], "game.test_suite.tests.test_initialization": [[7, 1, 1, "", "TestInitialization"]], "game.test_suite.tests.test_initialization.TestInitialization": [[7, 2, 1, "", "setUp"]], "game.test_suite.tests.test_interact_controller": [[7, 1, 1, "", "TestInteractController"]], "game.test_suite.tests.test_interact_controller.TestInteractController": [[7, 2, 1, "", "setUp"]], "game.test_suite.tests.test_inventory_controller": [[7, 1, 1, "", "TestInventoryController"]], "game.test_suite.tests.test_inventory_controller.TestInventoryController": [[7, 2, 1, "", "setUp"]], "game.test_suite.tests.test_item": [[7, 1, 1, "", "TestItem"]], "game.test_suite.tests.test_item.TestItem": [[7, 2, 1, "", "setUp"]], "game.test_suite.tests.test_master_controller": [[7, 1, 1, "", "TestMasterController"]], "game.test_suite.tests.test_master_controller.TestMasterController": [[7, 2, 1, "", "setUp"]], "game.test_suite.tests.test_movement_controller": [[7, 1, 1, "", "TestMovementControllerIfWall"]], "game.test_suite.tests.test_movement_controller.TestMovementControllerIfWall": [[7, 2, 1, "", "setUp"]], "game.test_suite.tests.test_movement_controller_if_occupiable_station_is_occupiable": [[7, 1, 1, "", "TestMovementControllerIfOccupiableStationIsOccupiable"]], "game.test_suite.tests.test_movement_controller_if_occupiable_station_is_occupiable.TestMovementControllerIfOccupiableStationIsOccupiable": [[7, 2, 1, "", "setUp"]], "game.test_suite.tests.test_movement_controller_if_occupiable_stations": [[7, 1, 1, "", "TestMovementControllerIfOccupiableStations"]], "game.test_suite.tests.test_movement_controller_if_occupiable_stations.TestMovementControllerIfOccupiableStations": [[7, 2, 1, "", "setUp"]], "game.test_suite.tests.test_movement_controller_if_stations": [[7, 1, 1, "", "TestMovementControllerIfStations"]], "game.test_suite.tests.test_movement_controller_if_stations.TestMovementControllerIfStations": [[7, 2, 1, "", "setUp"]], "game.test_suite.tests.test_movement_controller_if_wall": [[7, 1, 1, "", "TestMovementControllerIfWall"]], "game.test_suite.tests.test_movement_controller_if_wall.TestMovementControllerIfWall": [[7, 2, 1, "", "setUp"]], "game.test_suite.tests.test_occupiable_station": [[7, 1, 1, "", "TestOccupiableStation"]], "game.test_suite.tests.test_occupiable_station.TestOccupiableStation": [[7, 2, 1, "", "setUp"]], "game.test_suite.tests.test_player": [[7, 1, 1, "", "TestPlayer"]], "game.test_suite.tests.test_player.TestPlayer": [[7, 2, 1, "", "setUp"]], "game.test_suite.tests.test_station": [[7, 1, 1, "", "TestStation"]], "game.test_suite.tests.test_station.TestStation": [[7, 2, 1, "", "setUp"]], "game.test_suite.tests.test_tile": [[7, 1, 1, "", "TestTile"]], "game.test_suite.tests.test_tile.TestTile": [[7, 2, 1, "", "setUp"]], "game.utils": [[8, 0, 0, "-", "generate_game"], [8, 0, 0, "-", "helpers"], [8, 0, 0, "-", "thread"], [8, 0, 0, "-", "validation"], [8, 0, 0, "-", "vector"]], "game.utils.generate_game": [[8, 4, 1, "", "generate"]], "game.utils.helpers": [[8, 4, 1, "", "write_json_file"]], "game.utils.thread": [[8, 1, 1, "", "CommunicationThread"], [8, 1, 1, "", "Thread"]], "game.utils.thread.CommunicationThread": [[8, 2, 1, "", "run"]], "game.utils.thread.Thread": [[8, 2, 1, "", "run"]], "game.utils.validation": [[8, 4, 1, "", "verify_code"]], "game.utils.vector": [[8, 1, 1, "", "Vector"]], "game.utils.vector.Vector": [[8, 2, 1, "", "as_tuple"]]}, "objtypes": {"0": "py:module", "1": "py:class", "2": "py:method", "3": "py:attribute", "4": "py:function"}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "class", "Python class"], "2": ["py", "method", "Python method"], "3": ["py", "attribute", "Python attribute"], "4": ["py", "function", "Python function"]}, "titleterms": {"base_cli": [], "modul": [], "base_client_2": [], "game": [0, 8], "packag": [0, 1, 2, 3, 4, 5, 6, 7, 8], "content": 0, "submodul": [], "config": [], "file": [1, 6, 7], "engin": 9, "client": [], "user_cli": [], "common": 1, "action": 1, "class": [1, 2, 3, 4, 5, 7], "avatar": [1, 7], "enum": 1, "gameobject": 1, "player": [1, 7], "item": [2, 7], "valu": [], "durabl": [], "quantiti": [], "stack": [], "size": 3, "pick_up": [], "method": [], "gameboard": [3, 7], "map_siz": [], "locat": 3, "wall": [3, 7], "occupi": [3, 4, 7], "tile": [3, 7], "station": [4, 7], "exampl": [4, 7], "receiv": 4, "control": [5, 7], "interact_control": [], "inventory_control": [], "master_control": [], "movement_control": [], "test_suit": [], "subpackag": [], "runner": 6, "test": [6, 7, 9], "test_avatar": [], "test_avatar_inventori": [], "test_exampl": [], "test_game_board": [], "test_game_board_no_gen": [], "test_initi": [], "test_interact_control": [], "test_inventory_control": [], "test_item": [], "test_master_control": [], "test_movement_control": [], "test_movement_controller_if_occupiable_station_is_occupi": [], "test_movement_controller_if_occupiable_st": [], "test_movement_controller_if_st": [], "test_movement_controller_if_wal": [], "test_occupiable_st": [], "test_play": [], "test_stat": [], "test_til": [], "util": 8, "generate_gam": [], "helper": 8, "thread": 8, "valid": 8, "vector": 8, "welcom": 9, "ndacm": 9, "": 9, "byte": 9, "document": 9, "indic": 9, "tabl": 9, "byte_le_engin": [], "readm": 9, "import": 9, "chang": 9, "develop": 9, "note": 9, "how": 9, "run": 9, "requir": 9, "python": 9, "version": 9, "suit": [6, 9], "command": 9, "manual": 9, "previou": 9, "le": 9, "competit": 9, "interact": [5, 7], "inventori": [5, 7], "master": [5, 7], "movement": [5, 7], "py": 6, "No": 7, "gener": [7, 8], "initi": 7, "can": 7, "base": [], "2": [], "user": [], "pick": [], "up": [], "map": 3}, "envversion": {"sphinx.domains.c": 2, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 8, "sphinx.domains.index": 1, "sphinx.domains.javascript": 2, "sphinx.domains.math": 2, "sphinx.domains.python": 3, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx.ext.viewcode": 1, "sphinx": 57}, "alltitles": {"Game Package Contents": [[0, "game-package-contents"]], "Common Package": [[1, "common-package"]], "Action Class": [[1, "module-game.common.action"]], "Avatar Class": [[1, "module-game.common.avatar"]], "Enums File": [[1, "enums-file"]], "GameObject Class": [[1, "module-game.common.game_object"]], "Player Class": [[1, "module-game.common.player"]], "Controllers Package": [[5, "controllers-package"]], "Controller Class": [[5, "module-game.controllers.controller"]], "Interact Controller Class": [[5, "module-game.controllers.interact_controller"]], "Inventory Controller Class": [[5, "module-game.controllers.inventory_controller"]], "Master Controller Class": [[5, "module-game.controllers.master_controller"]], "Movement Controller Class": [[5, "module-game.controllers.movement_controller"]], "Test Suite Package": [[6, "test-suite-package"]], "Runner.py File": [[6, "module-game.test_suite.runner"]], "Tests Package": [[7, "tests-package"]], "Test Example File": [[7, "module-game.test_suite.tests.test_example"]], "Test Avatar Class": [[7, "module-game.test_suite.tests.test_avatar"]], "Test Avatar Inventory": [[7, "module-game.test_suite.tests.test_avatar_inventory"]], "Test Gameboard Class": [[7, "module-game.test_suite.tests.test_game_board"]], "Test Gameboard (No Generation)": [[7, "module-game.test_suite.tests.test_game_board_no_gen"]], "Test Initialization File": [[7, "module-game.test_suite.tests.test_initialization"]], "Test Interact Controller File": [[7, "module-game.test_suite.tests.test_interact_controller"]], "Test Inventory Controller Class": [[7, "module-game.test_suite.tests.test_inventory_controller"]], "Test Item Class": [[7, "module-game.test_suite.tests.test_item"]], "Test Master Controller Class": [[7, "module-game.test_suite.tests.test_master_controller"]], "Test Movement Controller Class": [[7, "module-game.test_suite.tests.test_movement_controller"]], "Test Movement Controller with Occupiable Stations the Avatar can Occupy": [[7, "module-game.test_suite.tests.test_movement_controller_if_occupiable_station_is_occupiable"]], "Test Movement Controller with Occupiable Stations": [[7, "module-game.test_suite.tests.test_movement_controller_if_occupiable_stations"]], "Test Movement Controller with Stations the Avatar Occupy": [[7, "module-game.test_suite.tests.test_movement_controller_if_stations"]], "Test Movement Controller with Walls": [[7, "module-game.test_suite.tests.test_movement_controller_if_wall"]], "Test Occupiable Station Class": [[7, "module-game.test_suite.tests.test_occupiable_station"]], "Test Player Class": [[7, "module-game.test_suite.tests.test_player"]], "Test Station Class": [[7, "module-game.test_suite.tests.test_station"]], "Test Tile Class": [[7, "module-game.test_suite.tests.test_tile"]], "Utils Package": [[8, "utils-package"]], "Generate Game": [[8, "module-game.utils.generate_game"]], "Helpers": [[8, "module-game.utils.helpers"]], "Thread": [[8, "module-game.utils.thread"]], "Validation": [[8, "module-game.utils.validation"]], "Vector": [[8, "module-game.utils.vector"]], "Welcome to NDACM\u2019s Byte Engine Documentation!": [[9, "welcome-to-ndacm-s-byte-engine-documentation"]], "README Document": [[9, "readme-document"]], "Byte Engine": [[9, "byte-engine"]], "Important Changes": [[9, "important-changes"]], "Development Notes": [[9, "development-notes"]], "How to run": [[9, "how-to-run"]], "Required Python Version": [[9, "required-python-version"]], "Test Suite Commands:": [[9, "test-suite-commands"]], "Manual": [[9, "manual"]], "Previous Byte-le Competitions": [[9, "previous-byte-le-competitions"]], "Indices and tables": [[9, "indices-and-tables"]], "Map Package": [[3, "map-package"]], "Gameboard Class": [[3, "module-game.common.map.game_board"]], "Map Size:": [[3, "map-size"]], "Locations:": [[3, "locations"]], "Walled:": [[3, "walled"]], "Occupiable Class": [[3, "module-game.common.map.occupiable"]], "Tile Class": [[3, "module-game.common.map.tile"]], "Wall Class": [[3, "module-game.common.map.wall"]], "Items Package": [[2, "items-package"]], "Item Class": [[2, "module-game.common.items.item"]], "Stations Package": [[4, "stations-package"]], "Occupiable Station Class": [[4, "module-game.common.stations.occupiable_station"]], "Occupiable Station Example Class": [[4, "module-game.common.stations.occupiable_station_example"]], "Station Class": [[4, "module-game.common.stations.station"]], "Station Example Class": [[4, "module-game.common.stations.station_example"]], "Station Receiver Example Class": [[4, "module-game.common.stations.station_receiver_example"]]}, "indexentries": {"action (class in game.common.action)": [[1, "game.common.action.Action"]], "actiontype (class in game.common.enums)": [[1, "game.common.enums.ActionType"]], "avatar (class in game.common.avatar)": [[1, "game.common.avatar.Avatar"]], "debuglevel (class in game.common.enums)": [[1, "game.common.enums.DebugLevel"]], "gameobject (class in game.common.game_object)": [[1, "game.common.game_object.GameObject"]], "objecttype (class in game.common.enums)": [[1, "game.common.enums.ObjectType"]], "player (class in game.common.player)": [[1, "game.common.player.Player"]], "select_slot_9 (game.common.enums.actiontype attribute)": [[1, "game.common.enums.ActionType.SELECT_SLOT_9"]], "drop_held_item() (game.common.avatar.avatar method)": [[1, "game.common.avatar.Avatar.drop_held_item"]], "game.common.action": [[1, "module-game.common.action"]], "game.common.avatar": [[1, "module-game.common.avatar"]], "game.common.enums": [[1, "module-game.common.enums"]], "game.common.game_object": [[1, "module-game.common.game_object"]], "game.common.player": [[1, "module-game.common.player"]], "module": [[1, "module-game.common.action"], [1, "module-game.common.avatar"], [1, "module-game.common.enums"], [1, "module-game.common.game_object"], [1, "module-game.common.player"], [2, "module-game.common.items.item"], [4, "module-game.common.stations.occupiable_station"], [4, "module-game.common.stations.occupiable_station_example"], [4, "module-game.common.stations.station"], [4, "module-game.common.stations.station_example"], [4, "module-game.common.stations.station_receiver_example"]], "take() (game.common.avatar.avatar method)": [[1, "game.common.avatar.Avatar.take"]], "item (class in game.common.items.item)": [[2, "game.common.items.item.Item"]], "game.common.items.item": [[2, "module-game.common.items.item"]], "occupiablestation (class in game.common.stations.occupiable_station)": [[4, "game.common.stations.occupiable_station.OccupiableStation"]], "occupiablestationexample (class in game.common.stations.occupiable_station_example)": [[4, "game.common.stations.occupiable_station_example.OccupiableStationExample"]], "station (class in game.common.stations.station)": [[4, "game.common.stations.station.Station"]], "stationexample (class in game.common.stations.station_example)": [[4, "game.common.stations.station_example.StationExample"]], "stationreceiverexample (class in game.common.stations.station_receiver_example)": [[4, "game.common.stations.station_receiver_example.StationReceiverExample"]], "game.common.stations.occupiable_station": [[4, "module-game.common.stations.occupiable_station"]], "game.common.stations.occupiable_station_example": [[4, "module-game.common.stations.occupiable_station_example"]], "game.common.stations.station": [[4, "module-game.common.stations.station"]], "game.common.stations.station_example": [[4, "module-game.common.stations.station_example"]], "game.common.stations.station_receiver_example": [[4, "module-game.common.stations.station_receiver_example"]], "take_action() (game.common.stations.occupiable_station_example.occupiablestationexample method)": [[4, "game.common.stations.occupiable_station_example.OccupiableStationExample.take_action"]], "take_action() (game.common.stations.station_example.stationexample method)": [[4, "game.common.stations.station_example.StationExample.take_action"]], "take_action() (game.common.stations.station_receiver_example.stationreceiverexample method)": [[4, "game.common.stations.station_receiver_example.StationReceiverExample.take_action"]]}})
\ No newline at end of file
diff --git a/game/client/user_client.py b/game/client/user_client.py
index 302e5a5..92f9fca 100644
--- a/game/client/user_client.py
+++ b/game/client/user_client.py
@@ -1,19 +1,21 @@
from game.common.enums import *
from game.config import Debug
+import logging
class UserClient:
def __init__(self):
- self.debug_level = DebugLevel.client
+ self.debug_level = DebugLevel.CLIENT
self.debug = True
- def print(self, *args):
+ def debug(self, *args):
if self.debug and Debug.level >= self.debug_level:
- print(f'{self.__class__.__name__}: ', end='')
- print(*args)
+ logging.basicConfig(level=logging.DEBUG)
+ for arg in args:
+ logging.debug(f'{self.__class__.__name__}: {arg}')
def team_name(self):
return "No_Team_Name_Available"
- def take_turn(self, turn, actions, world):
+ def take_turn(self, turn, actions, world, avatar):
raise NotImplementedError("Implement this in subclass")
diff --git a/game/common/action.py b/game/common/action.py
index 13d8ef0..52dd772 100644
--- a/game/common/action.py
+++ b/game/common/action.py
@@ -2,8 +2,17 @@
class Action:
+ """
+ `Action Class:`
+
+ This class encapsulates the different actions a player can execute while playing the game.
+
+ **NOTE**: This is not currently implemented in this version of the Byte Engine. If you want more complex
+ actions, you can use this class for Objects instead of the enums.
+ """
+
def __init__(self):
- self.object_type = ObjectType.action
+ self.object_type = ObjectType.ACTION
self._example_action = None
def set_action(self, action):
diff --git a/game/common/avatar.py b/game/common/avatar.py
new file mode 100644
index 0000000..f888a46
--- /dev/null
+++ b/game/common/avatar.py
@@ -0,0 +1,331 @@
+from typing import Self
+
+from game.common.enums import ObjectType
+from game.common.game_object import GameObject
+from game.common.items.item import Item
+from game.utils.vector import Vector
+
+
+class Avatar(GameObject):
+ """
+ `Avatar Inventory Notes:`
+
+ The avatar's inventory is a list of items. Each item has a quantity and a stack_size (the max amount of an
+ item that can be held in a stack. Think of the Minecraft inventory).
+
+ This upcoming example is just to facilitate understanding the concept. The Dispensing Station concept that will
+ be mentioned is completely optional to implement if you desire. The Dispensing Station is used to help with the
+ explanation.
+
+ ----
+
+ **Items:**
+ Every Item has a quantity and a stack_size. The quantity is how much of the Item the player *currently* has.
+ The stack_size is the max of that Item that can be in a stack. For example, if the quantity is 5, and the
+ stack_size is 5 (5/5), the item cannot be added to that stack
+
+ -----
+
+ **Picking up items:**
+
+ Example 1:
+ When you pick up an item (which will now be referred to as picked_up_item), picked_up_item has a given
+ quantity. In this case, let's say the quantity of picked_up_item is 2.
+
+ Imagine you already have this item in your inventory (which will now be referred to as inventory_item),
+ and inventory_item has a quantity of 1 and a stack_size of 10 (think of this as a fraction: 1/10).
+
+ When you pick up picked_up_item, inventory_item will be checked.
+ If picked_up_item's quantity + inventory_item < stack_size, it'll be added without issue.
+ Remember, for this example: picked_up_item quantity is 2, and inventory_item quantity is 1, and
+ stack_size is 10.
+
+ Inventory_item quantity before picking up: 1/10
+ ::
+ 2 + 1 < 10 --> True
+ Inventory_item quantity after picking up: 3/10
+
+ ----
+
+ Example 2:
+ For the next two examples, the total inventory size will be considered.
+
+ Let's say inventory_item has quantity 4 and a stack_size of 5. Now say that picked_up_item has
+ quantity 3.
+
+ Recall: if picked_up_item's quantity + inventory_item < stack_size, it will be added without issue
+
+ Inventory_item quantity before picking up: 4/5
+ ::
+ 3 + 4 < 5 --> False
+
+ What do we do in this situation? If you want to add picked_up_item to inventory_item and there is an
+ overflow of quantity, that is handled for you.
+
+ Let's say that your inventory size (which will now be referred to as max_inventory_size) is 5. You
+ already have inventory_item in there that has a quantity of 4 and a stack_size of 5. An image of the
+ inventory is below. 'None' is used to help show the max_inventory_size. Inventory_item quantity and
+ stack_size will be listed in parentheses as a fraction.
+ ::
+ Inventory:
+ [
+ inventory_item (4/5),
+ None,
+ None,
+ None,
+ None
+ ]
+
+ Now we will add picked_up_item and its quantity of 3:
+ ::
+ Inventory before:
+ [
+ inventory_item (4/5),
+ None,
+ None,
+ None,
+ None
+ ]
+
+ 3 + 4 < 5 --> False
+
+ inventory_item (4/5) will now be inventory_item (5/5)
+ picked_up_item now has a quantity of 2 instead of 3
+ Since we have a surplus, we will append the same item with a quantity of 2 in the inventory.
+ ::
+ The result is:
+ [
+ inventory_item (5/5),
+ inventory_item (2/5),
+ None,
+ None,
+ None
+ ]
+
+ ----
+
+ Example 3:
+ For this last example, assume your inventory looks like this:
+ ::
+ [
+ inventory_item (5/5),
+ inventory_item (5/5),
+ inventory_item (5/5),
+ inventory_item (5/5),
+ inventory_item (4/5)
+ ]
+
+ You can only fit one more inventory_item into the last stack before the inventory is full.
+ Let's say that picked_up_item has quantity of 3 again.
+ ::
+ Inventory before:
+ [
+ inventory_item (5/5),
+ inventory_item (5/5),
+ inventory_item (5/5),
+ inventory_item (5/5),
+ inventory_item (4/5)
+ ]
+
+ 3 + 4 < 5 --> False
+
+ inventory_item (4/5) will now be inventory_item (5/5)
+ picked_up_item now has a quantity of 2
+ However, despite the surplus, we cannot add it into our inventory, so the remaining quantity of
+ picked_up_item is left where it was first found.
+ ::
+ Inventory after:
+ [
+ inventory_item (5/5),
+ inventory_item (5/5),
+ inventory_item (5/5),
+ inventory_item (5/5),
+ inventory_item (5/5)
+ ]
+ """
+
+ def __init__(self, position: Vector | None = None, max_inventory_size: int = 10):
+ super().__init__()
+ self.object_type: ObjectType = ObjectType.AVATAR
+ self.score: int = 0
+ self.position: Vector | None = position
+ self.max_inventory_size: int = max_inventory_size
+ self.inventory: list[Item | None] = [None] * max_inventory_size
+ self.held_item: Item | None = self.inventory[0]
+ self.__held_index: int = 0
+
+ @property
+ def held_item(self) -> Item | None:
+ self.__clean_inventory()
+ return self.inventory[self.__held_index]
+
+ @property
+ def score(self) -> int:
+ return self.__score
+
+ @property
+ def position(self) -> Vector | None:
+ return self.__position
+
+ @property
+ def inventory(self) -> list[Item | None]:
+ return self.__inventory
+
+ @property
+ def max_inventory_size(self) -> int:
+ return self.__max_inventory_size
+
+ @held_item.setter
+ def held_item(self, item: Item | None) -> None:
+ self.__clean_inventory()
+
+ # If it's not an item, and it's not None, raise the error
+ if item is not None and not isinstance(item, Item):
+ raise ValueError(
+ f'{self.__class__.__name__}.held_item must be an Item or None. It is a(n) '
+ f'{item.__class__.__name__} and has the value of {item}')
+
+ # If the item is not contained in the inventory, the error will be raised.
+ if not self.inventory.__contains__(item):
+ raise ValueError(f'{self.__class__.__name__}.held_item must be set to an item that already exists'
+ f' in the inventory. It has the value of {item}')
+
+ # If the item is contained in the inventory, set the held_index to that item's index
+ self.__held_index = self.inventory.index(item)
+
+ @score.setter
+ def score(self, score: int) -> None:
+ if score is None or not isinstance(score, int):
+ raise ValueError(
+ f'{self.__class__.__name__}.score must be an int. It is a(n) {score.__class__.__name__} and has the value of '
+ f'{score}')
+ self.__score: int = score
+
+ @position.setter
+ def position(self, position: Vector | None) -> None:
+ if position is not None and not isinstance(position, Vector):
+ raise ValueError(
+ f'{self.__class__.__name__}.position must be a Vector or None. It is a(n) '
+ f'{position.__class__.__name__} and has the value of {position}')
+ self.__position: Vector | None = position
+
+ @inventory.setter
+ def inventory(self, inventory: list[Item | None]) -> None:
+ # If every item in the inventory is not of type None or Item, throw an error
+ if inventory is None or not isinstance(inventory, list) \
+ or (len(inventory) > 0 and any(map(lambda item: item is not None and not
+ isinstance(item, Item), inventory))):
+ raise ValueError(
+ f'{self.__class__.__name__}.inventory must be a list of Items. It is a(n) {inventory.__class__.__name__} '
+ f'and has the value of {inventory}')
+ if len(inventory) > self.max_inventory_size:
+ raise ValueError(f'{self.__class__.__name__}.inventory size must be less than or equal to '
+ f'max_inventory_size. It has the value of {len(inventory)}')
+ self.__inventory: list[Item] = inventory
+
+ @max_inventory_size.setter
+ def max_inventory_size(self, size: int) -> None:
+ if size is None or not isinstance(size, int):
+ raise ValueError(f'{self.__class__.__name__}.max_inventory_size must be an int. It is a(n) {size.__class__.__name__} '
+ f'and has the value of {size}')
+ self.__max_inventory_size: int = size
+
+ # Private helper method that cleans the inventory of items that have a quantity of 0. This is a safety check
+ def __clean_inventory(self) -> None:
+ """
+ This method is used to manage the inventory. Whenever an item has a quantity of 0, it will set that item object
+ to None since it doesn't exist in the inventory anymore. Otherwise, if there are multiple instances of an
+ item in the inventory, and they can be consolidated, this method does that.
+
+ Example: In inventory[0], there is a stack of gold with a quantity and stack_size of 5. In inventory[1], there
+ is another stack of gold with quantity of 3, stack size of 5. If you want to take away 4 gold, inventory[0]
+ will have quantity 1, and inventory[1] will have quantity 3. Then, when clean_inventory is called, it will
+ consolidate the two. This mean that inventory[0] will have quantity 4 and inventory[1] will be set to None.
+ :return: None
+ """
+
+ # This condenses the inventory if there are duplicate items and combines them together
+ for i, item in enumerate(self.inventory):
+ [j.pick_up(item) for j in self.inventory[:i] if j is not None]
+
+ # This removes any items in the inventory that have a quantity of 0 and replaces them with None
+ remove: [int] = [x[0] for x in enumerate(self.inventory) if x[1] is not None and x[1].quantity == 0]
+ for i in remove:
+ self.inventory[i] = None
+
+ def drop_held_item(self) -> Item | None:
+ """
+ Call this method when a station is taking the held item from the avatar.
+
+ This method can be modified more for different scenarios where the held item would be dropped
+ (e.g., you make a game where being attacked forces you to drop your held item).
+
+ If you want the held item to go somewhere specifically and not become None, that can be changed too.
+
+ Make sure to keep clean_inventory() in this method.
+ """
+ # The held item will be taken from the avatar will be replaced with None in the inventory
+ held_item = self.held_item
+ self.inventory[self.__held_index] = None
+
+ self.__clean_inventory()
+
+ return held_item
+
+ def take(self, item: Item | None) -> Item | None:
+ """
+ To use this method, pass in an item object. Whatever this item's quantity is will be the amount subtracted from
+ the avatar's inventory. For example, if the item in the inventory is has a quantity of 5 and this method is
+ called with the parameter having a quantity of 2, the item in the inventory will have a quantity of 3.
+
+ Furthermore, when this method is called and the potential item is taken away, the clean_inventory method is
+ called. It will consolidate all similar items together to ensure that the inventory is clean.
+
+ Reference test_avatar_inventory.py and the clean_inventory method for further documentation on this method and
+ how the inventory is managed.
+
+ :param item:
+ :return: Item or None
+ """
+ # Calls the take method on every index on the inventory. If i isn't None, call the method
+ # NOTE: If the list is full of None (i.e., no Item objects are in it), nothing will happen
+ [item := i.take(item) for i in self.inventory if i is not None]
+ self.__clean_inventory()
+ return item
+
+ def pick_up(self, item: Item | None) -> Item | None:
+ self.__clean_inventory()
+
+ # Calls the pick_up method on every index on the inventory. If i isn't None, call the method
+ [item := i.pick_up(item) for i in self.inventory if i is not None]
+
+ # If the inventory has a slot with None, it will replace that None value with the item
+ if self.inventory.__contains__(None):
+ index = self.inventory.index(None)
+ self.inventory.pop(index)
+ self.inventory.insert(index, item)
+ # Nothing is then returned
+ return None
+
+ # If the item can't be in the inventory, return it
+ return item
+
+ def to_json(self) -> dict:
+ data: dict = super().to_json()
+ data['held_index'] = self.__held_index
+ data['held_item'] = self.held_item.to_json() if self.held_item is not None else None
+ data['score'] = self.score
+ data['position'] = self.position.to_json() if self.position is not None else None
+ data['inventory'] = self.inventory
+ data['max_inventory_size'] = self.max_inventory_size
+ return data
+
+ def from_json(self, data: dict) -> Self:
+ super().from_json(data)
+ self.score: int = data['score']
+ self.position: Vector | None = None if data['position'] is None else Vector().from_json(data['position'])
+ self.inventory: list[Item] = data['inventory']
+ self.max_inventory_size: int = data['max_inventory_size']
+ self.held_item: Item | None = self.inventory[data['held_index']]
+
+ return self
diff --git a/game/common/enums.py b/game/common/enums.py
index 4af2f58..bc56182 100644
--- a/game/common/enums.py
+++ b/game/common/enums.py
@@ -1,11 +1,58 @@
-class DebugLevel:
- none = 0
- client = 1
- controller = 2
- engine = 3
+from enum import Enum, auto
+"""
+**NOTE:** The use of the enum structure is to make is easier to execute certain tasks. It also helps with
+identifying types of Objects throughout the project.
-class ObjectType:
- none = 0
- action = 1
- player = 2
+When developing the game, add any extra enums as necessary.
+"""
+
+class DebugLevel(Enum):
+ NONE = auto()
+ CLIENT = auto()
+ CONTROLLER = auto()
+ ENGINE = auto()
+
+class ObjectType(Enum):
+ NONE = auto()
+ ACTION = auto()
+ PLAYER = auto()
+ AVATAR = auto()
+ GAMEBOARD = auto()
+ VECTOR = auto()
+ TILE = auto()
+ WALL = auto()
+ ITEM = auto()
+ OCCUPIABLE = auto()
+ STATION = auto()
+ OCCUPIABLE_STATION = auto()
+ STATION_EXAMPLE = auto()
+ STATION_RECEIVER_EXAMPLE = auto()
+ OCCUPIABLE_STATION_EXAMPLE = auto()
+
+
+class ActionType(Enum):
+ NONE = auto()
+ MOVE_UP = auto()
+ MOVE_DOWN = auto()
+ MOVE_LEFT = auto()
+ MOVE_RIGHT = auto()
+ INTERACT_UP = auto()
+ INTERACT_DOWN = auto()
+ INTERACT_LEFT = auto()
+ INTERACT_RIGHT = auto()
+ INTERACT_CENTER = auto()
+ SELECT_SLOT_0 = auto()
+ SELECT_SLOT_1 = auto()
+ SELECT_SLOT_2 = auto()
+ SELECT_SLOT_3 = auto()
+ SELECT_SLOT_4 = auto()
+ SELECT_SLOT_5 = auto()
+ SELECT_SLOT_6 = auto()
+ SELECT_SLOT_7 = auto()
+ SELECT_SLOT_8 = auto()
+ SELECT_SLOT_9 = auto()
+ """
+ These last 10 enums are for selecting a slot from the Avatar class' inventory.
+ You can add/remove these as needed for the purposes of your game.
+ """
diff --git a/game/common/game_object.py b/game/common/game_object.py
index 9419a1b..c7ef2e3 100644
--- a/game/common/game_object.py
+++ b/game/common/game_object.py
@@ -1,26 +1,38 @@
import uuid
from game.common.enums import ObjectType
+from typing import Self
class GameObject:
- def __init__(self):
+ """
+ `GameObject Class Notes:`
+
+ This class is widely used throughout the project to represent different types of Objects that are interacted
+ with in the game. If a new class is created and needs to be logged to the JSON files, make sure it inherits
+ from GameObject.
+ """
+ def __init__(self, **kwargs):
self.id = str(uuid.uuid4())
- self.object_type = ObjectType.none
+ self.object_type = ObjectType.NONE
+ self.state = "idle"
- def to_json(self):
+ def to_json(self) -> dict:
# It is recommended call this using super() in child implementations
data = dict()
data['id'] = self.id
- data['object_type'] = self.object_type
+ data['object_type'] = self.object_type.value
+ data['state'] = self.state
return data
- def from_json(self, data):
+ def from_json(self, data: dict) -> Self:
# It is recommended call this using super() in child implementations
self.id = data['id']
- self.object_type = data['object_type']
+ self.object_type = ObjectType(data['object_type'])
+ self.state = data['state']
+ return self
def obfuscate(self):
pass
diff --git a/game/common/items/__init__.py b/game/common/items/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/game/common/items/item.py b/game/common/items/item.py
new file mode 100644
index 0000000..2fe4858
--- /dev/null
+++ b/game/common/items/item.py
@@ -0,0 +1,212 @@
+from game.common.enums import ObjectType
+from game.common.game_object import GameObject
+from typing import Self
+
+
+class Item(GameObject):
+ """
+ `Item Class Notes:`
+
+ Items have 4 different attributes: value, durability, quantity, stack-size.
+
+ -----
+
+ Value:
+ The value of an item can be anything depending on the purpose of the game. For example, if a player can
+ sell an item to a shop for monetary value, the value attribute would be used. However, this value may be
+ used for anything to better fit the purpose of the game being created.
+
+ -----
+
+ Durability:
+ The value of an item's durability can be either None or an integer.
+ If durability is an integer, the stack size *must* be 1. Think of Minecraft and the mechanics of tools. You
+ can only have one sword with a durability (they don't stack).
+
+ If the durability is equal to None, it represents the item having infinite durability. The item can now be
+ stacked with others of the same type. In the case the game being created needs items without durability,
+ set this attribute to None to prevent any difficulties.
+
+ -----
+
+ Quantity and Stack Size:
+ These two work in tandem. Fractions (x/y) will be used to better explain the concept.
+
+ Quantity simply refers to the amount of the current item the player has. For example, having 5 gold, 10
+ gold, or 0 gold all work for representing the quantity.
+
+ The stack_size represents how *much* of an item can be in a stack. Think of this like the Minecraft inventory
+ system. For example, you can have 64 blocks of dirt, and if you were to gain one more, you would have a new
+ stack starting at 1.
+
+ In the case of items here, it works with the avatar.py file's inventory system (refer to those notes on how
+ the inventory works in depth). The Minecraft analogy should help understand the concept.
+
+ To better show this, quantity and stack size work like the following fraction model: quantity/stack_size.
+
+ The quantity can never be 0 and must always be a minimum of 1. Furthermore, quantity cannot be greater than
+ the stack_size. So 65/64 will not be possible.
+
+ -----
+
+ Pick Up Method:
+ When picking up an item, it will first check the item's ObjectType. If the Object interacted with is not of
+ the ObjectType ITEM enum, an error will be thrown.
+
+ Otherwise, the method will check if the picked up item will be able to fit in the inventory. If some of the
+ item's quantity can be picked up and a surplus will be left over, the player will be pick up what they can.
+
+ Then, the same item they picked up will have its quantity modified to be what is left over. That surplus of
+ the item is then returned to allow for it to be placed back where it was found on the map.
+
+ If the player can pick up an item without any inventory issues, the entire item and its quantity will be added.
+
+ **Refer to avatar.py for a more in-depth explanation of how picking up items work with examples.**
+ """
+
+ def __init__(self, value: int = 1, durability: int | None = None, quantity: int = 1, stack_size: int = 1):
+ super().__init__()
+ self.__quantity = None # This is here to prevent an error
+ self.__durability = None # This is here to prevent an error
+ self.object_type: ObjectType = ObjectType.ITEM
+ self.value: int = value # Value can more specified based on purpose (e.g., the sell price)
+ self.stack_size: int = stack_size # the max quantity this item can contain
+ self.durability: int | None = durability # durability can be None to represent infinite durability
+ self.quantity: int = quantity # the current amount of this item
+
+ @property
+ def durability(self) -> int | None:
+ return self.__durability
+
+ @property
+ def value(self) -> int:
+ return self.__value
+
+ @property
+ def quantity(self) -> int:
+ return self.__quantity
+
+ @property
+ def stack_size(self) -> int:
+ return self.__stack_size
+
+ @durability.setter
+ def durability(self, durability: int | None) -> None:
+ if durability is not None and not isinstance(durability, int):
+ raise ValueError(
+ f'{self.__class__.__name__}.durability must be an int. It is a(n) {durability.__class__.__name__} with the value of {durability}.')
+ if durability is not None and self.stack_size != 1:
+ raise ValueError(
+ f'{self.__class__.__name__}.durability must be set to None if stack_size is not equal to 1.'
+ f' {self.__class__.__name__}.durability has the value of {durability}.')
+ self.__durability = durability
+
+ @value.setter
+ def value(self, value: int) -> None:
+ if value is None or not isinstance(value, int):
+ raise ValueError(
+ f'{self.__class__.__name__}.value must be an int.'
+ f' It is a(n) {value.__class__.__name__} with the value of {value}.')
+ self.__value: int = value
+
+ @quantity.setter
+ def quantity(self, quantity: int) -> None:
+ if quantity is None or not isinstance(quantity, int):
+ raise ValueError(
+ f'{self.__class__.__name__}.quantity must be an int.'
+ f' It is a(n) {quantity.__class__.__name__} with the value of {quantity}.')
+ if quantity < 0:
+ raise ValueError(
+ f'{self.__class__.__name__}.quantity must be greater than or equal to 0.'
+ f' {self.__class__.__name__}.quantity has the value of {quantity}.')
+
+ # The self.quantity is set to the lower value between stack_size and the given quantity
+ # The remaining given quantity is returned if it's larger than self.quantity
+ if quantity > self.stack_size:
+ raise ValueError(f'{self.__class__.__name__}.quantity cannot be greater than '
+ f'{self.__class__.__name__}.stack_size.'
+ f' {self.__class__.__name__}.quantity has the value of {quantity}.')
+ self.__quantity: int = quantity
+
+ @stack_size.setter
+ def stack_size(self, stack_size: int) -> None:
+ if stack_size is None or not isinstance(stack_size, int):
+ raise ValueError(
+ f'{self.__class__.__name__}.stack_size must be an int.'
+ f' It is a(n) {stack_size.__class__.__name__} with the value of {stack_size}.')
+ if self.durability is not None and stack_size != 1:
+ raise ValueError(f'{self.__class__.__name__}.stack_size must be 1 if {self.__class__.__name__}.durability '
+ f'is not None. {self.__class__.__name__}.stack_size has the value of {stack_size}.')
+ if self.__quantity is not None and stack_size < self.__quantity:
+ raise ValueError(
+ f'{self.__class__.__name__}.stack_size must be greater than or equal to the quantity.'
+ f' {self.__class__.__name__}.stack_size has the value of {stack_size}.')
+ self.__stack_size: int = stack_size
+
+ def take(self, item: Self) -> Self | None:
+ if item is not None and not isinstance(item, Item):
+ raise ValueError(
+ f'{item.__class__.__name__}.item must be an item.'
+ f' It is a(n) {item.__class__.__name__} with the value of {item}.')
+
+ # If the item is None, just return None
+ if item is None:
+ return None
+
+ # If the items don't match, return the given item without modifications
+ if self.object_type != item.object_type:
+ return item
+
+ # If subtracting the given item's quantity from self's quantity is less than 0, raise an error
+ if self.quantity - item.quantity < 0:
+ item.quantity -= self.quantity
+ self.quantity = 0
+ return item
+
+ # Reduce self.quantity
+ self.quantity -= item.quantity
+ item.quantity = 0
+
+ return None
+
+ def pick_up(self, item: Self) -> Self | None:
+ if item is not None and not isinstance(item, Item):
+ raise ValueError(
+ f'{item.__class__.__name__}.item must be an item.'
+ f' It is a(n) {item.__class__.__name__} with the value of {item}.')
+
+ # If the item is None, just return None
+ if item is None:
+ return None
+
+ # If the items don't match, return the given item without modifications
+ if self.object_type != item.object_type:
+ return item
+
+ # If the picked up quantity goes over the stack_size, add to make the quantity equal the stack_size
+ if self.quantity + item.quantity > self.stack_size:
+ item.quantity -= self.stack_size - self.quantity
+ self.quantity: int = self.stack_size
+ return item
+
+ # Add the given item's quantity to the self item
+ self.quantity += item.quantity
+ item.quantity = 0
+
+ return None
+
+ def to_json(self) -> dict:
+ data: dict = super().to_json()
+ data['stack_size'] = self.stack_size
+ data['durability'] = self.durability
+ data['value'] = self.value
+ data['quantity'] = self.quantity
+ return data
+
+ def from_json(self, data: dict) -> Self:
+ super().from_json(data)
+ self.durability: int | None = data['durability']
+ self.stack_size: int = data['stack_size']
+ self.quantity: int = data['quantity']
+ self.value: int = data['value']
+ return self
diff --git a/game/common/map/__init__.py b/game/common/map/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/game/common/map/game_board.py b/game/common/map/game_board.py
new file mode 100644
index 0000000..60ad2af
--- /dev/null
+++ b/game/common/map/game_board.py
@@ -0,0 +1,356 @@
+import random
+from typing import Self, Callable
+
+from game.common.avatar import Avatar
+from game.common.enums import *
+from game.common.game_object import GameObject
+from game.common.map.tile import Tile
+from game.common.map.wall import Wall
+from game.common.stations.occupiable_station import OccupiableStation
+from game.common.stations.station import Station
+from game.utils.vector import Vector
+
+
+class GameBoard(GameObject):
+ """
+ `GameBoard Class Notes:`
+
+ Map Size:
+ ---------
+ map_size is a Vector object, allowing you to specify the size of the (x, y) plane of the game board.
+ For example, a Vector object with an 'x' of 5 and a 'y' of 7 will create a board 5 tiles wide and
+ 7 tiles long.
+
+ Example:
+ ::
+ _ _ _ _ _ y = 0
+ | |
+ | |
+ | |
+ | |
+ | |
+ | |
+ _ _ _ _ _ y = 6
+
+ -----
+
+ Locations:
+ ----------
+ This is the bulkiest part of the generation.
+
+ The locations field is a dictionary with a key of a tuple of Vectors, and the value being a list of
+ GameObjects (the key **must** be a tuple instead of a list because Python requires dictionary keys to be
+ immutable).
+
+ This is used to assign the given GameObjects the given coordinates via the Vectors. This is done in two ways:
+
+ Statically:
+ If you want a GameObject to be at a specific coordinate, ensure that the key-value pair is
+ *ONE* Vector and *ONE* GameObject.
+ An example of this would be the following:
+ ::
+ locations = { (vector_2_4) : [station_0] }
+
+ In this example, vector_2_4 contains the coordinates (2, 4). (Note that this naming convention
+ isn't necessary, but was used to help with the concept). Furthermore, station_0 is the
+ GameObject that will be at coordinates (2, 4).
+
+ Dynamically:
+ If you want to assign multiple GameObjects to different coordinates, use a key-value
+ pair of any length.
+
+ **NOTE**: The length of the tuple and list *MUST* be equal, otherwise it will not
+ work. In this case, the assignments will be random. An example of this would be the following:
+ ::
+ locations =
+ {
+ (vector_0_0, vector_1_1, vector_2_2) : [station_0, station_1, station_2]
+ }
+
+ (Note that the tuple and list both have a length of 3).
+
+ When this is passed in, the three different vectors containing coordinates (0, 0), (1, 1), or
+ (2, 2) will be randomly assigned station_0, station_1, or station_2.
+
+ If station_0 is randomly assigned at (1, 1), station_1 could be at (2, 2), then station_2 will be at (0, 0).
+ This is just one case of what could happen.
+
+ Lastly, another example will be shown to explain that you can combine both static and
+ dynamic assignments in the same dictionary:
+ ::
+ locations =
+ {
+ (vector_0_0) : [station_0],
+ (vector_0_1) : [station_1],
+ (vector_1_1, vector_1_2, vector_1_3) : [station_2, station_3, station_4]
+ }
+
+ In this example, station_0 will be at vector_0_0 without interference. The same applies to
+ station_1 and vector_0_1. However, for vector_1_1, vector_1_2, and vector_1_3, they will randomly
+ be assigned station_2, station_3, and station_4.
+
+ -----
+
+ Walled:
+ -------
+ This is simply a bool value that will create a wall barrier on the boundary of the game_board. If
+ walled is True, the wall will be created for you.
+
+ For example, let the dimensions of the map be (5, 7). There will be wall Objects horizontally across
+ x = 0 and x = 4. There will also be wall Objects vertically at y = 0 and y = 6
+
+ Below is a visual example of this, with 'x' being where the wall Objects are.
+
+ Example:
+ ::
+ x x x x x y = 0
+ x x
+ x x
+ x x
+ x x
+ x x
+ x x x x x y = 6
+ """
+
+ def __init__(self, seed: int | None = None, map_size: Vector = Vector(),
+ locations: dict[tuple[Vector]:list[GameObject]] | None = None, walled: bool = False):
+
+ super().__init__()
+ # game_map is initially going to be None. Since generation is slow, call generate_map() as needed
+ self.game_map: list[list[Tile]] | None = None
+ self.seed: int | None = seed
+ random.seed(seed)
+ self.object_type: ObjectType = ObjectType.GAMEBOARD
+ self.event_active: int | None = None
+ self.map_size: Vector = map_size
+ # when passing Vectors as a tuple, end the tuple of Vectors with a comma so it is recognized as a tuple
+ self.locations: dict | None = locations
+ self.walled: bool = walled
+
+ @property
+ def seed(self) -> int:
+ return self.__seed
+
+ @seed.setter
+ def seed(self, seed: int | None) -> None:
+ if self.game_map is not None:
+ raise RuntimeError(f'{self.__class__.__name__} variables cannot be changed once generate_map is run.')
+ if seed is not None and not isinstance(seed, int):
+ raise ValueError(
+ f'{self.__class__.__name__}.seed must be an int. '
+ f'It is a(n) {seed.__class__.__name__} with the value of {seed}.')
+ self.__seed = seed
+
+ @property
+ def game_map(self) -> list[list[Tile]] | None:
+ return self.__game_map
+
+ @game_map.setter
+ def game_map(self, game_map: list[list[Tile]]) -> None:
+ if game_map is not None and (not isinstance(game_map, list) or
+ any(map(lambda l: not isinstance(l, list), game_map)) or
+ any([any(map(lambda g: not isinstance(g, Tile), tile_list))
+ for tile_list in game_map])):
+ raise ValueError(
+ f'{self.__class__.__name__}.game_map must be a list[list[Tile]]. '
+ f'It is a(n) {game_map.__class__.__name__} with the value of {game_map}.')
+ self.__game_map = game_map
+
+ @property
+ def map_size(self) -> Vector:
+ return self.__map_size
+
+ @map_size.setter
+ def map_size(self, map_size: Vector) -> None:
+ if self.game_map is not None:
+ raise RuntimeError(f'{self.__class__.__name__} variables cannot be changed once generate_map is run.')
+ if map_size is None or not isinstance(map_size, Vector):
+ raise ValueError(
+ f'{self.__class__.__name__}.map_size must be a Vector. '
+ f'It is a(n) {map_size.__class__.__name__} with the value of {map_size}.')
+ self.__map_size = map_size
+
+ @property
+ def locations(self) -> dict:
+ return self.__locations
+
+ @locations.setter
+ def locations(self, locations: dict[tuple[Vector]:list[GameObject]] | None) -> None:
+ if self.game_map is not None:
+ raise RuntimeError(f'{self.__class__.__name__} variables cannot be changed once generate_map is run.')
+ if locations is not None and not isinstance(locations, dict):
+ raise ValueError(
+ f'Locations must be a dict. The key must be a tuple of Vector Objects, '
+ f'and the value a list of GameObject. '
+ f'It is a(n) {locations.__class__.__name__} with the value of {locations}.')
+
+ self.__locations = locations
+
+ @property
+ def walled(self) -> bool:
+ return self.__walled
+
+ @walled.setter
+ def walled(self, walled: bool) -> None:
+ if self.game_map is not None:
+ raise RuntimeError(f'{self.__class__.__name__} variables cannot be changed once generate_map is run.')
+ if walled is None or not isinstance(walled, bool):
+ raise ValueError(
+ f'{self.__class__.__name__}.walled must be a bool. '
+ f'It is a(n) {walled.__class__.__name__} with the value of {walled}.')
+
+ self.__walled = walled
+
+ def generate_map(self) -> None:
+ # generate map
+ self.game_map = [[Tile() for _ in range(self.map_size.x)] for _ in range(self.map_size.y)]
+
+ if self.walled:
+ for x in range(self.map_size.x):
+ if x == 0 or x == self.map_size.x - 1:
+ for y in range(self.map_size.y):
+ self.game_map[y][x].occupied_by = Wall()
+ self.game_map[0][x].occupied_by = Wall()
+ self.game_map[self.map_size.y - 1][x].occupied_by = Wall()
+
+ self.__populate_map()
+
+ def __populate_map(self) -> None:
+ for k, v in self.locations.items():
+ if len(k) == 0 or len(v) == 0: # Key-Value lengths must be > 0 and equal
+ raise ValueError(
+ f'A key-value pair from game_board.locations has a length of 0. '
+ f'The length of the keys is {len(k)} and the length of the values is {len(v)}.')
+
+ # random.sample returns a randomized list which is used in __help_populate()
+ j = random.sample(k, k=len(k))
+ self.__help_populate(j, v)
+
+ def __occupied_filter(self, game_object_list: list[GameObject]) -> list[GameObject]:
+ """
+ A helper method that returns a list of game objects that have the 'occupied_by' attribute.
+ :param game_object_list:
+ :return: a list of game object
+ """
+ return [game_object for game_object in game_object_list if hasattr(game_object, 'occupied_by')]
+
+ def __help_populate(self, vector_list: list[Vector], game_object_list: list[GameObject]) -> None:
+ """
+ A helper method that helps populate the game map.
+ :param vector_list:
+ :param game_object_list:
+ :return: None
+ """
+
+ zipped_list: [tuple[list[Vector], list[GameObject]]] = list(zip(vector_list, game_object_list))
+ last_vec: Vector = zipped_list[-1][0]
+
+ remaining_objects: list[GameObject] | None = self.__occupied_filter(game_object_list[len(zipped_list):]) \
+ if len(self.__occupied_filter(game_object_list)) > len(zipped_list) \
+ else None
+
+ # Will cap at smallest list when zipping two together
+ for vector, game_object in zipped_list:
+ if isinstance(game_object, Avatar): # If the GameObject is an Avatar, assign it the coordinate position
+ game_object.position = vector
+
+ temp_tile: GameObject = self.game_map[vector.y][vector.x]
+
+ while temp_tile.occupied_by is not None and hasattr(temp_tile.occupied_by, 'occupied_by'):
+ temp_tile = temp_tile.occupied_by
+
+ if temp_tile.occupied_by is not None:
+ raise ValueError(
+ f'Last item on the given tile doesn\'t have the \'occupied_by\' attribute. '
+ f'It is a(n) {temp_tile.occupied_by.__class__.__name__} with the value of {temp_tile.occupied_by}.')
+
+ temp_tile.occupied_by = game_object
+
+ if remaining_objects is None:
+ return
+
+ # stack remaining game_objects on last vector
+ temp_tile: GameObject = self.game_map[last_vec.y][last_vec.x]
+
+ while temp_tile.occupied_by is not None and hasattr(temp_tile.occupied_by, 'occupied_by'):
+ temp_tile = temp_tile.occupied_by
+
+ for game_object in remaining_objects:
+ if not hasattr(temp_tile, 'occupied_by') or temp_tile.occupied_by is not None:
+ raise ValueError(
+ f'Last item on the given tile doesn\'t have the \'occupied_by\' attribute.'
+ f' It is a(n) {temp_tile.occupied_by.__class__.__name__} with the value of {temp_tile.occupied_by}.')
+ temp_tile.occupied_by = game_object
+ temp_tile = temp_tile.occupied_by
+
+ def get_objects(self, look_for: ObjectType) -> list[tuple[Vector, list[GameObject]]]:
+ to_return: list[tuple[Vector, list[GameObject]]] = list()
+
+ for y, row in enumerate(self.game_map):
+ for x, object_in_row in enumerate(row):
+ go_list: list[GameObject] = []
+ temp: GameObject = object_in_row
+ self.__get_objects_help(look_for, temp, go_list)
+ if len(go_list) > 0:
+ to_return.append((Vector(x=x, y=y), [*go_list, ]))
+
+ return to_return
+
+ def __get_objects_help(self, look_for: ObjectType, temp: GameObject | Tile, to_return: list[GameObject]):
+ while hasattr(temp, 'occupied_by'):
+ if temp.object_type is look_for:
+ to_return.append(temp)
+
+ # The final temp is the last occupied by option which is either an Avatar, Station, or None
+ temp = temp.occupied_by
+
+ if temp is not None and temp.object_type is look_for:
+ to_return.append(temp)
+
+ def to_json(self) -> dict:
+ data: dict[str, object] = super().to_json()
+ temp: list[list[Tile]] = list(
+ list(map(lambda tile: tile.to_json(), y)) for y in self.game_map) if self.game_map is not None else None
+ data["game_map"] = temp
+ data["seed"] = self.seed
+ data["map_size"] = self.map_size.to_json()
+ data["location_vectors"] = [[vec.to_json() for vec in k] for k in
+ self.locations.keys()] if self.locations is not None else None
+ data["location_objects"] = [[obj.to_json() for obj in v] for v in
+ self.locations.values()] if self.locations is not None else None
+ data["walled"] = self.walled
+ data['event_active'] = self.event_active
+ return data
+
+ def generate_event(self, start: int, end: int) -> None:
+ self.event_active = random.randint(start, end)
+
+ def __from_json_helper(self, data: dict) -> GameObject:
+ temp: ObjectType = ObjectType(data['object_type'])
+ match temp:
+ case ObjectType.WALL:
+ return Wall().from_json(data)
+ case ObjectType.OCCUPIABLE_STATION:
+ return OccupiableStation().from_json(data)
+ case ObjectType.STATION:
+ return Station().from_json(data)
+ case ObjectType.AVATAR:
+ return Avatar().from_json(data)
+ # If adding more ObjectTypes that can be placed on the game_board, specify here
+ case _:
+ raise ValueError(
+ f'The object type of the object is not handled properly. The object type passed in is {temp}.')
+
+ def from_json(self, data: dict) -> Self:
+ super().from_json(data)
+ temp = data["game_map"]
+ self.seed: int | None = data["seed"]
+ self.map_size: Vector = Vector().from_json(data["map_size"])
+ self.locations: dict[tuple[Vector]:list[GameObject]] = {
+ tuple(map(lambda vec: Vector().from_json(vec), k)): [self.__from_json_helper(obj) for obj in v] for k, v in
+ zip(data["location_vectors"], data["location_objects"])} if data["location_vectors"] is not None else None
+ self.walled: bool = data["walled"]
+ self.event_active: int = data['event_active']
+ self.game_map: list[list[Tile]] = [
+ [Tile().from_json(tile) for tile in y] for y in temp] if temp is not None else None
+ return self
diff --git a/game/common/map/occupiable.py b/game/common/map/occupiable.py
new file mode 100644
index 0000000..e41d405
--- /dev/null
+++ b/game/common/map/occupiable.py
@@ -0,0 +1,45 @@
+from game.common.enums import ObjectType
+from game.common.game_object import GameObject
+from game.common.items.item import Item
+from typing import Self
+
+
+class Occupiable(GameObject):
+ """
+ `Occupiable Class Notes:`
+
+ Occupiable objects exist to encapsulate all objects that could be placed on the gameboard.
+
+ These objects can only be occupied by GameObjects, so inheritance is important. The ``None`` value is
+ acceptable for this too, showing that nothing is occupying the object.
+
+ Note: The class Item inherits from GameObject, but it is not allowed to be on an Occupiable object.
+ """
+
+ def __init__(self, occupied_by: GameObject = None, **kwargs):
+ super().__init__()
+ self.object_type: ObjectType = ObjectType.OCCUPIABLE
+ self.occupied_by: GameObject | None = occupied_by
+
+ @property
+ def occupied_by(self) -> GameObject | None:
+ return self.__occupied_by
+
+ @occupied_by.setter
+ def occupied_by(self, occupied_by: GameObject | None) -> None:
+ if occupied_by is not None and isinstance(occupied_by, Item):
+ raise ValueError(
+ f'{self.__class__.__name__}.occupied_by must be a GameObject. It is a(n) {occupied_by.__class__.__name__} with the value of {occupied_by}.')
+ if occupied_by is not None and not isinstance(occupied_by, GameObject):
+ raise ValueError(
+ f'{self.__class__.__name__}.occupied_by must be None or an instance of GameObject. It is a(n) {occupied_by.__class__.__name__} with the value of {occupied_by}.')
+ self.__occupied_by = occupied_by
+
+ def to_json(self) -> dict:
+ data: dict = super().to_json()
+ data['occupied_by'] = self.occupied_by.to_json() if self.occupied_by is not None else None
+ return data
+
+ def from_json(self, data: dict) -> Self:
+ super().from_json(data)
+ return self
diff --git a/game/common/map/tile.py b/game/common/map/tile.py
new file mode 100644
index 0000000..4be6073
--- /dev/null
+++ b/game/common/map/tile.py
@@ -0,0 +1,45 @@
+from game.common.map.occupiable import Occupiable
+from game.common.enums import ObjectType
+from game.common.game_object import GameObject
+from game.common.avatar import Avatar
+from game.common.stations.occupiable_station import OccupiableStation
+from game.common.stations.station import Station
+from game.common.map.wall import Wall
+from typing import Self
+
+
+class Tile(Occupiable):
+ """
+ `Tile Class Notes:`
+
+ The Tile class exists to encapsulate all objects that could be placed on the gameboard.
+
+ Tiles will represent things like the floor in the game. They inherit from Occupiable, which allows for tiles to
+ have certain GameObjects and the avatar on it.
+
+ If the game being developed requires different tiles with special properties, future classes may be added and
+ inherit from this class.
+ """
+ def __init__(self, occupied_by: GameObject = None):
+ super().__init__(occupied_by)
+ self.object_type: ObjectType = ObjectType.TILE
+
+ def from_json(self, data: dict) -> Self:
+ super().from_json(data)
+ occupied_by: dict | None = data['occupied_by']
+ if occupied_by is None:
+ self.occupied_by = None
+ return self
+ # Add all possible game objects that can occupy a tile here (requires python 3.10)
+ match ObjectType(occupied_by['object_type']):
+ case ObjectType.AVATAR:
+ self.occupied_by: Avatar = Avatar().from_json(occupied_by)
+ case ObjectType.OCCUPIABLE_STATION:
+ self.occupied_by: OccupiableStation = OccupiableStation().from_json(occupied_by)
+ case ObjectType.STATION:
+ self.occupied_by: Station = Station().from_json(occupied_by)
+ case ObjectType.WALL:
+ self.occupied_by: Wall = Wall().from_json(occupied_by)
+ case _:
+ raise Exception(f'The object type of the object is not handled properly. The object type passed in is {occupied_by}.')
+ return self
\ No newline at end of file
diff --git a/game/common/map/wall.py b/game/common/map/wall.py
new file mode 100644
index 0000000..41ba9d4
--- /dev/null
+++ b/game/common/map/wall.py
@@ -0,0 +1,14 @@
+from game.common.enums import ObjectType
+from game.common.game_object import GameObject
+
+
+class Wall(GameObject):
+ """
+ `Wall Class Note:`
+
+ The Wall class is used for creating objects that border the map. These are impassable.
+ """
+ def __init__(self):
+ super().__init__()
+ self.object_type = ObjectType.WALL
+
\ No newline at end of file
diff --git a/game/common/player.py b/game/common/player.py
index 614d0c2..a5df4b4 100644
--- a/game/common/player.py
+++ b/game/common/player.py
@@ -1,43 +1,144 @@
-import uuid
-
from game.common.action import Action
from game.common.game_object import GameObject
+from game.common.avatar import Avatar
from game.common.enums import *
+from game.client.user_client import UserClient
class Player(GameObject):
- def __init__(self, code=None, team_name=None, action=None):
+ """
+ `Player Class Notes:`
+
+ -----
+
+ The Player class is what represents the team that's competing. The player can contain a list of Actions to
+ execute each turn. The avatar is what's used to execute actions (e.g., interacting with stations, picking up
+ items, etc.). For more details on the difference between the Player and Avatar classes, refer to the README
+ document.
+ """
+
+ def __init__(self, code: object | None = None, team_name: str | None = None, actions: list[ActionType] = [],
+ avatar: Avatar | None = None):
super().__init__()
- self.object_type = ObjectType.player
-
- self.functional = True
- self.error = None
- self.team_name = team_name
- self.code = code
- self.action = action
+ self.object_type: ObjectType = ObjectType.PLAYER
+ self.functional: bool = True
+ # self.error: object | None = None # error is not used
+ self.team_name: str | None = team_name
+ self.code: UserClient | None = code
+ # self.action: Action = action
+ self.actions: list[ActionType] = actions
+ self.avatar: Avatar | None = avatar
+
+ @property
+ def actions(self) -> list[ActionType] | list: # change to Action if you want to use the action object
+ return self.__actions
+
+ @actions.setter
+ def actions(self, actions: list[ActionType] | list) -> None: # showing it returns nothing(like void in java)
+ # if it's (not none = and) if its (none = or)
+ # going across all action types and making it a boolean, if any are true this will be true\/
+ if actions is None or not isinstance(actions, list) \
+ or (len(actions) > 0
+ and any(map(lambda action_type: not isinstance(action_type, ActionType), actions))):
+ raise ValueError(
+ f'{self.__class__.__name__}.action must be an empty list or a list of action types. It is a(n) {actions.__class__.__name__} and has the value of {actions}.')
+ # ^if it's not either throw an error
+ self.__actions = actions
+
+ @property
+ def functional(self) -> bool:
+ return self.__functional
+
+ @functional.setter # do this for all the setters
+ def functional(self, functional: bool) -> None: # this enforces the type hinting
+ if functional is None or not isinstance(functional, bool): # if this statement is true throw an error
+ raise ValueError(
+ f'{self.__class__.__name__}.functional must be a boolean. It is a(n) {functional.__class__.__name__} and has the value of {functional}.')
+ self.__functional = functional
+
+ @property
+ def team_name(self) -> str:
+ return self.__team_name
+
+ @team_name.setter
+ def team_name(self, team_name: str) -> None:
+ if team_name is not None and not isinstance(team_name, str):
+ raise ValueError(
+ f'{self.__class__.__name__}.team_name must be a String or None. It is a(n) {team_name.__class__.__name__} and has the value of {team_name}.')
+ self.__team_name = team_name
+
+ @property
+ def avatar(self) -> Avatar:
+ return self.__avatar
+
+ @avatar.setter
+ def avatar(self, avatar: Avatar) -> None:
+ if avatar is not None and not isinstance(avatar, Avatar):
+ raise ValueError(
+ f'{self.__class__.__name__}.avatar must be Avatar or None. It is a(n) {avatar.__class__.__name__} and has the value of {avatar}.')
+ self.__avatar = avatar
+
+ @property
+ def object_type(self) -> ObjectType:
+ return self.__object_type
+
+ @object_type.setter
+ def object_type(self, object_type: ObjectType) -> None:
+ if object_type is None or not isinstance(object_type, ObjectType):
+ raise ValueError(
+ f'{self.__class__.__name__}.object_type must be ObjectType. It is a(n) {object_type.__class__.__name__} and has the value of {object_type}.')
+ self.__object_type = object_type
def to_json(self):
data = super().to_json()
data['functional'] = self.functional
- data['error'] = self.error
+ # data['error'] = self.error # .to_json() if self.error is not None else None
data['team_name'] = self.team_name
- data['action'] = self.action.to_json() if self.action is not None else None
+ data['actions'] = [act.value for act in self.actions]
+ data['avatar'] = self.avatar.to_json() if self.avatar is not None else None
return data
def from_json(self, data):
super().from_json(data)
-
+
self.functional = data['functional']
- self.error = data['error']
+ # self.error = data['error'] # .from_json(data['action']) if data['action'] is not None else None
self.team_name = data['team_name']
- act = Action()
- self.action = act.from_json(data['action']) if data['action'] is not None else None
+ self.actions: list[ActionType] = [ObjectType(action) for action in data['actions']]
+ avatar: Avatar | None = data['avatar']
+ if avatar is None:
+ self.avatar = None
+ return self
+ # match case for action
+ # match action['object_type']:
+ # case ObjectType.ACTION:
+ # self.action = Action().from_json(data['action'])
+ # case None:
+ # self.action = None
+ # case _: # checks if it is anything else
+ # raise Exception(f'Could not parse action: {self.action}')
+
+ # match case for avatar
+ match ObjectType(avatar['object_type']):
+ case ObjectType.AVATAR:
+ self.avatar = Avatar().from_json(data['avatar'])
+ case None:
+ self.avatar = None
+ case _:
+ raise Exception(f'Could not parse avatar: {self.avatar}')
+ return self
+ # self.action = Action().from_json(data['action']) if data['action'] is not None else None
+ # self.avatar = Avatar().from_json(data['avatar']) if data['avatar'] is not None else None
+
+ # to String
def __str__(self):
p = f"""ID: {self.id}
Team name: {self.team_name}
- Action: {self.action}
+ Actions:
"""
- return p
\ No newline at end of file
+ # This concatenates every action from the list of actions to the string
+ [p := p + action for action in self.actions]
+ return p
diff --git a/game/common/stations/__init__.py b/game/common/stations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/game/common/stations/occupiable_station.py b/game/common/stations/occupiable_station.py
new file mode 100644
index 0000000..42c6e54
--- /dev/null
+++ b/game/common/stations/occupiable_station.py
@@ -0,0 +1,47 @@
+from game.common.avatar import Avatar
+from game.common.map.occupiable import Occupiable
+from game.common.enums import ObjectType
+from game.common.items.item import Item
+from game.common.stations.station import Station
+from game.common.game_object import GameObject
+from typing import Self
+
+
+# create station object that contains occupied_by
+class OccupiableStation(Occupiable, Station):
+ """
+ `OccupiableStation Class Notes:`
+
+ Occupiable Station objects inherit from both the Occupiable and Station classes. This allows for other objects to
+ be "on top" of the Occupiable Station. For example, an Avatar object can be on top of this object. Since Stations
+ can contain items, items can be stored in this object too.
+
+ Any GameObject or Item can be in an Occupiable Station.
+
+ Occupiable Station Example is a small file that shows an example of how this class can be
+ used. The example class can be deleted or expanded upon if necessary.
+ """
+ def __init__(self, held_item: Item | None = None, occupied_by: GameObject | None = None):
+ super().__init__(occupied_by=occupied_by, held_item=held_item)
+ self.object_type: ObjectType = ObjectType.OCCUPIABLE_STATION
+ self.held_item = held_item
+ self.occupied_by = occupied_by
+
+ def from_json(self, data: dict) -> Self:
+ super().from_json(data)
+ occupied_by = data['occupied_by']
+ if occupied_by is None:
+ self.occupied_by = None
+ return self
+ # Add all possible game objects that can occupy a tile here (requires python 3.10)
+ match ObjectType(occupied_by['object_type']):
+ case ObjectType.AVATAR:
+ self.occupied_by: Avatar = Avatar().from_json(occupied_by)
+ case ObjectType.OCCUPIABLE_STATION:
+ self.occupied_by: OccupiableStation = OccupiableStation().from_json(occupied_by)
+ case ObjectType.STATION:
+ self.occupied_by: Station = Station().from_json(occupied_by)
+ case _:
+ raise ValueError(f'{self.__class__.__name__}.occupied_by must be a GameObject.'
+ f' It is a(n) {self.occupied_by.__class__.__name__} with the value of {occupied_by}')
+ return self
diff --git a/game/common/stations/occupiable_station_example.py b/game/common/stations/occupiable_station_example.py
new file mode 100644
index 0000000..f3280ef
--- /dev/null
+++ b/game/common/stations/occupiable_station_example.py
@@ -0,0 +1,20 @@
+from game.common.avatar import Avatar
+from game.common.enums import ObjectType
+from game.common.items.item import Item
+from game.common.stations.occupiable_station import OccupiableStation
+
+
+# create example of occupiable_station that gives item
+class OccupiableStationExample(OccupiableStation):
+ def __init__(self, held_item: Item | None = None):
+ super().__init__(held_item=held_item)
+ self.object_type = ObjectType.STATION_EXAMPLE
+
+ def take_action(self, avatar: Avatar) -> Item | None:
+ """
+ In this example of what an occupiable station could do, the avatar picks up the item from this station to
+ show the station's purpose.
+ :param avatar:
+ :return:
+ """
+ avatar.pick_up(self.held_item)
diff --git a/game/common/stations/station.py b/game/common/stations/station.py
new file mode 100644
index 0000000..0238d87
--- /dev/null
+++ b/game/common/stations/station.py
@@ -0,0 +1,64 @@
+from game.common.avatar import Avatar
+from game.common.game_object import GameObject
+from game.common.enums import ObjectType
+from game.common.items.item import Item
+from typing import Self
+
+
+# create Station object from GameObject that allows item to be contained in it
+class Station(GameObject):
+ """
+ `Station Class Notes:`
+
+ Station objects inherit from GameObject and can contain Item objects in them.
+
+ Players can interact with Stations in different ways by using the ``take_action()`` method. Whatever is specified
+ in this method will control how players interact with the station. The Avatar and Item classes have methods that
+ go through this process. Refer to them for more details.
+
+ The Occupiable Station Example class demonstrates an avatar object receiving the station's stored item. The
+ Station Receiver Example class demonstrates an avatar depositing its held item into a station. These are simple
+ ideas for how stations can be used. These can be heavily added onto for more creative uses!
+ """
+
+ def __init__(self, held_item: Item | None = None, **kwargs):
+ super().__init__()
+ self.object_type: ObjectType = ObjectType.STATION
+ self.held_item: Item | None = held_item
+
+ # held_item getter and setter methods
+ @property
+ def held_item(self) -> Item | None:
+ return self.__item
+
+ @held_item.setter
+ def held_item(self, held_item: Item) -> None:
+ if held_item is not None and not isinstance(held_item, Item):
+ raise ValueError(f'{self.__class__.__name__}.held_item must be an Item or None, not {held_item}.')
+ self.__item = held_item
+
+ # base of take action method, defined in classes that extend Station (StationExample demonstrates this)
+ def take_action(self, avatar: Avatar) -> Item | None:
+ pass
+
+ # json methods
+ def to_json(self) -> dict:
+ data: dict = super().to_json()
+ data['held_item'] = self.held_item.to_json() if self.held_item is not None else None
+
+ return data
+
+ def from_json(self, data: dict) -> Self:
+ super().from_json(data)
+ held_item: dict = data['held_item']
+ if held_item is None:
+ self.held_item = None
+ return self
+
+ # framework match case for from json, can add more object types that can be item
+ match ObjectType(held_item['object_type']):
+ case ObjectType.ITEM:
+ self.held_item = Item().from_json(held_item)
+ case _:
+ raise Exception(f'Could not parse held_item: {held_item}')
+ return self
diff --git a/game/common/stations/station_example.py b/game/common/stations/station_example.py
new file mode 100644
index 0000000..c7b5cbc
--- /dev/null
+++ b/game/common/stations/station_example.py
@@ -0,0 +1,20 @@
+from game.common.avatar import Avatar
+from game.common.enums import ObjectType
+from game.common.items.item import Item
+from game.common.stations.station import Station
+
+
+# create example of station that gives item to avatar
+class StationExample(Station):
+ def __init__(self, held_item: Item | None = None):
+ super().__init__(held_item=held_item)
+ self.object_type = ObjectType.STATION_EXAMPLE
+
+ def take_action(self, avatar: Avatar) -> Item | None:
+ """
+ In this example of what a station could do, the avatar picks up the item from this station to show the
+ station's purpose.
+ :param avatar:
+ :return:
+ """
+ avatar.pick_up(self.held_item)
diff --git a/game/common/stations/station_receiver_example.py b/game/common/stations/station_receiver_example.py
new file mode 100644
index 0000000..75c789f
--- /dev/null
+++ b/game/common/stations/station_receiver_example.py
@@ -0,0 +1,20 @@
+from game.common.avatar import Avatar
+from game.common.enums import ObjectType
+from game.common.items.item import Item
+from game.common.stations.station import Station
+
+
+# create example of station that takes held_item from avatar at inventory slot 0
+class StationReceiverExample(Station):
+ def __init__(self, held_item: Item | None = None):
+ super().__init__(held_item=held_item)
+ self.object_type = ObjectType.STATION_RECEIVER_EXAMPLE
+
+ def take_action(self, avatar: Avatar) -> None:
+ """
+ In this example of what a type of station could do, the station takes the avatars held item and takes it for
+ its own.
+ :param avatar:
+ :return:
+ """
+ self.held_item = avatar.drop_held_item()
diff --git a/game/config.py b/game/config.py
index 47e8d41..6dbc8b1 100644
--- a/game/config.py
+++ b/game/config.py
@@ -2,6 +2,11 @@
from game.common.enums import *
+"""
+This file is important for configuring settings for the project. All parameters in this file have comments to explain
+what they do already. Refer to this file to clear any confusion, and make any changes as necessary.
+"""
+
# Runtime settings / Restrictions --------------------------------------------------------------------------------------
# The engine requires these to operate
MAX_TICKS = 500 # max number of ticks the server will run regardless of game state
@@ -10,6 +15,8 @@
MAX_SECONDS_PER_TURN = 0.1 # max number of basic operations clients have for their turns
+MAX_NUMBER_OF_ACTIONS_PER_TURN = 2 # max number of actions per turn is currently set to 2
+
MIN_CLIENTS_START = None # minimum number of clients required to start running the game; should be None when SET_NUMBER_OF_CLIENTS is used
MAX_CLIENTS_START = None # maximum number of clients required to start running the game; should be None when SET_NUMBER_OF_CLIENTS is used
SET_NUMBER_OF_CLIENTS_START = 2 # required number of clients to start running the game; should be None when MIN_CLIENTS or MAX_CLIENTS are used
@@ -21,7 +28,13 @@
SET_NUMBER_OF_CLIENTS_CONTINUE = 2 # required number of clients to continue running the game; should be None when MIN_CLIENTS or MAX_CLIENTS are used
ALLOWED_MODULES = ["game.client.user_client", # modules that clients are specifically allowed to access
- "game.common.enums"]
+ "game.common.enums",
+ "numpy",
+ "scipy",
+ "pandas",
+ "itertools",
+ "functools",
+ ]
RESULTS_FILE_NAME = "results.json" # Name and extension of results file
RESULTS_DIR = os.path.join(os.getcwd(), "logs") # Location of the results file
@@ -37,6 +50,6 @@
class Debug: # Keeps track of the current debug level of the game
- level = DebugLevel.none
+ level = DebugLevel.NONE
# Other Settings Here --------------------------------------------------------------------------------------------------
diff --git a/game/controllers/controller.py b/game/controllers/controller.py
index 26b7e97..aa517df 100644
--- a/game/controllers/controller.py
+++ b/game/controllers/controller.py
@@ -1,14 +1,32 @@
-from game.common.enums import DebugLevel
+from game.common.enums import DebugLevel, ActionType
from game.config import Debug
+from game.common.player import Player
+from game.common.map.game_board import GameBoard
+import logging
class Controller:
+ """
+ `Controller Class Notes:`
+ This is a super class for every controller type that is necessary for inheritance. Think of it as the GameObject
+ class for Controllers.
+
+ The handle_actions method is important and will specify what each controller does when interacting with the
+ Player object's avatar.
+
+ Refer to the other controller files for a more detailed description on how they work.
+ If more controllers are ever needed, add them to facilitate the flow of the game.
+ """
def __init__(self):
- self.debug_level = DebugLevel.controller
+ self.debug_level = DebugLevel.CONTROLLER
self.debug = False
- def print(self, *args):
+ def handle_actions(self, action: ActionType, client: Player, world: GameBoard):
+ return
+
+ def debug(self, *args):
if self.debug and Debug.level >= self.debug_level:
- print(f'{self.__class__.__name__}: ', end='')
- print(*args)
+ logging.basicConfig(level=logging.DEBUGs)
+ for arg in args:
+ logging.debug(f'{self.__class__.__name__}: {arg}')
diff --git a/game/controllers/interact_controller.py b/game/controllers/interact_controller.py
new file mode 100644
index 0000000..660f396
--- /dev/null
+++ b/game/controllers/interact_controller.py
@@ -0,0 +1,66 @@
+from game.common.enums import *
+from game.controllers.controller import Controller
+from game.common.player import Player
+from game.common.stations.station import Station
+from game.common.items.item import Item
+from game.common.map.game_board import GameBoard
+from game.utils.vector import Vector
+
+
+class InteractController(Controller):
+ """
+ `Interact Controller Notes:`
+
+ The Interact Controller manages the actions the player tries to execute. As the game is played, a player can
+ interact with surrounding, adjacent stations and the space they're currently standing on.
+
+ Example:
+ ::
+ x x x x x x
+ x x
+ x O x
+ x O A O x
+ x O x
+ x x x x x x
+
+ The given visual shows what players can interact with. "A" represents the avatar; "O" represents the spaces
+ that can be interacted with (including where the "A" is); and "x" represents the walls and map border.
+
+ These interactions are managed by using the provided ActionType enums in the enums.py file.
+ """
+
+ def __init__(self):
+ super().__init__()
+
+ def handle_actions(self, action: ActionType, client: Player, world: GameBoard) -> None:
+ """
+ Given the ActionType for interacting in a direction, the Player's avatar will engage with the object.
+ :param action:
+ :param client:
+ :param world:
+ :return: None
+ """
+
+ # match interaction type with x and y
+ vector: Vector
+ match action:
+ case ActionType.INTERACT_UP:
+ vector = Vector(x=0, y=-1)
+ case ActionType.INTERACT_DOWN:
+ vector = Vector(x=0, y=1)
+ case ActionType.INTERACT_LEFT:
+ vector = Vector(x=-1, y=0)
+ case ActionType.INTERACT_RIGHT:
+ vector = Vector(x=1, y=0)
+ case ActionType.INTERACT_CENTER:
+ vector = Vector(0, 0)
+ case _:
+ return
+
+ # find result in interaction
+ vector.x += client.avatar.position.x
+ vector.y += client.avatar.position.y
+ stat: Station = world.game_map[vector.y][vector.x].occupied_by
+
+ if stat is not None and isinstance(stat, Station):
+ stat.take_action(client.avatar)
diff --git a/game/controllers/inventory_controller.py b/game/controllers/inventory_controller.py
new file mode 100644
index 0000000..d0fe469
--- /dev/null
+++ b/game/controllers/inventory_controller.py
@@ -0,0 +1,37 @@
+from game.common.enums import *
+from game.common.avatar import Avatar
+from game.common.player import Player
+from game.controllers.controller import Controller
+from game.common.map.game_board import GameBoard
+
+
+class InventoryController(Controller):
+ """
+ `Interact Controller Notes:`
+
+ The Inventory Controller is how player's can manage and interact with their inventory. When given the enum to
+ select an item from a slot in the inventory, that will then become the held item.
+
+ If an enum is passed in that is not within the range of the inventory size, an error will be thrown.
+ """
+
+ def __init__(self):
+ super().__init__()
+
+ def handle_actions(self, action: ActionType, client: Player, world: GameBoard) -> None:
+ # If a larger inventory is created, create more enums and add them here as needed
+ avatar: Avatar = client.avatar
+
+ # If there are more than 10 slots in the inventory, change "ActionType.SELECT_SLOT_9"
+ # This checks if the given action isn't one of the select slot enums
+ if action.value < ActionType.SELECT_SLOT_0.value or action.value > ActionType.SELECT_SLOT_9.value:
+ return
+
+ index: int = action.value - ActionType.SELECT_SLOT_0.value
+
+ try:
+ avatar.held_item = avatar.inventory[index]
+ except IndexError:
+ raise IndexError(f'The given action type, {action.name}, is not within bounds of the given inventory of '
+ f'size {len(avatar.inventory)}. Select an ActionType enum that will be within the '
+ f'inventory\'s bounds.')
diff --git a/game/controllers/master_controller.py b/game/controllers/master_controller.py
index b97a03b..8d1d322 100644
--- a/game/controllers/master_controller.py
+++ b/game/controllers/master_controller.py
@@ -1,25 +1,69 @@
from copy import deepcopy
+import random
from game.common.action import Action
+from game.common.avatar import Avatar
from game.common.enums import *
from game.common.player import Player
-import game.config as config
+import game.config as config # this is for turns
from game.utils.thread import CommunicationThread
-
+from game.controllers.movement_controller import MovementController
from game.controllers.controller import Controller
+from game.controllers.interact_controller import InteractController
+from game.common.map.game_board import GameBoard
+from game.config import MAX_NUMBER_OF_ACTIONS_PER_TURN
+from game.utils.vector import Vector
class MasterController(Controller):
+ """
+ `Master Controller Notes:`
+
+ Give Client Objects:
+ Takes a list of Player objects and places each one in the game world.
+
+ Game Loop Logic:
+ Increments the turn count as the game plays (look at the engine to see how it's controlled more).
+
+ Interpret Current Turn Data:
+ This accesses the gameboard in the first turn of the game and generates the game's seed.
+
+ Client Turn Arguments:
+ There are lines of code commented out that create Action Objects instead of using the enum. If your project
+ needs Actions Objects instead of the enums, comment out the enums and use Objects as necessary.
+
+ Turn Logic:
+ This method executes every movement and interact behavior from every client in the game. This is done by
+ using every other type of Controller object that was created in the project that needs to be managed
+ here (InteractController, MovementController, other game-specific controllers, etc.).
+
+ Create Turn Log:
+ This method creates a dictionary that stores the turn, all client objects, and the gameboard's JSON file to
+ be used as the turn log.
+
+ Return Final Results:
+ This method creates a dictionary that stores a list of the clients' JSON files. This represents the final
+ results of the game.
+ """
def __init__(self):
super().__init__()
- self.game_over = False
-
- self.turn = None
- self.current_world_data = None
+ self.game_over: bool = False
+ # self.event_timer = GameStats.event_timer # anything related to events are commented it out until made
+ # self.event_times: tuple[int, int] | None = None
+ self.turn: int = 1
+ self.current_world_data: dict = None
+ self.movement_controller: MovementController = MovementController()
+ self.interact_controller: InteractController = InteractController()
# Receives all clients for the purpose of giving them the objects they will control
- def give_clients_objects(self, clients):
- pass
+ def give_clients_objects(self, clients: list[Player], world: dict):
+ # starting_positions = [[3, 3], [3, 9]] # would be done in generate game
+ gb: GameBoard = world['game_board']
+ avatars: list[tuple[Vector, list[Avatar]]]= gb.get_objects(ObjectType.AVATAR)
+ for avatar, client in zip(avatars,clients):
+ avatar[1][0].position = avatar[0]
+ client.avatar = avatar[1][0]
+
# Generator function. Given a key:value pair where the key is the identifier for the current world and the value is
# the state of the world, returns the key that will give the appropriate world information
@@ -34,35 +78,62 @@ def game_loop_logic(self, start=1):
self.turn += 1
# Receives world data from the generated game log and is responsible for interpreting it
- def interpret_current_turn_data(self, clients, world, turn):
+ def interpret_current_turn_data(self, clients: list[Player], world: dict, turn):
self.current_world_data = world
+ if turn == 1:
+ random.seed(world['game_board'].seed)
+ # self.event_times = random.randrange(162, 172), random.randrange(329, 339)
+
# Receive a specific client and send them what they get per turn. Also obfuscates necessary objects.
- def client_turn_arguments(self, client, turn):
- actions = Action()
- client.action = actions
+ def client_turn_arguments(self, client: Player, turn):
+ # turn_action: Action = Action()
+ # client.action: Action = turn_action
+ # ^if you want to use action as an object instead of an enum
+
+ turn_actions: list[ActionType] = []
+ client.actions = turn_actions
# Create deep copies of all objects sent to the player
+ current_world = deepcopy(self.current_world_data["game_board"]) # what is current world and copy avatar
+ copy_avatar = deepcopy(client.avatar)
# Obfuscate data in objects that that player should not be able to see
-
- args = (self.turn, actions, self.current_world_data)
+ # Currently world data isn't obfuscated at all
+ args = (self.turn, turn_actions, current_world, copy_avatar)
return args
# Perform the main logic that happens per turn
- def turn_logic(self, clients, turn):
- pass
+ def turn_logic(self, clients: list[Player], turn):
+ for client in clients:
+ for i in range(MAX_NUMBER_OF_ACTIONS_PER_TURN):
+ try:
+ self.movement_controller.handle_actions(client.actions[i], client, self.current_world_data["game_board"])
+ self.interact_controller.handle_actions(client.actions[i], client, self.current_world_data["game_board"])
+ except IndexError:
+ pass
+
+ # checks event logic at the end of round
+ # self.handle_events(clients)
+
+ # comment out for now, nothing is in place for event types yet
+ # def handle_events(self, clients):
+ # If it is time to run an event, master controller picks an event to run
+ # if self.turn == self.event_times[0] or self.turn == self.event_times[1]:
+ # self.current_world_data["game_map"].generate_event(EventType.example, EventType.example)
+ # event type.example is just a placeholder for now
# Return serialized version of game
- def create_turn_log(self, clients, turn):
+ def create_turn_log(self, clients: list[Player], turn: int):
data = dict()
-
+ data['tick'] = turn
+ data['clients'] = [client.to_json() for client in clients]
# Add things that should be thrown into the turn logs here
- data['temp'] = None
+ data['game_board'] = self.current_world_data["game_board"].to_json()
return data
# Gather necessary data together in results file
- def return_final_results(self, clients, turn):
+ def return_final_results(self, clients: list[Player], turn):
data = dict()
data['players'] = list()
diff --git a/game/controllers/movement_controller.py b/game/controllers/movement_controller.py
new file mode 100644
index 0000000..ffaa612
--- /dev/null
+++ b/game/controllers/movement_controller.py
@@ -0,0 +1,57 @@
+from game.common.player import Player
+from game.common.map.game_board import GameBoard
+from game.common.map.tile import Tile
+from game.common.enums import *
+from game.utils.vector import Vector
+from game.controllers.controller import Controller
+
+
+class MovementController(Controller):
+ """
+ `Movement Controller Notes:`
+
+ The Movement Controller manages the movement actions the player tries to execute. Players can move up, down,
+ left, and right. If the player tries to move into a space that's impassable, they don't move.
+
+ For example, if the player attempts to move into an Occupiable Station (something the player can be on) that is
+ occupied by a Wall object (something the player can't be on), the player doesn't move; that is, if the player
+ tries to move into anything that can't be occupied by something, they won't move.
+ """
+
+ def __init__(self):
+ super().__init__()
+
+ def handle_actions(self, action: ActionType, client: Player, world: GameBoard):
+ avatar_pos: Vector = Vector(client.avatar.position.x, client.avatar.position.y)
+
+ pos_mod: Vector
+ match action:
+ case ActionType.MOVE_UP:
+ pos_mod = Vector(x=0, y=-1)
+ case ActionType.MOVE_DOWN:
+ pos_mod = Vector(x=0, y=1)
+ case ActionType.MOVE_LEFT:
+ pos_mod = Vector(x=-1, y=0)
+ case ActionType.MOVE_RIGHT:
+ pos_mod = Vector(x=1, y=0)
+ case _: # default case
+ return
+
+ temp_vec: Vector = Vector.add_vectors(avatar_pos, pos_mod)
+ # if tile is occupied return
+ temp: Tile = world.game_map[temp_vec.y][temp_vec.x]
+ while hasattr(temp.occupied_by, 'occupied_by'):
+ temp: Tile = temp.occupied_by
+
+ if temp.occupied_by is not None:
+ return
+
+ temp.occupied_by = client.avatar
+
+ # while the object that occupies tile has the occupied by attribute, escalate check for avatar
+ temp: Tile = world.game_map[avatar_pos.y][avatar_pos.x]
+ while hasattr(temp.occupied_by, 'occupied_by'):
+ temp = temp.occupied_by
+
+ temp.occupied_by = None
+ client.avatar.position = Vector(temp_vec.x, temp_vec.y)
diff --git a/game/engine.py b/game/engine.py
index 5a51325..db9e1b0 100644
--- a/game/engine.py
+++ b/game/engine.py
@@ -1,18 +1,21 @@
-from datetime import datetime
import importlib
import json
-import os
+import logging
import sys
+import threading
import traceback
+from datetime import datetime
+from tqdm import tqdm
+
+from game.common.map.game_board import GameBoard
from game.common.player import Player
from game.config import *
from game.controllers.master_controller import MasterController
from game.utils.helpers import write_json_file
from game.utils.thread import Thread, CommunicationThread
from game.utils.validation import verify_code, verify_num_clients
-
-from tqdm import tqdm
+from game.client.user_client import UserClient
class Engine:
@@ -36,8 +39,8 @@ def loop(self):
if self.quiet_mode:
f = open(os.devnull, 'w')
sys.stdout = f
- self.boot()
self.load()
+ self.boot()
for self.current_world_key in tqdm(
self.master_controller.game_loop_logic(),
bar_format=TQDM_BAR_FORMAT,
@@ -90,7 +93,7 @@ def boot(self):
f'Player is using "open" which is forbidden.')
# Attempt creation of the client object
- obj = None
+ obj: UserClient | None = None
try:
# Import client's code
im = importlib.import_module(f'{filename}', CLIENT_DIRECTORY)
@@ -146,9 +149,9 @@ def boot(self):
self.clients.sort(key=lambda clnt: clnt.team_name, reverse=True)
# Finally, request master controller to establish clients with basic objects
if SET_NUMBER_OF_CLIENTS_START == 1:
- self.master_controller.give_clients_objects(self.clients[0])
+ self.master_controller.give_clients_objects(self.clients[0], self.world)
else:
- self.master_controller.give_clients_objects(self.clients)
+ self.master_controller.give_clients_objects(self.clients, self.world)
# Loads in the world
def load(self):
@@ -167,6 +170,7 @@ def load(self):
world = None
with open(GAME_MAP_FILE) as json_file:
world = json.load(json_file)
+ world['game_board'] = GameBoard().from_json(world['game_board'])
self.world = world
# Sits on top of all actions that need to happen before the player takes their turn
@@ -174,16 +178,11 @@ def pre_tick(self):
# Increment the tick
self.tick_number += 1
- # Retrieve current world info
- if self.current_world_key not in self.world:
- raise KeyError('Given generated world key does not exist inside the world.')
- current_world = self.world[self.current_world_key]
-
# Send current world information to master controller for purposes
if SET_NUMBER_OF_CLIENTS_START == 1:
- self.master_controller.interpret_current_turn_data(self.clients[0], current_world, self.tick_number)
+ self.master_controller.interpret_current_turn_data(self.clients[0], self.world, self.tick_number)
else:
- self.master_controller.interpret_current_turn_data(self.clients, current_world, self.tick_number)
+ self.master_controller.interpret_current_turn_data(self.clients, self.world, self.tick_number)
# Does actions like lets the player take their turn and asks master controller to perform game logic
def tick(self):
@@ -260,7 +259,8 @@ def post_tick(self):
else:
data = self.master_controller.create_turn_log(self.clients, self.tick_number)
- self.game_logs[self.tick_number] = data
+ threading.Thread(target=write_json_file,
+ args=(data, os.path.join(LOGS_DIR, f'turn_{self.tick_number:04d}.json'))).start()
# Perform a game over check
if self.master_controller.game_over:
@@ -301,10 +301,11 @@ def shutdown(self, source=None):
# Flush standard out
sys.stdout.flush()
- os._exit(0)
+ # os._exit(0)
# Debug print statement
def debug(*args):
- if Debug.level >= DebugLevel.engine:
- print('Engine: ', end='')
- print(*args)
+ if Debug.level >= DebugLevel.ENGINE:
+ logging.basicConfig(level=logging.DEBUG)
+ for arg in args:
+ logging.debug(f'Engine: {arg}')
diff --git a/game/test_suite/runner.py b/game/test_suite/runner.py
index f5358af..5dd32ce 100644
--- a/game/test_suite/runner.py
+++ b/game/test_suite/runner.py
@@ -1,5 +1,10 @@
import unittest
-
+"""
+This file is used to run the test suite.
+
+**DO NOT MODIFY THIS FILE.**
+"""
+
if __name__ == "__main__":
loader = unittest.TestLoader()
tests = loader.discover('.')
diff --git a/game/test_suite/tests/test_avatar.py b/game/test_suite/tests/test_avatar.py
new file mode 100644
index 0000000..53692a0
--- /dev/null
+++ b/game/test_suite/tests/test_avatar.py
@@ -0,0 +1,81 @@
+import unittest
+
+from game.common.avatar import Avatar
+from game.common.items.item import Item
+from game.utils.vector import Vector
+
+
+class TestAvatar(unittest.TestCase):
+ """
+ `Test Avatar Notes:`
+
+ This class tests the different methods in the Avatar class.
+ """
+
+ def setUp(self) -> None:
+ self.avatar: Avatar = Avatar(None, 1)
+ self.item: Item = Item(10, 100, 1, 1)
+
+ # test set item
+ def test_avatar_set_item(self):
+ self.avatar.pick_up(self.item)
+ self.assertEqual(self.avatar.held_item, self.item)
+
+ def test_avatar_set_item_fail(self):
+ value: int = 3
+ with self.assertRaises(ValueError) as e:
+ self.avatar.held_item = value
+ self.assertEqual(str(e.exception), f'Avatar.held_item must be an Item or None. It is a(n) '
+ f'{value.__class__.__name__} and has the value of '
+ f'{value}')
+
+ # test set score
+ def test_avatar_set_score(self):
+ self.avatar.score = 10
+ self.assertEqual(self.avatar.score, 10)
+
+ def test_avatar_set_score_fail(self):
+ value: str = 'wow'
+ with self.assertRaises(ValueError) as e:
+ self.avatar.score = value
+ self.assertEqual(str(e.exception), f'Avatar.score must be an int. It is a(n) '
+ f'{value.__class__.__name__} and has the value of {value}')
+
+ # test set position
+ def test_avatar_set_position(self):
+ self.avatar.position = Vector(10, 10)
+ self.assertEqual(str(self.avatar.position), str(Vector(10, 10)))
+
+ def test_avatar_set_position_None(self):
+ self.avatar.position = None
+ self.assertEqual(self.avatar.position, None)
+
+ def test_avatar_set_position_fail(self):
+ value: int = 10
+ with self.assertRaises(ValueError) as e:
+ self.avatar.position = value
+ self.assertEqual(str(e.exception), f'Avatar.position must be a Vector or None. '
+ f'It is a(n) {value.__class__.__name__} and has the value of {value}')
+
+ # test json method
+ def test_avatar_json_with_none_item(self):
+ # held item will be None
+ self.avatar.held_item = self.avatar.inventory[0]
+ self.avatar.position = Vector(10, 10)
+ data: dict = self.avatar.to_json()
+ avatar: Avatar = Avatar().from_json(data)
+ self.assertEqual(self.avatar.object_type, avatar.object_type)
+ self.assertEqual(self.avatar.held_item, avatar.held_item)
+ self.assertEqual(str(self.avatar.position), str(avatar.position))
+
+ def test_avatar_json_with_item(self):
+ self.avatar.pick_up(Item(1, 1))
+ self.avatar.position = Vector(10, 10)
+ data: dict = self.avatar.to_json()
+ avatar: Avatar = Avatar().from_json(data)
+ self.assertEqual(self.avatar.object_type, avatar.object_type)
+ self.assertEqual(self.avatar.held_item.object_type, avatar.held_item.object_type)
+ self.assertEqual(self.avatar.held_item.value, avatar.held_item.value)
+ self.assertEqual(self.avatar.held_item.durability, avatar.held_item.durability)
+ self.assertEqual(self.avatar.position.object_type, avatar.position.object_type)
+ self.assertEqual(str(self.avatar.position), str(avatar.position))
diff --git a/game/test_suite/tests/test_avatar_inventory.py b/game/test_suite/tests/test_avatar_inventory.py
new file mode 100644
index 0000000..35ef57a
--- /dev/null
+++ b/game/test_suite/tests/test_avatar_inventory.py
@@ -0,0 +1,143 @@
+import unittest
+
+from game.common.avatar import Avatar
+from game.common.items.item import Item
+
+
+class TestAvatarInventory(unittest.TestCase):
+ """
+ `Test Avatar Inventory Notes:`
+
+ This class tests the different methods in the Avatar class related to the inventory system. This is its own
+ file since the inventory system has a lot of functionality. Look extensively at the different cases that are
+ tested to better understand how it works if there is still confusion.
+ """
+
+ def setUp(self) -> None:
+ self.avatar: Avatar = Avatar(None, 1)
+ self.item: Item = Item(10, 100, 1, 1)
+
+ # test set inventory
+ def test_avatar_set_inventory(self):
+ self.avatar.inventory = [Item(1, 1)]
+ self.assertEqual(self.avatar.inventory[0].value, Item(1, 1).value)
+
+ # fails if inventory is not a list
+ def test_avatar_set_inventory_fail_1(self):
+ value: str = 'Fail'
+ with self.assertRaises(ValueError) as e:
+ self.avatar.inventory = value
+ self.assertEqual(str(e.exception), f'Avatar.inventory must be a list of Items. It is a(n) {value.__class__.__name__} and has the value of {value}')
+
+ # fails if inventory size is greater than the max_inventory_size
+ def test_avatar_set_inventory_fail_2(self):
+ value: list = [Item(1,1), Item(4,2)]
+ with self.assertRaises(ValueError) as e:
+ self.avatar.inventory = value
+ self.assertEqual(str(e.exception), 'Avatar.inventory size must be less than or equal to '
+ f'max_inventory_size. It has the value of {len(value)}')
+
+ def test_avatar_set_max_inventory_size(self):
+ self.avatar.max_inventory_size = 10
+ self.assertEqual(str(self.avatar.max_inventory_size), str(10))
+
+ def test_avatar_set_max_inventory_size_fail(self):
+ value: str = 'Fail'
+ with self.assertRaises(ValueError) as e:
+ self.avatar.max_inventory_size = value
+ self.assertEqual(str(e.exception), f'Avatar.max_inventory_size must be an int. It is a(n) {value.__class__.__name__} and has the value of {value}')
+
+ # Tests picking up an item
+ def test_avatar_pick_up(self):
+ self.avatar.pick_up(self.item)
+ self.assertEqual(self.avatar.inventory[0], self.item)
+
+ # Tests that picking up an item successfully returns None
+ def test_avatar_pick_up_return_none(self):
+ returned: Item | None = self.avatar.pick_up(self.item)
+ self.assertEqual(returned, None)
+
+ # Tests that picking up an item of one that already exists in the inventory works
+ def test_avatar_pick_up_extra(self):
+ item1: Item = Item(10, None, 1, 3)
+ item2: Item = Item(10, None, 1, 3)
+ item3: Item = Item(10, None, 1, 3)
+ self.avatar.pick_up(item1)
+ self.avatar.pick_up(item2)
+ self.avatar.pick_up(item3)
+ self.assertEqual(self.avatar.held_item.quantity, 3)
+
+ # Tests that picking up an item that would cause a surplus doesn't cause quantity to go over stack_size
+ def test_avatar_pick_up_surplus(self):
+ item1: Item = Item(10, None, 2, 3)
+ item2: Item = Item(10, None, 1, 3)
+ item3: Item = Item(10, None, 3, 3)
+ self.avatar.pick_up(item1)
+ self.avatar.pick_up(item2)
+ surplus: Item = self.avatar.pick_up(item3)
+ self.assertEqual(self.avatar.held_item.quantity, 3)
+ self.assertEqual(surplus, item3)
+
+ # Tests when an item is being taken away
+ def test_take(self):
+ """
+ `Take method test:`
+ When this test is performed, it works properly, but because the Item class is used and is very generic, it
+ may not seem to be the case. However, it does work in the end. The first item in the inventory has its
+ quantity decrease to 2 after the take method is executed. Then, the helper method, clean_inventory,
+ consolidates all similar Items with each other. This means that inventory[1] will add its quantity to
+ inventory[0], making it have a quantity of 5; inventory[1] now has a quantity of 4 instead of 7. Then,
+ inventory[2] will add its quantity to inventory[1], making it have a quantity of 7; inventory[2] now has a
+ quantity of 7.
+
+ -----
+
+ To recap:
+ When the take method is used, it will work properly with more specific Item classes being created to
+ consolidate the same Item object types together
+
+ -----
+
+ When more subclasses of Item are created, more specific tests can be created if needed.
+ """
+
+ self.avatar: Avatar = Avatar(None, 3)
+ self.avatar.inventory = [Item(quantity=5, stack_size=5), Item(quantity=7, stack_size=7),
+ Item(quantity=10, stack_size=10)]
+ taken = self.avatar.take(Item(quantity=3, stack_size=3))
+
+ self.assertEqual(taken, None)
+ self.assertEqual(self.avatar.inventory[2].quantity, 7)
+
+ # Tests when the None value is being taken away
+ def test_take_none(self):
+ taken = self.avatar.take(None)
+ self.assertEqual(taken, None)
+
+ def test_take_fail(self):
+ self.avatar: Avatar = Avatar(None, 3)
+ self.avatar.inventory = [Item(quantity=5, stack_size=5), Item(quantity=7, stack_size=7),
+ Item(quantity=10, stack_size=10)]
+ value: str = 'wow'
+ with self.assertRaises(ValueError) as e:
+ taken = self.avatar.take(value)
+ self.assertEqual(str(e.exception), f'str.item must be an item.'
+ f' It is a(n) {value.__class__.__name__} with the value of {value}.')
+
+ # Tests picking up an item and failing
+ def test_avatar_pick_up_full_inventory(self):
+ self.avatar.pick_up(self.item)
+
+ # Pick up again to test
+ returned: Item | None = self.avatar.pick_up(self.item)
+ self.assertEqual(returned, self.item)
+
+ # Tests dropping the held item
+ def test_avatar_drop_held_item(self):
+ self.avatar.pick_up(self.item)
+ held_item = self.avatar.drop_held_item()
+ self.assertEqual(held_item, self.item)
+
+ def test_avatar_drop_held_item_none(self):
+ held_item = self.avatar.drop_held_item()
+ self.assertEqual(held_item, None)
diff --git a/game/test_suite/tests/test_example.py b/game/test_suite/tests/test_example.py
index 4d07434..381fb21 100644
--- a/game/test_suite/tests/test_example.py
+++ b/game/test_suite/tests/test_example.py
@@ -4,22 +4,32 @@
import unittest
-class TestExample(unittest.TestCase): # Your test class is a subclass of unittest.Testcase, this is important
-
- def setUp(self): # This method is used to set up anything you wish to test prior to every test method below.
- self.d = { # Here I'm just setting up a quick dictionary for example.
- "string" : "Hello World!", # Any changes made to anything built in setUp DO NOT carry over to later test methods
- "array" : [1, 2, 3, 4, 5],
- "integer" : 42,
- "bool" : False
- }
-
- def test_dict_array(self): # Test methods should always start with the word 'test'
+
+class TestExample(unittest.TestCase): # Your test class is a subclass of unittest.Testcase, this is important
+ """
+ `Test Example Notes:`
+
+ This is a mock test class to model tests after.
+ The setUp method MUST be in camel-case for every test file. Everything else can be in snake_case as normal.
+
+ The command to run tests is:
+ ``python -m game.test_suite.runner``
+ """
+
+ def setUp(self): # This method is used to set up anything you wish to test prior to every test method below.
+ self.d = { # Here I'm just setting up a quick dictionary for example.
+ "string": "Hello World!",
+ # Any changes made to anything built in setUp DO NOT carry over to later test methods
+ "array": [1, 2, 3, 4, 5],
+ "integer": 42,
+ "bool": False
+ }
+
+ def test_dict_array(self): # Test methods should always start with the word 'test'
a = self.d["array"]
- self.assertEqual(a, [1, 2, 3, 4, 5]) # The heart of a test method are assertions
- self.assertEqual(a[2], 3) # These methods take two arguments and compare them to one another
- self.assertIn(5, a) # There are loads of them, and they're all very useful
-
+ self.assertEqual(a, [1, 2, 3, 4, 5]) # The heart of a test method are assertions
+ self.assertEqual(a[2], 3) # These methods take two arguments and compare them to one another
+ self.assertIn(5, a) # There are loads of them, and they're all very useful
def test_dict_string(self):
s = self.d["string"]
@@ -29,7 +39,7 @@ def test_dict_string(self):
def test_dict_integer(self):
i = self.d["integer"]
self.assertGreater(50, i)
- self.assertAlmostEqual(i, 42.00000001) # Checks within 7 decimal points
+ self.assertAlmostEqual(i, 42.00000001) # Checks within 7 decimal points
def test_dict_bool(self):
b = self.d["bool"]
diff --git a/game/test_suite/tests/test_game_board.py b/game/test_suite/tests/test_game_board.py
new file mode 100644
index 0000000..e496b6a
--- /dev/null
+++ b/game/test_suite/tests/test_game_board.py
@@ -0,0 +1,111 @@
+import unittest
+
+from game.common.enums import ObjectType
+from game.common.avatar import Avatar
+from game.common.items.item import Item
+from game.common.stations.station import Station
+from game.common.stations.occupiable_station import OccupiableStation
+from game.common.map.tile import Tile
+from game.common.map.wall import Wall
+from game.utils.vector import Vector
+from game.common.game_object import GameObject
+from game.common.map.game_board import GameBoard
+
+
+class TestGameBoard(unittest.TestCase):
+ """
+ `Test Gameboard Notes:`
+
+ This class tests the different methods in the Gameboard class. This file is worthwhile to look at to understand
+ the GamebBoard class better if there is still confusion on it.
+
+ *This class tests the Gameboard specifically when the map is generated.*
+ """
+
+ def setUp(self) -> None:
+ self.item: Item = Item(10, None)
+ self.wall: Wall = Wall()
+ self.avatar: Avatar = Avatar(Vector(5, 5))
+ self.locations: dict[tuple[Vector]:list[GameObject]] = {
+ (Vector(1, 1),): [Station(None)],
+ (Vector(1, 2), Vector(1, 3)): [OccupiableStation(self.item), Station(None)],
+ (Vector(2, 2), Vector(2, 3)): [OccupiableStation(self.item), OccupiableStation(self.item), OccupiableStation(self.item), OccupiableStation(self.item)],
+ (Vector(3, 1), Vector(3, 2), Vector(3, 3)): [OccupiableStation(self.item), Station(None)],
+ (Vector(5, 5),): [self.avatar],
+ (Vector(5, 6),): [self.wall]
+ }
+ self.game_board: GameBoard = GameBoard(1, Vector(10, 10), self.locations, False)
+ self.game_board.generate_map()
+
+ # test that seed cannot be set after generate_map
+ def test_seed_fail(self):
+ with self.assertRaises(RuntimeError) as e:
+ self.game_board.seed = 20
+ self.assertEqual(str(e.exception), 'GameBoard variables cannot be changed once generate_map is run.')
+
+ # test that map_size cannot be set after generate_map
+ def test_map_size_fail(self):
+ with self.assertRaises(RuntimeError) as e:
+ self.game_board.map_size = Vector(1, 1)
+ self.assertEqual(str(e.exception), 'GameBoard variables cannot be changed once generate_map is run.')
+
+ # test that locations cannot be set after generate_map
+ def test_locations_fail(self):
+ with self.assertRaises(RuntimeError) as e:
+ self.game_board.locations = self.locations
+ self.assertEqual(str(e.exception), 'GameBoard variables cannot be changed once generate_map is run.')
+
+ # test that locations raises RuntimeError even with incorrect data type
+ def test_locations_incorrect_fail(self):
+ with self.assertRaises(RuntimeError) as e:
+ self.game_board.locations = Vector(1, 1)
+ self.assertEqual(str(e.exception), 'GameBoard variables cannot be changed once generate_map is run.')
+
+ # test that walled cannot be set after generate_map
+ def test_walled_fail(self):
+ with self.assertRaises(RuntimeError) as e:
+ self.game_board.walled = False
+ self.assertEqual(str(e.exception), 'GameBoard variables cannot be changed once generate_map is run.')
+
+ # test that get_objects works correctly with stations
+ def test_get_objects_station(self):
+ stations: list[tuple[Vector, list[Station]]] = self.game_board.get_objects(ObjectType.STATION)
+ self.assertTrue(all(map(lambda station: isinstance(station[1][0], Station), stations)))
+ self.assertEqual(len(stations), 3)
+
+ # test that get_objects works correctly with occupiable stations
+ def test_get_objects_occupiable_station(self):
+ occupiable_stations: list[tuple[Vector, list[OccupiableStation]]] = self.game_board.get_objects(ObjectType.OCCUPIABLE_STATION)
+ self.assertTrue(
+ all(map(lambda occupiable_station: isinstance(occupiable_station[1][0], OccupiableStation), occupiable_stations)))
+ objects_stacked = [x[1] for x in occupiable_stations]
+ objects_unstacked = [x for xs in objects_stacked for x in xs]
+ self.assertEqual(len(objects_unstacked), 6)
+
+ def test_get_objects_occupiable_station_2(self):
+ occupiable_stations: list[tuple[Vector, list[OccupiableStation]]] = self.game_board.get_objects(ObjectType.OCCUPIABLE_STATION)
+ self.assertTrue(any(map(lambda vec_list: len(vec_list[1]) == 3, occupiable_stations)))
+ objects_stacked = [x[1] for x in occupiable_stations]
+ objects_unstacked = [x for xs in objects_stacked for x in xs]
+ self.assertEqual(len(objects_unstacked), 6)
+
+ # test that get_objects works correctly with avatar
+ def test_get_objects_avatar(self):
+ avatars: list[tuple[Vector, list[Avatar]]] = self.game_board.get_objects(ObjectType.AVATAR)
+ self.assertTrue(all(map(lambda avatar: isinstance(avatar[1][0], Avatar), avatars)))
+ self.assertEqual(len(avatars), 1)
+
+ # test that get_objects works correctly with walls
+ def test_get_objects_wall(self):
+ walls: list[tuple[Vector, list[Wall]]] = self.game_board.get_objects(ObjectType.WALL)
+ self.assertTrue(all(map(lambda wall: isinstance(wall[1][0], Wall), walls)))
+ self.assertEqual(len(walls), 1)
+
+ # test json method
+ def test_game_board_json(self):
+ data: dict = self.game_board.to_json()
+ temp: GameBoard = GameBoard().from_json(data)
+ for (k, v), (x, y) in zip(self.locations.items(), temp.locations.items()):
+ for (i, j), (a, b) in zip(zip(k, v), zip(x, y)):
+ self.assertEqual(i.object_type, a.object_type)
+ self.assertEqual(j.object_type, b.object_type)
diff --git a/game/test_suite/tests/test_game_board_no_gen.py b/game/test_suite/tests/test_game_board_no_gen.py
new file mode 100644
index 0000000..7d9d6cd
--- /dev/null
+++ b/game/test_suite/tests/test_game_board_no_gen.py
@@ -0,0 +1,113 @@
+import unittest
+
+from game.common.enums import ObjectType
+from game.common.avatar import Avatar
+from game.common.items.item import Item
+from game.common.stations.station import Station
+from game.common.stations.occupiable_station import OccupiableStation
+from game.common.map.tile import Tile
+from game.common.map.wall import Wall
+from game.utils.vector import Vector
+from game.common.game_object import GameObject
+from game.common.map.game_board import GameBoard
+
+
+class TestGameBoard(unittest.TestCase):
+ """
+ `Test Gameboard Without Generation Notes:`
+
+ This class tests the different methods in the Gameboard class when the map is *not* generated.
+ """
+ """
+ `Test Avatar Notes:`
+
+ This class tests the different methods in the Avatar class.
+ """
+
+ def setUp(self) -> None:
+ self.item: Item = Item(10, None)
+ self.wall: Wall = Wall()
+ self.avatar: Avatar = Avatar(Vector(5, 5))
+ self.locations: dict[tuple[Vector]:list[GameObject]] = {
+ (Vector(1, 1),): [Station(None)],
+ (Vector(1, 2), Vector(1, 3)): [OccupiableStation(self.item), Station(None)],
+ (Vector(5, 5),): [self.avatar],
+ (Vector(5, 6),): [self.wall]
+ }
+ self.game_board: GameBoard = GameBoard(1, Vector(10, 10), self.locations, False)
+
+ # test seed
+ def test_seed(self):
+ self.game_board.seed = 2
+ self.assertEqual(self.game_board.seed, 2)
+
+ def test_seed_fail(self):
+ value: str = 'False'
+ with self.assertRaises(ValueError) as e:
+ self.game_board.seed = value
+ self.assertEqual(str(e.exception),
+ f'GameBoard.seed must be an int. '
+ f'It is a(n) {value.__class__.__name__} with the value of {value}.')
+
+ # test map_size
+ def test_map_size(self):
+ self.game_board.map_size = Vector(12, 12)
+ self.assertEqual(str(self.game_board.map_size), str(Vector(12, 12)))
+
+ def test_map_size_fail(self):
+ value: str = 'wow'
+ with self.assertRaises(ValueError) as e:
+ self.game_board.map_size = value
+ self.assertEqual(str(e.exception),
+ f'GameBoard.map_size must be a Vector.'
+ f' It is a(n) {value.__class__.__name__} with the value of {value}.')
+
+ # test locations
+ def test_locations(self):
+ self.locations = {
+ (Vector(1, 1),): [self.avatar],
+ (Vector(1, 2), Vector(1, 3)): [OccupiableStation(self.item), Station(None)],
+ (Vector(5, 5),): [Station(None)],
+ (Vector(5, 6),): [self.wall]
+ }
+ self.game_board.locations = self.locations
+ self.assertEqual(str(self.game_board.locations), str(self.locations))
+
+ def test_locations_fail_type(self):
+ value: str = 'wow'
+ with self.assertRaises(ValueError) as e:
+ self.game_board.locations = value
+ self.assertEqual(str(e.exception),
+ f'Locations must be a dict. The key must be a tuple of Vector Objects,'
+ f' and the value a list of GameObject. '
+ f'It is a(n) {value.__class__.__name__} with the value of {value}.')
+
+ # test walled
+ def test_walled(self):
+ self.game_board.walled = True
+ self.assertEqual(self.game_board.walled, True)
+
+ def test_walled_fail(self):
+ value: str = 'wow'
+ with self.assertRaises(ValueError) as e:
+ self.game_board.walled = value
+ self.assertEqual(str(e.exception),
+ f'GameBoard.walled must be a bool.'
+ f' It is a(n) {value.__class__.__name__} with the value of {value}.')
+
+ # test json method
+ def test_game_board_json(self):
+ data: dict = self.game_board.to_json()
+ temp: GameBoard = GameBoard().from_json(data)
+ for (k, v), (x, y) in zip(self.locations.items(), temp.locations.items()):
+ for (i, j), (a, b) in zip(zip(k, v), zip(x, y)):
+ self.assertEqual(i.object_type, a.object_type)
+ self.assertEqual(j.object_type, b.object_type)
+
+ def test_generate_map(self):
+ self.game_board.generate_map()
+ self.assertEqual(self.game_board.game_map[1][1].occupied_by.object_type, ObjectType.STATION)
+ self.assertEqual(self.game_board.game_map[2][1].occupied_by.object_type, ObjectType.OCCUPIABLE_STATION)
+ self.assertEqual(self.game_board.game_map[3][1].occupied_by.object_type, ObjectType.STATION)
+ self.assertEqual(self.game_board.game_map[5][5].occupied_by.object_type, ObjectType.AVATAR)
+ self.assertEqual(self.game_board.game_map[6][5].occupied_by.object_type, ObjectType.WALL)
diff --git a/game/test_suite/tests/test_initialization.py b/game/test_suite/tests/test_initialization.py
new file mode 100644
index 0000000..d36ae95
--- /dev/null
+++ b/game/test_suite/tests/test_initialization.py
@@ -0,0 +1,38 @@
+import unittest
+
+from game.common.enums import ObjectType
+from game.common.avatar import Avatar
+from game.common.items.item import Item
+from game.common.stations.station import Station
+from game.common.stations.occupiable_station import OccupiableStation
+from game.common.map.tile import Tile
+from game.common.map.wall import Wall
+from game.utils.vector import Vector
+
+
+class TestInitialization(unittest.TestCase):
+ """
+ `Test Avatar Notes:`
+
+ This class tests the instantiation of different Objects within the project. Recall that every new class created
+ needs a respective ObjectType enum created for it.
+ """
+
+ def setUp(self) -> None:
+ self.item: Item = Item(10, 100)
+ self.avatar: Avatar = Avatar(None)
+ self.station: Station = Station(None)
+ self.occupiable_station: OccupiableStation = OccupiableStation(None, None)
+ self.tile: Tile = Tile(None)
+ self.wall: Wall = Wall()
+ self.vector: Vector = Vector()
+
+ # tests that all objects have the correct ObjectType
+ def test_object_init(self):
+ self.assertEqual(self.item.object_type, ObjectType.ITEM)
+ self.assertEqual(self.avatar.object_type, ObjectType.AVATAR)
+ self.assertEqual(self.station.object_type, ObjectType.STATION)
+ self.assertEqual(self.occupiable_station.object_type, ObjectType.OCCUPIABLE_STATION)
+ self.assertEqual(self.tile.object_type, ObjectType.TILE)
+ self.assertEqual(self.wall.object_type, ObjectType.WALL)
+ self.assertEqual(self.vector.object_type, ObjectType.VECTOR)
diff --git a/game/test_suite/tests/test_interact_controller.py b/game/test_suite/tests/test_interact_controller.py
new file mode 100644
index 0000000..3e8dc2f
--- /dev/null
+++ b/game/test_suite/tests/test_interact_controller.py
@@ -0,0 +1,67 @@
+import unittest
+
+from game.common.avatar import Avatar
+from game.common.items.item import Item
+from game.controllers.interact_controller import InteractController
+from game.common.map.game_board import GameBoard
+from game.utils.vector import Vector
+from game.common.map.wall import Wall
+from game.common.stations.station import Station
+from game.common.stations.station_example import StationExample
+from game.common.stations.station_receiver_example import StationReceiverExample
+from game.common.stations.occupiable_station import OccupiableStation
+from game.common.stations.occupiable_station_example import OccupiableStationExample
+from game.common.game_object import GameObject
+from game.common.action import ActionType
+from game.common.player import Player
+from game.common.enums import ObjectType
+
+
+class TestInteractController(unittest.TestCase):
+ """
+ `Test Avatar Notes:`
+
+ This class tests the different methods in the InteractController class.
+ """
+
+ def setUp(self) -> None:
+ self.interact_controller: InteractController = InteractController()
+ self.item: Item = Item(10, None)
+ self.wall: Wall = Wall()
+ self.occupiable_station: OccupiableStation = OccupiableStation(self.item)
+ self.station_example: StationExample = StationExample(self.item)
+ self.occupiable_station_example = OccupiableStationExample(self.item)
+ self.avatar: Avatar = Avatar(Vector(5, 5))
+ self.locations: dict[tuple[Vector]:list[GameObject]] = {
+ (Vector(1, 1),): [Station(None)],
+ (Vector(5, 4),): [self.occupiable_station_example],
+ (Vector(6, 5),): [self.station_example],
+ (Vector(4, 5),): [StationReceiverExample()],
+ (Vector(5, 5),): [self.avatar],
+ (Vector(5, 6),): [self.wall]
+ }
+ self.game_board: GameBoard = GameBoard(1, Vector(10, 10), self.locations, False)
+ self.player: Player = Player(None, None, [], self.avatar)
+ self.game_board.generate_map()
+
+ # interact and pick up nothing
+ def test_interact_nothing(self):
+ self.interact_controller.handle_actions(ActionType.INTERACT_DOWN, self.player, self.game_board)
+ self.assertEqual(self.avatar.held_item, None)
+
+ # interact and pick up from an occupiable_station
+ def test_interact_item_occupiable_station(self):
+ self.interact_controller.handle_actions(ActionType.INTERACT_UP, self.player, self.game_board)
+ self.assertEqual(self.avatar.inventory[0].object_type, ObjectType.ITEM)
+
+ # interact and pick up from a station
+ def test_interact_item_station(self):
+ self.interact_controller.handle_actions(ActionType.INTERACT_RIGHT, self.player, self.game_board)
+ self.assertEqual(self.avatar.inventory[0].object_type, ObjectType.ITEM)
+
+ # interact and get item then dump item
+ def test_interact_dump_item(self):
+ self.interact_controller.handle_actions(ActionType.INTERACT_RIGHT, self.player, self.game_board)
+ self.assertEqual(self.avatar.held_item, self.item)
+ self.interact_controller.handle_actions(ActionType.INTERACT_LEFT, self.player, self.game_board)
+ self.assertTrue(all(map(lambda x: x is None, self.avatar.inventory)))
diff --git a/game/test_suite/tests/test_inventory_controller.py b/game/test_suite/tests/test_inventory_controller.py
new file mode 100644
index 0000000..5d8f26e
--- /dev/null
+++ b/game/test_suite/tests/test_inventory_controller.py
@@ -0,0 +1,110 @@
+import unittest
+
+from game.common.enums import *
+from game.common.avatar import Avatar
+from game.common.player import Player
+from game.common.items.item import Item
+from game.controllers.inventory_controller import InventoryController
+from game.common.map.game_board import GameBoard
+
+
+class TestInventoryController(unittest.TestCase):
+ """
+ `Test Inventory Controller Notes:`
+
+ This class tests the different methods in the Avatar class' inventory.
+ """
+
+ def setUp(self) -> None:
+ self.inventory_controller: InventoryController = InventoryController()
+ self.item: Item = Item()
+ self.avatar: Avatar = Avatar(max_inventory_size=10)
+
+ self.inventory: [Item] = [Item(1), Item(2), Item(3), Item(4), Item(5), Item(6), Item(7), Item(8),
+ Item(9), Item(10)]
+
+ self.avatar.inventory = self.inventory
+ self.player: Player = Player(avatar=self.avatar)
+ self.game_board: GameBoard = GameBoard()
+
+ # Testing accessing the right Item with the controller
+ def test_select_slot_0(self):
+ self.inventory_controller.handle_actions(ActionType.SELECT_SLOT_0, self.player, self.game_board)
+ self.assertEqual(self.avatar.held_item, self.inventory[0])
+ self.check_inventory_item()
+
+ def test_select_slot_1(self):
+ self.inventory_controller.handle_actions(ActionType.SELECT_SLOT_1, self.player, self.game_board)
+ self.assertEqual(self.avatar.held_item, self.inventory[1])
+ self.check_inventory_item()
+
+ def test_select_slot_2(self):
+ self.inventory_controller.handle_actions(ActionType.SELECT_SLOT_2, self.player, self.game_board)
+ self.assertEqual(self.avatar.held_item, self.inventory[2])
+ self.check_inventory_item()
+
+ def test_select_slot_3(self):
+ self.inventory_controller.handle_actions(ActionType.SELECT_SLOT_3, self.player, self.game_board)
+ self.assertEqual(self.avatar.held_item, self.inventory[3])
+ self.check_inventory_item()
+
+ def test_select_slot_4(self):
+ self.inventory_controller.handle_actions(ActionType.SELECT_SLOT_4, self.player, self.game_board)
+ self.assertEqual(self.avatar.held_item, self.inventory[4])
+ self.check_inventory_item()
+
+ def test_select_slot_5(self):
+ self.inventory_controller.handle_actions(ActionType.SELECT_SLOT_5, self.player, self.game_board)
+ self.assertEqual(self.avatar.held_item, self.inventory[5])
+ self.check_inventory_item()
+
+ def test_select_slot_6(self):
+ self.inventory_controller.handle_actions(ActionType.SELECT_SLOT_6, self.player, self.game_board)
+ self.assertEqual(self.avatar.held_item, self.inventory[6])
+ self.check_inventory_item()
+
+ def test_select_slot_7(self):
+ self.inventory_controller.handle_actions(ActionType.SELECT_SLOT_7, self.player, self.game_board)
+ self.assertEqual(self.avatar.held_item, self.inventory[7])
+ self.check_inventory_item()
+
+ def test_select_slot_8(self):
+ self.inventory_controller.handle_actions(ActionType.SELECT_SLOT_8, self.player, self.game_board)
+ self.assertEqual(self.avatar.held_item, self.inventory[8])
+ self.check_inventory_item()
+
+ def test_select_slot_9(self):
+ self.inventory_controller.handle_actions(ActionType.SELECT_SLOT_9, self.player, self.game_board)
+ self.assertEqual(self.avatar.held_item, self.inventory[9])
+ self.check_inventory_item()
+
+ # Testing using the inventory controller with the wrong ActionType
+ def test_with_wrong_action_type(self):
+ self.inventory_controller.handle_actions(ActionType.MOVE_LEFT, self.player, self.game_board)
+ self.assertEqual(self.avatar.held_item, self.avatar.inventory[0])
+ self.check_inventory_item()
+
+ # Tests accessing a slot of the inventory given an enum that's out of bounds
+ def test_with_out_of_bounds(self):
+ with self.assertRaises(IndexError) as e:
+ self.inventory: [Item] = [Item(1), Item(2), Item(3), Item(4), Item(5)]
+ self.avatar.max_inventory_size = 5
+ self.avatar.inventory = self.inventory
+ self.player: Player = Player(avatar=self.avatar)
+ self.inventory_controller.handle_actions(ActionType.SELECT_SLOT_9, self.player, self.game_board)
+ self.assertEqual(str(e.exception), 'The given action type, SELECT_SLOT_9, is not within bounds of the given '
+ 'inventory of size 5. Select an ActionType enum '
+ 'that will be within the inventory\'s bounds.')
+
+ def check_inventory_item(self):
+ # Test to make sure that the inventory hasn't shifted items
+ self.assertEqual(self.avatar.inventory[0].value, 1)
+ self.assertEqual(self.avatar.inventory[1].value, 2)
+ self.assertEqual(self.avatar.inventory[2].value, 3)
+ self.assertEqual(self.avatar.inventory[3].value, 4)
+ self.assertEqual(self.avatar.inventory[4].value, 5)
+ self.assertEqual(self.avatar.inventory[5].value, 6)
+ self.assertEqual(self.avatar.inventory[6].value, 7)
+ self.assertEqual(self.avatar.inventory[7].value, 8)
+ self.assertEqual(self.avatar.inventory[8].value, 9)
+ self.assertEqual(self.avatar.inventory[9].value, 10)
diff --git a/game/test_suite/tests/test_item.py b/game/test_suite/tests/test_item.py
new file mode 100644
index 0000000..659bdd3
--- /dev/null
+++ b/game/test_suite/tests/test_item.py
@@ -0,0 +1,133 @@
+import unittest
+
+from game.common.avatar import Avatar
+from game.common.items.item import Item
+from game.common.enums import ObjectType
+
+
+class TestItem(unittest.TestCase):
+ """
+ `Test Item Notes:`
+
+ This class tests the different methods in the Item class.
+ """
+
+ def setUp(self) -> None:
+ self.avatar: Avatar = Avatar(None, 1)
+ self.item: Item = Item()
+
+ # test set durability
+ def test_set_durability(self):
+ self.item.durability = 10
+ self.assertEqual(self.item.durability, 10)
+
+ def test_set_durability_none(self):
+ self.item.durability = None
+ self.assertEqual(self.item.durability, None)
+
+ def test_set_durability_fail(self):
+ value: str = 'fail'
+ with self.assertRaises(ValueError) as e:
+ self.item.durability = value
+ self.assertEqual(str(e.exception), f'Item.durability must be an int. It is a(n) {value.__class__.__name__} with the value of {value}.')
+
+ def test_set_durability_stack_size_fail(self):
+ value: list = Item(10,None,10,10)
+ value2: int = 10
+ with self.assertRaises(ValueError) as e:
+ self.item = value
+ self.item.durability = value2
+ self.assertEqual(str(e.exception), f'Item.durability must be set to None if stack_size is not equal to 1.'
+ f' {value.__class__.__name__}.'
+ f'durability has the value of {value2}.')
+
+ # test set value
+ def test_set_value(self):
+ self.item.value = 10
+ self.assertEqual(self.item.value, 10)
+
+ def test_set_value_fail(self):
+ value: str = 'fail'
+ with self.assertRaises(ValueError) as e:
+ self.item.value = value
+ self.assertEqual(str(e.exception), f'Item.value must be an int.'
+ f' It is a(n) {value.__class__.__name__} with the value of {value}.')
+
+ # test set quantity
+ def test_set_quantity(self):
+ self.item = Item(10, None, 10, 10)
+ self.item.quantity = 5
+ self.assertEqual(self.item.quantity, 5)
+
+ def test_set_quantity_fail(self):
+ value: str = 'fail'
+ with self.assertRaises(ValueError) as e:
+ self.item.quantity = value
+ self.assertEqual(str(e.exception), f'Item.quantity must be an int.'
+ f' It is a(n) {value.__class__.__name__} with the value of {value}.')
+
+ def test_set_quantity_fail_greater_than_0(self):
+ value: Item = -1
+ with self.assertRaises(ValueError) as e:
+ self.item.quantity = value
+ self.assertEqual(str(e.exception), f'Item.quantity must be greater than or '
+ f'equal to 0. {self.item.__class__.__name__}.quantity '
+ f'has the value of {value}.')
+
+ def test_set_quantity_fail_stack_size(self):
+ value: Item = 10
+ value2: Item = 1
+ with self.assertRaises(ValueError) as e:
+ self.item.quantity = value
+ self.item.stack_size = value2
+ self.assertEqual(str(e.exception), f'Item.quantity cannot be greater than '
+ f'{self.item.__class__.__name__}.stack_size. {self.item.__class__.__name__}.quantity has the value of {value}.')
+
+ def test_stack_size(self):
+ self.item = Item(10, None, 10, 10)
+ self.assertEqual(self.item.quantity, 10)
+
+ def test_stack_size_fail(self):
+ value: str = 'fail'
+ with self.assertRaises(ValueError) as e:
+ self.item.stack_size = value
+ self.assertEqual(str(e.exception), f'Item.stack_size must be an int.'
+ f' It is a(n) {value.__class__.__name__} with the value of {value}.')
+
+ def test_stack_size_fail_quantity(self):
+ # value, durability, quantity, stack size
+ value: Item = 5
+ with self.assertRaises(ValueError) as e:
+ item: Item = Item(10, None, 10, 10)
+ item.stack_size = value
+ self.assertEqual(str(e.exception), f'Item.stack_size must be greater than or equal to the quantity.'
+ f' {self.item.__class__.__name__}.stack_size has the value of {value}.')
+
+ def test_pick_up(self):
+ # value, durability, quantity, stack size
+ item: Item = Item(10, None, 2, 10)
+ self.item = Item(10, None, 1, 10)
+ self.item.pick_up(item)
+ self.assertEqual(self.item.quantity, 3)
+
+ def test_pick_up_wrong_object_type(self):
+ item: Item = Item(10, 10, 1, 1)
+ item.object_type = ObjectType.PLAYER
+ self.item = Item(10, 10, 1, 1)
+ self.item = self.item.pick_up(item)
+ self.assertEqual(self.item.object_type, item.object_type)
+
+ def test_pick_up_surplus(self):
+ item: Item = Item(10, None, 10, 10)
+ self.item = Item(10, None, 9, 10)
+ surplus: Item = self.item.pick_up(item)
+ self.assertEqual(surplus.quantity, 9)
+
+ def test_item_json(self):
+ data: dict = self.item.to_json()
+ item: Item = Item().from_json(data)
+ self.assertEqual(self.item.object_type, item.object_type)
+ self.assertEqual(self.item.value, item.value)
+ self.assertEqual(self.item.stack_size, item.stack_size)
+ self.assertEqual(self.item.durability, item.durability)
+ self.assertEqual(self.item.quantity, item.quantity)
diff --git a/game/test_suite/tests/test_master_controller.py b/game/test_suite/tests/test_master_controller.py
new file mode 100644
index 0000000..2795335
--- /dev/null
+++ b/game/test_suite/tests/test_master_controller.py
@@ -0,0 +1,18 @@
+import unittest
+
+from game.controllers.master_controller import MasterController
+from game.controllers.movement_controller import MovementController
+from game.controllers.interact_controller import InteractController
+
+
+class TestMasterController(unittest.TestCase):
+ """
+ `Test Master Controller Notes:`
+
+ Add tests to this class to tests any new functionality added to the Master Controller.
+ """
+
+ def setUp(self) -> None:
+ self.master_controller = MasterController()
+
+
diff --git a/game/test_suite/tests/test_movement_controller.py b/game/test_suite/tests/test_movement_controller.py
new file mode 100644
index 0000000..01d682d
--- /dev/null
+++ b/game/test_suite/tests/test_movement_controller.py
@@ -0,0 +1,49 @@
+import unittest
+
+from game.common.map.game_board import GameBoard
+from game.controllers.movement_controller import MovementController
+from game.common.stations.station import Station
+from game.common.stations.occupiable_station import OccupiableStation
+from game.common.map.wall import Wall
+from game.utils.vector import Vector
+from game.common.player import Player
+from game.common.action import ActionType
+from game.common.avatar import Avatar
+from game.common.game_object import GameObject
+
+
+class TestMovementControllerIfWall(unittest.TestCase):
+ """
+ `Test Movement Controller if Wall Notes:`
+
+ This class tests the Movement Controller *specifically* for when there are walls -- or other impassable
+ objects -- near the Avatar.
+ """
+
+ def setUp(self) -> None:
+ self.movement_controller = MovementController()
+ self.avatar = Avatar(Vector(2, 2), 1)
+ self.locations: dict[tuple[Vector]: list[GameObject]] = {
+ (Vector(2, 2),): [self.avatar]
+ }
+ self.game_board = GameBoard(0, Vector(4, 4), self.locations, False)
+ # test movements up, down, left and right by starting with default 3,3 then know if it changes from there \/
+ self.client = Player(None, None, [], self.avatar)
+ self.game_board.generate_map()
+
+ # if there is a wall
+ def test_move_up(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_UP, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(2, 1)))
+
+ def test_move_down(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_DOWN, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(2, 3)))
+
+ def test_move_left(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_LEFT, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(1, 2)))
+
+ def test_move_right(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_RIGHT, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(3, 2)))
diff --git a/game/test_suite/tests/test_movement_controller_if_occupiable_station_is_occupiable.py b/game/test_suite/tests/test_movement_controller_if_occupiable_station_is_occupiable.py
new file mode 100644
index 0000000..56a2637
--- /dev/null
+++ b/game/test_suite/tests/test_movement_controller_if_occupiable_station_is_occupiable.py
@@ -0,0 +1,58 @@
+import unittest
+
+from game.common.action import ActionType
+from game.common.avatar import Avatar
+from game.common.map.game_board import GameBoard
+from game.common.map.wall import Wall
+from game.common.player import Player
+from game.common.stations.occupiable_station import OccupiableStation
+from game.controllers.movement_controller import MovementController
+from game.utils.vector import Vector
+from game.common.stations.station import Station
+
+
+class TestMovementControllerIfOccupiableStationIsOccupiable(unittest.TestCase):
+ """
+ `Test Movement Controller if Occupiable Stations are Occupiable Notes:`
+
+ This class tests the different methods in the Movement Controller class and the Avatar moving onto Occupiable
+ Stations so that the Avatar can occupy it.
+ """
+
+ def setUp(self) -> None:
+ self.movement_controller = MovementController()
+
+ # (1, 0), (2, 0), (0, 1), (0, 2), (1, 3), (2, 3), (3, 1), (3, 2)
+ self.locations: dict = {
+ (Vector(1, 0), Vector(2, 0), Vector(0, 1), Vector(0, 2)): [OccupiableStation(None, None),
+ OccupiableStation(None, None),
+ OccupiableStation(None, None),
+ OccupiableStation(None, None)]}
+ self.game_board = GameBoard(0, Vector(3, 3), self.locations, False)
+ self.occ_station = OccupiableStation()
+ self.occ_station = OccupiableStation()
+ # self.wall = Wall()
+ # test movements up, down, left and right by starting with default 3,3 then know if it changes from there \/
+ self.avatar = Avatar(None, Vector(1, 1), [], 1)
+ self.client = Player(None, None, [], self.avatar)
+ self.game_board.generate_map()
+
+
+def test_move_up(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_UP, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(1, 0)))
+
+
+def test_move_down(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_DOWN, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(1, 2)))
+
+
+def test_move_left(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_LEFT, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(0, 1)))
+
+
+def test_move_right(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_RIGHT, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(2, 1)))
diff --git a/game/test_suite/tests/test_movement_controller_if_occupiable_stations.py b/game/test_suite/tests/test_movement_controller_if_occupiable_stations.py
new file mode 100644
index 0000000..e1cb4be
--- /dev/null
+++ b/game/test_suite/tests/test_movement_controller_if_occupiable_stations.py
@@ -0,0 +1,88 @@
+import unittest
+
+from game.common.action import ActionType
+from game.common.avatar import Avatar
+from game.common.map.game_board import GameBoard
+from game.common.map.wall import Wall
+from game.common.player import Player
+from game.common.stations.occupiable_station import OccupiableStation
+from game.controllers.movement_controller import MovementController
+from game.utils.vector import Vector
+from game.common.stations.station import Station
+
+
+class TestMovementControllerIfOccupiableStations(unittest.TestCase):
+ """
+ `Test Movement Controller with Occupiable Stations that are Occupied Notes:`
+
+ This class tests the different methods in the Movement Controller and that the Avatar can't move onto an
+ Occupiable Station that is occupied by an unoccupiable object (e.g., a Wall or Station object).
+ """
+
+ def setUp(self) -> None:
+ self.movement_controller = MovementController()
+
+ # (1, 0), (2, 0), (0, 1), (0, 2), (1, 3), (2, 3), (3, 1), (3, 2)
+ self.locations: dict = {(Vector(1, 0), Vector(2, 0), Vector(0, 1), Vector(0, 2), Vector(1, 3), Vector(2, 3),
+ Vector(3, 1), Vector(3, 2)): [OccupiableStation(None, Wall()),
+ OccupiableStation(None, Wall()),
+ OccupiableStation(None, Wall()),
+ OccupiableStation(None, Wall()),
+ OccupiableStation(None, Wall()),
+ OccupiableStation(None, Wall()),
+ OccupiableStation(None, Wall()),
+ OccupiableStation(None, Station())]}
+ self.game_board = GameBoard(0, Vector(4, 4), self.locations, False)
+ self.occ_station = OccupiableStation()
+ self.occ_station = OccupiableStation()
+ # self.wall = Wall()
+ # test movements up, down, left and right by starting with default 3,3 then know if it changes from there \/
+ self.avatar = Avatar(None, Vector(2, 2), [], 1)
+ self.client = Player(None, None, [], self.avatar)
+ self.game_board.generate_map()
+
+ # it is not occupied, so you can move there
+
+
+def test_move_up(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_UP, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(2, 1)))
+
+
+def test_move_up_fail(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_UP, self.client, self.game_board)
+ self.movement_controller.handle_actions(ActionType.MOVE_UP, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(2, 1)))
+
+
+def test_move_down(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_UP, self.client, self.game_board)
+ self.movement_controller.handle_actions(ActionType.MOVE_DOWN, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(2, 2)))
+
+
+def test_move_down_fail(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_DOWN, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(2, 2)))
+
+
+def test_move_left(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_LEFT, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(1, 2)))
+
+
+def test_move_left_fail(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_LEFT, self.client, self.game_board)
+ self.movement_controller.handle_actions(ActionType.MOVE_LEFT, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(1, 2)))
+
+
+def test_move_right(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_LEFT, self.client, self.game_board)
+ self.movement_controller.handle_actions(ActionType.MOVE_RIGHT, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(2, 2)))
+
+
+def test_move_right_fail(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_RIGHT, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(2, 2)))
diff --git a/game/test_suite/tests/test_movement_controller_if_stations.py b/game/test_suite/tests/test_movement_controller_if_stations.py
new file mode 100644
index 0000000..5b3fb1f
--- /dev/null
+++ b/game/test_suite/tests/test_movement_controller_if_stations.py
@@ -0,0 +1,67 @@
+import unittest
+
+from game.controllers.movement_controller import MovementController
+from game.common.map.game_board import GameBoard
+from game.common.stations.station import Station
+from game.common.stations.occupiable_station import OccupiableStation
+from game.common.map.wall import Wall
+from game.utils.vector import Vector
+from game.common.player import Player
+from game.common.avatar import Avatar
+from game.common.action import ActionType
+from game.common.game_object import GameObject
+
+
+class TestMovementControllerIfStations(unittest.TestCase):
+ """
+ `Test Movement Controller with Stations Notes:`
+
+ This class tests the different methods in the Movement Controller and that the Avatar can't move onto a Station
+ object (an example of an impassable object).
+ """
+
+ def setUp(self) -> None:
+ self.movement_controller = MovementController()
+ # (1, 0), (2, 0), (0, 1), (0, 2), (1, 3), (2, 3), (3, 1), (3, 2)
+ self.locations: dict = {(Vector(1, 0), Vector(2, 0), Vector(0, 1), Vector(0, 2), Vector(1, 3), Vector(2, 3),
+ Vector(3, 1), Vector(3, 2)): [Station(None), Station(None), Station(None),
+ Station(None), Station(None), Station(None),
+ Station(None), Station(None)]}
+ self.game_board = GameBoard(0, Vector(4, 4), self.locations, False)
+ # test movements up, down, left and right by starting with default 3,3 then know if it changes from there \/
+ self.avatar = Avatar(Vector(2, 2), 1)
+ self.client = Player(None, None, [], self.avatar)
+ self.game_board.generate_map()
+
+ # if there is a station
+ def test_move_up_fail(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_UP, self.client, self.game_board)
+ self.movement_controller.handle_actions(ActionType.MOVE_UP, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(2, 1)))
+
+ def test_move_down(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_UP, self.client, self.game_board)
+ self.movement_controller.handle_actions(ActionType.MOVE_DOWN, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(2, 2)))
+
+ def test_move_down_fail(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_DOWN, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(2, 2)))
+
+ def test_move_left(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_LEFT, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(1, 2)))
+
+ def test_move_left_fail(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_LEFT, self.client, self.game_board)
+ self.movement_controller.handle_actions(ActionType.MOVE_LEFT, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(1, 2)))
+
+ def test_move_right(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_LEFT, self.client, self.game_board)
+ self.movement_controller.handle_actions(ActionType.MOVE_RIGHT, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(2, 2)))
+
+ def test_move_right_fail(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_RIGHT, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(2, 2)))
diff --git a/game/test_suite/tests/test_movement_controller_if_wall.py b/game/test_suite/tests/test_movement_controller_if_wall.py
new file mode 100644
index 0000000..4cf3c7b
--- /dev/null
+++ b/game/test_suite/tests/test_movement_controller_if_wall.py
@@ -0,0 +1,72 @@
+import unittest
+
+from game.common.map.game_board import GameBoard
+from game.controllers.movement_controller import MovementController
+from game.common.stations.station import Station
+from game.common.stations.occupiable_station import OccupiableStation
+from game.common.map.wall import Wall
+from game.utils.vector import Vector
+from game.common.player import Player
+from game.common.action import ActionType
+from game.common.avatar import Avatar
+from game.common.game_object import GameObject
+
+
+class TestMovementControllerIfWall(unittest.TestCase):
+ """
+ `Test Movement Controller with Stations Notes:`
+
+ This class tests the different methods in the Movement Controller and that the Avatar can't pass Wall objects.
+ """
+
+ def setUp(self) -> None:
+ self.movement_controller = MovementController()
+ self.avatar = Avatar(Vector(2, 2), 1)
+ self.locations: dict[tuple[Vector]: list[GameObject]] = {
+ (Vector(2, 2),): [self.avatar]
+ }
+ self.game_board = GameBoard(0, Vector(4, 4), self.locations, True)
+ self.station = Station()
+ self.occupiable_station = OccupiableStation()
+ self.occupiable_station = OccupiableStation()
+ self.wall = Wall()
+ # test movements up, down, left and right by starting with default 3,3 then know if it changes from there \/
+ self.client = Player(None, None, [], self.avatar)
+ self.game_board.generate_map()
+
+ # if there is a wall
+ def test_move_up(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_UP, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(2, 1)))
+
+ def test_move_up_fail(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_UP, self.client, self.game_board)
+ self.movement_controller.handle_actions(ActionType.MOVE_UP, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(2, 1)))
+
+ def test_move_down(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_UP, self.client, self.game_board)
+ self.movement_controller.handle_actions(ActionType.MOVE_DOWN, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(2, 2)))
+
+ def test_move_down_fail(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_DOWN, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(2, 2)))
+
+ def test_move_left(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_LEFT, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(1, 2)))
+
+ def test_move_left_fail(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_LEFT, self.client, self.game_board)
+ self.movement_controller.handle_actions(ActionType.MOVE_LEFT, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(1, 2)))
+
+ def test_move_right(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_LEFT, self.client, self.game_board)
+ self.movement_controller.handle_actions(ActionType.MOVE_RIGHT, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(2, 2)))
+
+ def test_move_right_fail(self):
+ self.movement_controller.handle_actions(ActionType.MOVE_RIGHT, self.client, self.game_board)
+ self.assertEqual((str(self.client.avatar.position)), str(Vector(2, 2)))
diff --git a/game/test_suite/tests/test_occupiable_station.py b/game/test_suite/tests/test_occupiable_station.py
new file mode 100644
index 0000000..ecf22b0
--- /dev/null
+++ b/game/test_suite/tests/test_occupiable_station.py
@@ -0,0 +1,75 @@
+import unittest
+
+from game.common.stations.occupiable_station import OccupiableStation
+from game.common.stations.station import Station
+from game.common.map.wall import Wall
+from game.common.avatar import Avatar
+from game.common.items.item import Item
+from game.common.enums import ObjectType
+
+
+class TestOccupiableStation(unittest.TestCase):
+ """
+ `Test Item Notes:`
+
+ This class tests the different methods in the OccupiableStation class and ensures the objects that occupy them
+ are properly set.
+ """
+
+ def setUp(self) -> None:
+ self.occupiable_station: OccupiableStation = OccupiableStation()
+ self.occupiable_station1: OccupiableStation = OccupiableStation()
+ self.wall: Wall = Wall()
+ self.station: Station = Station()
+ self.avatar: Avatar = Avatar()
+ self.item: Item = Item()
+
+ # test adding wall to occupiable_station
+ def test_wall_occ(self):
+ self.occupiable_station.occupied_by = self.wall
+ self.assertEqual(self.occupiable_station.occupied_by.object_type, ObjectType.WALL)
+
+ # test adding station to occupiable_station
+ def test_station_occ(self):
+ self.occupiable_station.occupied_by = self.station
+ self.assertEqual(self.occupiable_station.occupied_by.object_type, ObjectType.STATION)
+
+ # test adding avatar to occupiable_station
+ def test_avatar_occ(self):
+ self.occupiable_station.occupied_by = self.avatar
+ self.assertEqual(self.occupiable_station.occupied_by.object_type, ObjectType.AVATAR)
+
+ # test adding item to occupiable_station
+ def test_item_occ(self):
+ self.occupiable_station.item = self.item
+ self.assertEqual(self.occupiable_station.item.object_type, ObjectType.ITEM)
+ self.assertEqual(self.occupiable_station.item.durability, self.item.durability)
+ self.assertEqual(self.occupiable_station.item.value, self.item.value)
+
+ # test cannot add item to occupied_by
+ def test_fail_item_occ(self):
+ with self.assertRaises(ValueError) as e:
+ self.occupiable_station.occupied_by = self.item
+ self.assertEqual(str(e.exception),
+ f'{self.occupiable_station.__class__.__name__}.occupied_by must be a GameObject.'
+ f' It is a(n) {self.item.__class__.__name__} with the value of {self.item}.')
+
+ # test json method
+ def test_occ_json(self):
+ self.occupiable_station.occupied_by = self.avatar
+ data: dict = self.occupiable_station.to_json()
+ occupiable_station: OccupiableStation = OccupiableStation().from_json(data)
+ self.assertEqual(self.occupiable_station.object_type, occupiable_station.object_type)
+ self.assertEqual(self.occupiable_station.occupied_by.object_type, occupiable_station.occupied_by.object_type)
+
+ # test json method with nested occupiable_station
+ def test_nested_occ_json(self):
+ self.occupiable_station.occupied_by = self.occupiable_station1
+ self.occupiable_station.occupied_by.occupied_by = self.avatar
+ data: dict = self.occupiable_station.to_json()
+ occupiable_station: OccupiableStation = OccupiableStation().from_json(data)
+ self.assertEqual(self.occupiable_station.object_type, occupiable_station.object_type)
+ self.assertEqual(self.occupiable_station.occupied_by.object_type, occupiable_station.occupied_by.object_type)
+ assert (isinstance(occupiable_station.occupied_by, OccupiableStation))
+ self.assertEqual(self.occupiable_station.occupied_by.occupied_by.object_type,
+ occupiable_station.occupied_by.occupied_by.object_type)
diff --git a/game/test_suite/tests/test_player.py b/game/test_suite/tests/test_player.py
new file mode 100644
index 0000000..b98c1f9
--- /dev/null
+++ b/game/test_suite/tests/test_player.py
@@ -0,0 +1,137 @@
+import unittest
+from game.common.player import Player
+from game.common.game_object import GameObject
+from game.common.avatar import Avatar
+from game.common.enums import *
+from game.common.avatar import Avatar
+
+
+class TestPlayer(unittest.TestCase):
+ """
+ `Test Player Notes:`
+
+ This class tests the different methods in the Player class.
+ """
+
+ def setUp(self) -> None:
+ self.object_type: ObjectType = ObjectType.PLAYER
+ self.functional: bool = True
+ self.player: Player = Player()
+ self.actions: list[ActionType] = []
+ self.team_name: str | None = ""
+ self.avatar: Avatar | None = Avatar()
+
+ # test action
+ def test_actions(self):
+ # accepts a list of ActionType
+ self.actions = [ActionType.MOVE_LEFT]
+ self.player.actions = self.actions
+ self.assertEqual(self.player.actions, self.actions)
+
+ def test_actions_empty_list(self):
+ # accepts a list of ActionType
+ self.actions = []
+ self.player.actions = self.actions
+ self.assertEqual(self.player.actions, self.actions)
+
+ def test_actions_fail_none(self):
+ value: list = None
+ with self.assertRaises(ValueError) as e:
+ self.player.actions = value
+ self.assertEqual(str(e.exception), f'Player.action must be an empty list or a list '
+ f'of action types.'
+ f' It is a(n) {value.__class__.__name__} and has the value of {value}.')
+
+ def test_actions_fail_not_action_type(self):
+ value: int = 10
+ with self.assertRaises(ValueError) as e:
+ self.player.actions = value
+
+ self.assertEqual(str(e.exception), f'Player.action must be an empty list or a list '
+ f'of action types.'
+ f' It is a(n) {value.__class__.__name__} and has the value of {value}.')
+
+ # test functional
+ def test_functional_true(self):
+ # functional can only be a boolean
+ self.player.functional = True
+ self.functional = True
+ self.assertEqual(self.player.functional, self.functional)
+
+ #
+ def test_functional_false(self):
+ self.player.functional = False
+ self.functional = False
+ self.assertEqual(self.player.functional, self.functional)
+
+ def test_functional_fail_int(self):
+ value: str = 'Strig'
+ with self.assertRaises(ValueError) as e:
+ self.player.functional = value
+ self.assertEqual(str(e.exception), f'Player.functional must be a boolean.'
+ f' It is a(n) {value.__class__.__name__} and has the value of {value}.')
+
+ # team name
+ def test_team_name(self):
+ # if it is a string it passes
+ self.team_name = ""
+ self.player.team_name = ""
+ self.assertEqual(self.player.team_name, self.team_name)
+
+ def test_team_name_none(self):
+ # if it is none it passes
+ self.team_name = None
+ self.assertEqual(self.player.team_name, self.team_name)
+
+ def test_team_name_fail_int(self):
+ # if it is not a string it fails
+ value: int = 1
+ with self.assertRaises(ValueError) as e:
+ self.player.team_name = value
+ self.assertEqual(str(e.exception), f'Player.team_name must be a String or None.'
+ f' It is a(n) {value.__class__.__name__} and has the value of {value}.')
+
+ # test avatar
+ def test_avatar(self):
+ self.avatar = Avatar()
+ self.player.avatar = self.avatar
+ self.assertEqual(self.player.avatar, self.avatar)
+
+ def test_avatar_none(self):
+ self.avatar = None
+ self.assertEqual(self.player.avatar, self.avatar)
+
+ def test_avatar_fail_string(self):
+ value: int = 10
+ with self.assertRaises(ValueError) as e:
+ self.player.avatar = value
+ self.assertEqual(str(e.exception), f'Player.avatar must be Avatar or None. It is a(n) {value.__class__.__name__} and has the value of {value}.')
+
+ # test object type
+ def test_object_type(self):
+ # object type only accepts object type
+ self.object_type = ObjectType.PLAYER
+ self.player.object_type = self.object_type
+ self.assertEqual(self.player.object_type, self.object_type)
+
+ def test_object_type_fail_none(self):
+ value: ObjectType = None
+ with self.assertRaises(ValueError) as e:
+ self.player.object_type = value
+ self.assertEqual(str(e.exception), f'Player.object_type must be ObjectType. It is a(n) {value.__class__.__name__} and has the value of {value}.')
+
+ def test_object_type_fail_int(self):
+ value: int = 10
+ with self.assertRaises(ValueError) as e:
+ self.player.object_type = value
+ self.assertEqual(str(e.exception), f'Player.object_type must be ObjectType. It is a(n) {value.__class__.__name__} and has the value of {value}.')
+
+ # test to json
+ def test_player_json(self):
+ data: dict = self.player.to_json()
+ player: Player = Player().from_json(data)
+ self.assertEqual(self.player.object_type, player.object_type)
+ self.assertEqual(self.player.functional, player.functional)
+ self.assertEqual(self.player.team_name, player.team_name)
+ self.assertEqual(self.player.actions, player.actions)
+ self.assertEqual(self.player.avatar, player.avatar)
diff --git a/game/test_suite/tests/test_station.py b/game/test_suite/tests/test_station.py
new file mode 100644
index 0000000..0a290da
--- /dev/null
+++ b/game/test_suite/tests/test_station.py
@@ -0,0 +1,58 @@
+import unittest
+
+from game.common.stations.station import Station
+from game.common.stations.station_example import StationExample
+from game.common.items.item import Item
+from game.controllers.inventory_controller import InventoryController
+from game.common.avatar import Avatar
+from game.common.player import Player
+from game.common.map.game_board import GameBoard
+from game.utils.vector import Vector
+from game.common.enums import ActionType
+from game.common.enums import ObjectType
+
+# class that tests stations and its methods
+class TestStation(unittest.TestCase):
+ """
+ `Test Station Example Notes:`
+
+ This class tests the different methods in the Station Example class. This is used to show how Stations could
+ work and how they can be tested.
+ """
+
+ def setUp(self) -> None:
+ self.station = Station()
+ self.item = Item(10, None, 2, 64)
+ self.station_example = StationExample(self.item)
+ self.avatar = Avatar(Vector(2, 2), 10)
+ self.inventory: list[Item] = [Item(0), Item(1), Item(2), Item(3), Item(4), Item(5), Item(6), Item(7), Item(8), Item(9)]
+ self.player = Player(avatar=self.avatar)
+ self.avatar.inventory = self.inventory
+ self.game_board = GameBoard(None, Vector(4, 4), None, False)
+ self.inventory_controller = InventoryController()
+
+ # test adding item to station
+ def test_item_occ(self):
+ self.station.held_item = self.item
+ self.assertEqual(self.station.held_item.object_type, ObjectType.ITEM)
+
+ # test adding something not an item
+ def test_item_occ_fail(self):
+ value: str = 'wow'
+ with self.assertRaises(ValueError) as e:
+ self.station.held_item = value
+ self.assertEqual(str(e.exception), f'Station.held_item must be an Item or None, not {value}.')
+
+ # test base take action method works
+ def test_take_action(self):
+ self.inventory_controller.handle_actions(ActionType.SELECT_SLOT_0, self.player, self.game_board)
+ self.station_example.take_action(self.avatar)
+ self.assertEqual(self.avatar.held_item.object_type, self.item.object_type)
+
+ # test json method
+ def test_json(self):
+ self.station.held_item = self.item
+ data: dict = self.station.to_json()
+ station: Station = Station().from_json(data)
+ self.assertEqual(self.station.object_type, station.object_type)
+ self.assertEqual(self.station.held_item.object_type, station.held_item.object_type)
\ No newline at end of file
diff --git a/game/test_suite/tests/test_tile.py b/game/test_suite/tests/test_tile.py
new file mode 100644
index 0000000..fb511f3
--- /dev/null
+++ b/game/test_suite/tests/test_tile.py
@@ -0,0 +1,61 @@
+import unittest
+
+from game.common.map.tile import Tile
+from game.common.map.wall import Wall
+from game.common.stations.station import Station
+from game.common.stations.occupiable_station import OccupiableStation
+from game.common.avatar import Avatar
+from game.common.enums import ObjectType
+
+
+class TestTile(unittest.TestCase):
+ """
+ `Test Tile Notes:`
+
+ This class tests the different methods in the Tile class.
+ """
+ def setUp(self) -> None:
+ self.tile: Tile = Tile()
+ self.wall: Wall = Wall()
+ self.station: Station = Station()
+ self.occupiable_station: OccupiableStation = OccupiableStation()
+ self.avatar: Avatar = Avatar()
+
+ # test adding avatar to tile
+ def test_avatar_tile(self):
+ self.tile.occupied_by = self.avatar
+ self.assertEqual(self.tile.occupied_by.object_type, ObjectType.AVATAR)
+
+ # test adding station to tile
+ def test_station_tile(self):
+ self.tile.occupied_by = self.station
+ self.assertEqual(self.tile.occupied_by.object_type, ObjectType.STATION)
+
+ # test adding occupiable_station to tile
+ def test_occupiable_station_tile(self):
+ self.tile.occupied_by = self.occupiable_station
+ self.assertEqual(self.tile.occupied_by.object_type, ObjectType.OCCUPIABLE_STATION)
+
+ # test aadding wall to tile
+ def test_wall_tile(self):
+ self.tile.occupied_by = self.wall
+ self.assertEqual(self.tile.occupied_by.object_type, ObjectType.WALL)
+
+ # test json method
+ def test_tile_json(self):
+ self.tile.occupied_by = self.station
+ data: dict = self.tile.to_json()
+ tile: Tile = Tile().from_json(data)
+ self.assertEqual(self.tile.object_type, tile.object_type)
+ self.assertEqual(self.tile.occupied_by.object_type, tile.occupied_by.object_type)
+
+ # test if json is correct when nested tile
+ def test_nested_tile_json(self):
+ self.occupiable_station.occupied_by = self.avatar
+ self.tile.occupied_by = self.occupiable_station
+ data: dict = self.tile.to_json()
+ tile: Tile = Tile().from_json(data)
+ self.assertEqual(self.tile.object_type, tile.object_type)
+ self.assertEqual(self.tile.occupied_by.object_type, tile.occupied_by.object_type)
+ assert (isinstance(tile.occupied_by, OccupiableStation))
+ self.assertEqual(self.tile.occupied_by.occupied_by.object_type, tile.occupied_by.occupied_by.object_type)
diff --git a/game/utils/generate_game.py b/game/utils/generate_game.py
index 4279d8b..0068664 100644
--- a/game/utils/generate_game.py
+++ b/game/utils/generate_game.py
@@ -1,14 +1,28 @@
+import random
+from game.common.avatar import Avatar
+from game.utils.vector import Vector
from game.config import *
from game.utils.helpers import write_json_file
+from game.common.map.game_board import GameBoard
-def generate():
- print('Generating game map...')
+def generate(seed: int = random.randint(0, 1000000000)):
+ """
+ This method is what generates the game_map. This method is slow, so be mindful when using it. A seed can be set as
+ the parameter; otherwise, a random one will be generated. Then, the method checks to make sure the location for
+ storing logs exists. Lastly, the game map is written to the game file.
+ :param seed:
+ :return: None
+ """
- data = dict()
+ print('Generating game map...')
- for x in range(1, MAX_TICKS + 1):
- data[x] = 'data'
+ temp: GameBoard = GameBoard(seed, map_size=Vector(6, 6), locations={(Vector(1, 1),): [Avatar()],
+ (Vector(4, 4),): [Avatar()]}, walled=True)
+ temp.generate_map()
+ data: dict = {'game_board': temp.to_json()}
+ # for x in range(1, MAX_TICKS + 1):
+ # data[x] = 'data'
# Verify logs location exists
if not os.path.exists(GAME_MAP_DIR):
diff --git a/game/utils/helpers.py b/game/utils/helpers.py
index 89148a3..52a0d35 100644
--- a/game/utils/helpers.py
+++ b/game/utils/helpers.py
@@ -2,5 +2,9 @@
def write_json_file(data, filename):
+ """
+ This file contain the method ``write_json_file``. It opens the a file with the given name and writes all the given data
+ to the file.
+ """
with open(filename, 'w') as f:
- json.dump(data, f)
+ json.dump(data, f, indent='\t')
diff --git a/game/utils/thread.py b/game/utils/thread.py
index ac66325..f2acf81 100644
--- a/game/utils/thread.py
+++ b/game/utils/thread.py
@@ -3,6 +3,13 @@
class Thread(threading.Thread):
+ """
+ `Thread Class Notes:`
+ Threads are how the engine communicates with user clients. These Threads are built to catch errors. If an error
+ is caught, it will be logged, but the program will continue to run.
+
+ If multithreading is needed for whatever reason, this class would be used for that.
+ """
def __init__(self, func, args):
threading.Thread.__init__(self)
self.args = args
@@ -17,6 +24,19 @@ def run(self):
class CommunicationThread(Thread):
+ """
+ `Communication Thread Class Notes:`
+
+ Communication Threads are bulkier than normal Threads. It also has error catching functionality, but tends
+ to be used for single-use, single-variable communication.
+
+ For example, if a client tries to use malicious code in any methods, a Communication Thread is used to check
+ any given parameters and throw an error if the type needed does not match what is given.
+
+ Communication Threads use a nested class to make the return value of the Communication Thread private. It helps
+ to keep things secure. This is now achieved through getter and setter decorators. Since the code here was
+ written long ago, the structure is different. For future note, use getter and setter decorators as needed.
+ """
def __init__(self, func, args=None, variable_type=None):
super().__init__(func, args)
self.type = variable_type
diff --git a/game/utils/validation.py b/game/utils/validation.py
index 4ba1074..f88e421 100644
--- a/game/utils/validation.py
+++ b/game/utils/validation.py
@@ -1,9 +1,14 @@
+import parsec
import re
from game.config import ALLOWED_MODULES
def verify_code(filename, already_string=False):
+ """
+ This file is used to verify a client's code. It helps to prevent certain attempts at purposefully interfering with the
+ code and competition.
+ """
contents = None
if already_string:
diff --git a/game/utils/vector.py b/game/utils/vector.py
new file mode 100644
index 0000000..ba677c8
--- /dev/null
+++ b/game/utils/vector.py
@@ -0,0 +1,130 @@
+from game.common.game_object import GameObject
+from game.common.enums import ObjectType
+from typing import Self, Tuple
+
+
+class Vector(GameObject):
+ """
+ `Vector Class Notes:`
+
+ This class is used universally in the project to handle anything related to coordinates. There are a few useful
+ methods here to help in a few situations.
+
+ -----
+
+ Add Vectors Method:
+ This method will take two Vector objects, combine their (x, y) coordinates, and return a new Vector object.
+
+ Example:
+ vector_1: (1, 1)
+ vector_2: (1, 1)
+
+ Result:
+ vector_result: (2, 2)
+
+ -----
+
+ Add to Vector method:
+ This method will take a different Vector object and add it to the current Self reference; that is, this method
+ belongs to a Vector object and is not static.
+
+ Example:
+ self_vector: (0, 0)
+ vector_1: (1, 3)
+
+ Result:
+ self_vector: (1, 3)
+
+ -----
+
+ Add X and Add Y methods:
+ These methods act similarly to the ``add_vector()`` method, but instead of changing both the x and y, these
+ methods change their respective variables.
+
+ Add X Example:
+ self_vector: (0, 0)
+ vector_1: (1, 3)
+
+ Result:
+ self_vector: (1, 0)
+
+ Add Y Example:
+ self_vector: (0, 0)
+ vector_1: (1, 3)
+
+ Result:
+ self_vector: (0, 3)
+
+ -----
+
+ As Tuple Method:
+ This method returns a tuple of the Vector object in the form of (x, y). This is to help with storing it easily
+ or accessing it in an immutable structure.
+ """
+
+ def __init__(self, x: int = 0, y: int = 0):
+ super().__init__()
+ self.object_type: ObjectType = ObjectType.VECTOR
+ self.x = x
+ self.y = y
+
+ @property
+ def x(self) -> int:
+ return self.__x
+
+ @x.setter
+ def x(self, x: int) -> None:
+ if x is None or not isinstance(x, int):
+ raise ValueError(f"The given x value, {x}, is not an integer.")
+ self.__x = x
+
+ @property
+ def y(self) -> int:
+ return self.__y
+
+ @y.setter
+ def y(self, y: int) -> None:
+ if y is None or not isinstance(y, int):
+ raise ValueError(f"The given y value, {y}, is not an integer.")
+ self.__y = y
+
+ @staticmethod
+ def add_vectors(vector_1: 'Vector', vector_2: 'Vector') -> 'Vector':
+ new_x: int = vector_1.x + vector_2.x
+ new_y: int = vector_1.y + vector_2.y
+ return Vector(new_x, new_y)
+
+ def add_to_vector(self, other_vector: Self) -> None:
+ self.x += other_vector.x
+ self.y += other_vector.y
+
+ def add_x_y(self, x: int, y: int) -> None:
+ self.x += x
+ self.y += y
+
+ def add_x(self, x: int) -> None:
+ self.x += x
+
+ def add_y(self, y: int) -> None:
+ self.y += y
+
+ def as_tuple(self) -> Tuple[int, int]:
+ """Returns (x: int, y: int)"""
+ return (self.x, self.y)
+
+ def to_json(self) -> dict:
+ data = super().to_json()
+ data['x'] = self.x
+ data['y'] = self.y
+
+ return data
+
+ def from_json(self, data) -> Self:
+ super().from_json(data)
+ self.x = data['x']
+ self.y = data['y']
+
+ return self
+
+ def __str__(self) -> str:
+ return f"Coordinates: ({self.x}, {self.y})"
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..a18074a
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,11 @@
+tqdm~=4.65.0
+pygame~=2.3.0
+numpy~=1.24.2
+opencv-python~=4.8.0.76
+Sphinx~=7.0.1
+Myst-Parser~=2.0.0
+furo~=2023.7.26
+parsec~=3.15
+SQLAlchemy~=2.0.2
+pydantic~=2.3.0
+fastapi[all]~=0.103.1
diff --git a/server/__init__.py b/server/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/server/crud/__init__.py b/server/crud/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/server/database.py b/server/database.py
new file mode 100644
index 0000000..1b60de3
--- /dev/null
+++ b/server/database.py
@@ -0,0 +1,10 @@
+from sqlalchemy import create_engine
+from sqlalchemy.orm import sessionmaker
+
+DB_URL = 'sqlite:///./byte_server.db'
+
+engine = create_engine(
+ DB_URL, connect_args={'check_same_thread': False}
+)
+
+SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
diff --git a/server/main.py b/server/main.py
new file mode 100644
index 0000000..4c101fb
--- /dev/null
+++ b/server/main.py
@@ -0,0 +1,31 @@
+from fastapi import FastAPI, HTTPException, Depends
+from sqlalchemy.orm import Session
+from models.base import Base
+from database import SessionLocal, engine
+from models.run import Run
+from models.errors import Errors
+from models.group_run import GroupRun
+from models.team import Team
+from models.team_type import TeamType
+from models.submission import Submission
+from models.turn_table import TurnTable
+from models.university import University
+
+Base.metadata.create_all(bind=engine)
+
+app = FastAPI()
+
+
+def get_db():
+ db = SessionLocal()
+ try:
+ yield db
+ finally:
+ db.close()
+
+
+# API
+
+@app.get("/")
+def root():
+ return {"message": "Hello World"}
\ No newline at end of file
diff --git a/server/models/__init__.py b/server/models/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/server/models/base.py b/server/models/base.py
new file mode 100644
index 0000000..fa2b68a
--- /dev/null
+++ b/server/models/base.py
@@ -0,0 +1,5 @@
+from sqlalchemy.orm import DeclarativeBase
+
+
+class Base(DeclarativeBase):
+ pass
diff --git a/server/models/errors.py b/server/models/errors.py
new file mode 100644
index 0000000..4f1f961
--- /dev/null
+++ b/server/models/errors.py
@@ -0,0 +1,12 @@
+from sqlalchemy import ForeignKey, Integer, String
+from sqlalchemy.orm import Mapped, mapped_column
+
+from .base import Base
+
+
+class Errors(Base):
+ __tablename__: str = 'errors'
+ error_id: Mapped[int] = mapped_column(Integer(), primary_key=True, autoincrement=True) # run id pk
+ run_id: Mapped[int] = mapped_column(Integer(), ForeignKey("run.run_id")) # run id
+ submission_id: Mapped[int] = mapped_column(Integer(), ForeignKey("submission.submission_id")) # submission id fk
+ error_txt: Mapped[str] = mapped_column(String(), nullable=True)
diff --git a/server/models/group_run.py b/server/models/group_run.py
new file mode 100644
index 0000000..c5f2580
--- /dev/null
+++ b/server/models/group_run.py
@@ -0,0 +1,18 @@
+from __future__ import annotations
+
+from sqlalchemy import Boolean, Integer, String, DateTime
+from sqlalchemy.orm import relationship, Mapped, mapped_column
+
+from .base import Base
+from .run import Run
+
+
+class GroupRun(Base):
+ # Date times are stored in UTC in ISO format
+ __tablename__: str = 'group_run'
+ group_run_id: Mapped[int] = mapped_column(Integer(), primary_key=True, autoincrement=True)
+ start_run: Mapped[str] = mapped_column(DateTime(), nullable=False)
+ launcher_version: Mapped[str] = mapped_column(String(10), nullable=False)
+ runs_per_client: Mapped[int] = mapped_column(Integer(), nullable=False)
+ is_finished: Mapped[bool] = mapped_column(Boolean(), default=False, nullable=False)
+ runs: Mapped[list[Run]] = relationship()
diff --git a/server/models/run.py b/server/models/run.py
new file mode 100644
index 0000000..f23cd47
--- /dev/null
+++ b/server/models/run.py
@@ -0,0 +1,18 @@
+from sqlalchemy import LargeBinary, Boolean, ForeignKey, Integer, DateTime
+from sqlalchemy.orm import Mapped, mapped_column
+
+from .base import Base
+
+
+class Run(Base):
+ __tablename__: str = 'run'
+ run_id: Mapped[int] = mapped_column(Integer(), primary_key=True, autoincrement=True)
+ group_run_id: Mapped[int] = mapped_column(Integer(), ForeignKey("group_run.group_run_id"))
+ run_time: Mapped[str] = mapped_column(DateTime(), nullable=False)
+ winner: Mapped[bool] = mapped_column(Boolean(), nullable=False)
+ player_1: Mapped[int] = mapped_column(Integer(), nullable=False)
+ player_2: Mapped[int] = mapped_column(Integer(), nullable=False)
+ seed: Mapped[int] = mapped_column(Integer(), nullable=False)
+
+ # results is a JSON file that's read in, so it needs to be a LargeBinary object.
+ results: Mapped[str] = mapped_column(LargeBinary(), nullable=False)
diff --git a/server/models/submission.py b/server/models/submission.py
new file mode 100644
index 0000000..ec79b56
--- /dev/null
+++ b/server/models/submission.py
@@ -0,0 +1,12 @@
+from sqlalchemy import LargeBinary, ForeignKey, Integer, DateTime
+from sqlalchemy.orm import Mapped, mapped_column
+
+from .base import Base
+
+
+class Submission(Base):
+ __tablename__: str = 'submission'
+ submission_id: Mapped[int] = mapped_column(Integer(), primary_key=True, autoincrement=True)
+ team_id_uuid: Mapped[int] = mapped_column(Integer(), ForeignKey("team.team_id_uuid"))
+ submission_time: Mapped[str] = mapped_column(DateTime(), nullable=False)
+ file_txt: Mapped[str] = mapped_column(LargeBinary(), nullable=False)
diff --git a/server/models/team.py b/server/models/team.py
new file mode 100644
index 0000000..a898afc
--- /dev/null
+++ b/server/models/team.py
@@ -0,0 +1,13 @@
+from sqlalchemy import CheckConstraint, ForeignKey, Integer, String
+from sqlalchemy.orm import Mapped, mapped_column
+
+from .base import Base
+from uuid import uuid4
+
+
+class Team(Base):
+ __tablename__: str = 'team'
+ team_id_uuid: Mapped[int] = mapped_column(Integer(), primary_key=True, default=uuid4())
+ uni_id: Mapped[int] = mapped_column(Integer(), ForeignKey("university.uni_id"))
+ team_type_id: Mapped[int] = mapped_column(Integer(), ForeignKey("team_type.team_type_id"))
+ team_name: Mapped[str] = mapped_column(String(), CheckConstraint("team_name != ''"), unique=True, nullable=False)
diff --git a/server/models/team_type.py b/server/models/team_type.py
new file mode 100644
index 0000000..451a777
--- /dev/null
+++ b/server/models/team_type.py
@@ -0,0 +1,12 @@
+from sqlalchemy import Integer, Boolean, CheckConstraint, String
+from sqlalchemy.orm import Mapped, mapped_column
+
+from .base import Base
+
+
+class TeamType(Base):
+ __tablename__: str = 'team_type'
+ team_type_id: Mapped[int] = mapped_column(Integer(), primary_key=True, autoincrement=True)
+ team_type_name: Mapped[str] = mapped_column(String(15), CheckConstraint("team_type_name != ''"), nullable=False,
+ unique=True)
+ eligible: Mapped[bool] = mapped_column(Boolean(), nullable=False)
diff --git a/server/models/turn_table.py b/server/models/turn_table.py
new file mode 100644
index 0000000..4ffcb64
--- /dev/null
+++ b/server/models/turn_table.py
@@ -0,0 +1,14 @@
+from sqlalchemy import LargeBinary, ForeignKey, Integer
+from sqlalchemy.orm import Mapped, mapped_column
+
+from .base import Base
+
+
+class TurnTable(Base):
+ __tablename__: str = 'turn_table'
+ turn_id: Mapped[int] = mapped_column(Integer(), primary_key=True)
+ turn_number: Mapped[int] = mapped_column(Integer())
+ run_id: Mapped[int] = mapped_column(Integer(), ForeignKey('run.run_id'))
+ turn_data: Mapped[str] = mapped_column(LargeBinary(), nullable=False)
+
+
diff --git a/server/models/university.py b/server/models/university.py
new file mode 100644
index 0000000..6a90e63
--- /dev/null
+++ b/server/models/university.py
@@ -0,0 +1,10 @@
+from sqlalchemy import Integer, CheckConstraint, String
+from sqlalchemy.orm import Mapped, mapped_column
+
+from .base import Base
+
+
+class University(Base):
+ __tablename__: str = 'university'
+ uni_id: Mapped[int] = mapped_column(Integer(), primary_key=True, autoincrement=True)
+ uni_name: Mapped[str] = mapped_column(String(100), CheckConstraint("uni_name != ''"), nullable=False, unique=True)
diff --git a/server/schemas/__init__.py b/server/schemas/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/server/schemas/submission.py b/server/schemas/submission.py
new file mode 100644
index 0000000..c7d6107
--- /dev/null
+++ b/server/schemas/submission.py
@@ -0,0 +1,4 @@
+from pydantic import BaseModel
+
+class SubmissionBase(BaseModel):
+ ...
\ No newline at end of file
diff --git a/sphinx/How to run.txt b/sphinx/How to run.txt
deleted file mode 100644
index f7ba1e8..0000000
--- a/sphinx/How to run.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-Open up a powershell in the Sphinx folder and type:
-
-sphinx-build -b html . ../docs
-
-To build for github pages run
-
-make github
\ No newline at end of file
diff --git a/sphinx/_static/style.css b/sphinx/_static/style.css
deleted file mode 100644
index cd17f0c..0000000
--- a/sphinx/_static/style.css
+++ /dev/null
@@ -1,3 +0,0 @@
-.wy-nav-content {
- min-width: 1200px !important;
-}
diff --git a/sphinx/byte_engine_docs/Makefile b/sphinx/byte_engine_docs/Makefile
new file mode 100644
index 0000000..d0c3cbf
--- /dev/null
+++ b/sphinx/byte_engine_docs/Makefile
@@ -0,0 +1,20 @@
+# Minimal makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line, and also
+# from the environment for the first two.
+SPHINXOPTS ?=
+SPHINXBUILD ?= sphinx-build
+SOURCEDIR = source
+BUILDDIR = build
+
+# Put it first so that "make" without argument is like "make help".
+help:
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
+
+.PHONY: help Makefile
+
+# Catch-all target: route all unknown targets to Sphinx using the new
+# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
+%: Makefile
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
diff --git a/sphinx/make.bat b/sphinx/byte_engine_docs/make.bat
similarity index 90%
rename from sphinx/make.bat
rename to sphinx/byte_engine_docs/make.bat
index 922152e..dc1312a 100644
--- a/sphinx/make.bat
+++ b/sphinx/byte_engine_docs/make.bat
@@ -7,10 +7,8 @@ REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
-set SOURCEDIR=.
-set BUILDDIR=_build
-
-if "%1" == "" goto help
+set SOURCEDIR=source
+set BUILDDIR=build
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
@@ -21,10 +19,12 @@ if errorlevel 9009 (
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
- echo.http://sphinx-doc.org/
+ echo.https://www.sphinx-doc.org/
exit /b 1
)
+if "%1" == "" goto help
+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end
diff --git a/sphinx/byte_engine_docs/source/conf.py b/sphinx/byte_engine_docs/source/conf.py
new file mode 100644
index 0000000..fcc4d6a
--- /dev/null
+++ b/sphinx/byte_engine_docs/source/conf.py
@@ -0,0 +1,52 @@
+# Configuration file for the Sphinx documentation builder.
+#
+# For the full list of built-in configuration values, see the documentation:
+# https://www.sphinx-doc.org/en/master/usage/configuration.html
+
+import os
+import sys
+sys.path.insert(0, os.path.abspath('../../..'))
+import game
+
+# -- Project information -----------------------------------------------------
+# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
+
+project = 'Byte Engine'
+copyright = '2023, Ian King'
+author = 'Ian King'
+release = '1.0.0'
+
+# -- General configuration ---------------------------------------------------
+# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
+
+extensions = ['sphinx.ext.autodoc',
+ 'sphinx.ext.viewcode',
+ 'myst_parser']
+
+# myst_enable_extensions = [
+# "amsmath",
+# "attrs_inline",
+# "colon_fence",
+# "deflist",
+# "dollarmath",
+# "fieldlist",
+# "html_admonition",
+# "html_image",
+# "linkify",
+# "replacements",
+# "smartquotes",
+# "strikethrough",
+# "substitution",
+# "tasklist",
+# ]
+
+templates_path = ['_templates']
+exclude_patterns = []
+
+
+
+# -- Options for HTML output -------------------------------------------------
+# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
+
+html_theme = 'furo'
+html_static_path = ['_static']
diff --git a/sphinx/byte_engine_docs/source/game.common.items.rst b/sphinx/byte_engine_docs/source/game.common.items.rst
new file mode 100644
index 0000000..7aaf488
--- /dev/null
+++ b/sphinx/byte_engine_docs/source/game.common.items.rst
@@ -0,0 +1,10 @@
+Items Package
+=============
+
+Item Class
+----------
+
+.. automodule:: game.common.items.item
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
diff --git a/sphinx/byte_engine_docs/source/game.common.map.rst b/sphinx/byte_engine_docs/source/game.common.map.rst
new file mode 100644
index 0000000..eaf0ec5
--- /dev/null
+++ b/sphinx/byte_engine_docs/source/game.common.map.rst
@@ -0,0 +1,35 @@
+Map Package
+===========
+
+Gameboard Class
+---------------
+
+.. automodule:: game.common.map.game_board
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+Occupiable Class
+----------------
+
+.. automodule:: game.common.map.occupiable
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+Tile Class
+----------
+
+.. automodule:: game.common.map.tile
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+Wall Class
+----------
+
+.. automodule:: game.common.map.wall
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
diff --git a/sphinx/byte_engine_docs/source/game.common.rst b/sphinx/byte_engine_docs/source/game.common.rst
new file mode 100644
index 0000000..a040a24
--- /dev/null
+++ b/sphinx/byte_engine_docs/source/game.common.rst
@@ -0,0 +1,62 @@
+Common Package
+==============
+
+.. toctree::
+ :maxdepth: 4
+
+ game.common.items
+ game.common.map
+ game.common.stations
+
+Action Class
+------------
+
+.. automodule:: game.common.action
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Avatar Class
+------------
+
+.. automodule:: game.common.avatar
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Enums File
+----------
+
+**NOTE:** The use of the enum structure is to make is easier to execute certain tasks. It also helps with
+identifying types of Objects throughout the project.
+
+When developing the game, add any extra enums as necessary.
+
+.. automodule:: game.common.enums
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+GameObject Class
+----------------
+
+.. automodule:: game.common.game_object
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Player Class
+------------
+
+.. automodule:: game.common.player
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
diff --git a/sphinx/byte_engine_docs/source/game.common.stations.rst b/sphinx/byte_engine_docs/source/game.common.stations.rst
new file mode 100644
index 0000000..6f56b13
--- /dev/null
+++ b/sphinx/byte_engine_docs/source/game.common.stations.rst
@@ -0,0 +1,50 @@
+Stations Package
+================
+
+Occupiable Station Class
+------------------------
+
+.. automodule:: game.common.stations.occupiable_station
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Occupiable Station Example Class
+--------------------------------
+
+.. automodule:: game.common.stations.occupiable_station_example
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Station Class
+-------------
+
+.. automodule:: game.common.stations.station
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Station Example Class
+---------------------
+
+.. automodule:: game.common.stations.station_example
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Station Receiver Example Class
+------------------------------
+
+.. automodule:: game.common.stations.station_receiver_example
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
diff --git a/sphinx/byte_engine_docs/source/game.controllers.rst b/sphinx/byte_engine_docs/source/game.controllers.rst
new file mode 100644
index 0000000..87a3823
--- /dev/null
+++ b/sphinx/byte_engine_docs/source/game.controllers.rst
@@ -0,0 +1,50 @@
+Controllers Package
+========================
+
+Controller Class
+----------------
+
+.. automodule:: game.controllers.controller
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Interact Controller Class
+-------------------------
+
+.. automodule:: game.controllers.interact_controller
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Inventory Controller Class
+--------------------------
+
+.. automodule:: game.controllers.inventory_controller
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Master Controller Class
+-----------------------
+
+.. automodule:: game.controllers.master_controller
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Movement Controller Class
+-------------------------
+
+.. automodule:: game.controllers.movement_controller
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
diff --git a/sphinx/byte_engine_docs/source/game.rst b/sphinx/byte_engine_docs/source/game.rst
new file mode 100644
index 0000000..74da087
--- /dev/null
+++ b/sphinx/byte_engine_docs/source/game.rst
@@ -0,0 +1,10 @@
+Game Package Contents
+=====================
+
+.. toctree::
+ :maxdepth: 4
+
+ game.common
+ game.controllers
+ game.test_suite
+ game.utils
diff --git a/sphinx/byte_engine_docs/source/game.test_suite.rst b/sphinx/byte_engine_docs/source/game.test_suite.rst
new file mode 100644
index 0000000..e2f6b72
--- /dev/null
+++ b/sphinx/byte_engine_docs/source/game.test_suite.rst
@@ -0,0 +1,15 @@
+Test Suite Package
+==================
+
+.. toctree::
+ :maxdepth: 4
+
+ game.test_suite.tests
+
+Runner.py File
+--------------
+
+.. automodule:: game.test_suite.runner
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
diff --git a/sphinx/byte_engine_docs/source/game.test_suite.tests.rst b/sphinx/byte_engine_docs/source/game.test_suite.tests.rst
new file mode 100644
index 0000000..c9837ea
--- /dev/null
+++ b/sphinx/byte_engine_docs/source/game.test_suite.tests.rst
@@ -0,0 +1,190 @@
+Tests Package
+=============
+
+Test Example File
+-----------------
+
+.. automodule:: game.test_suite.tests.test_example
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Avatar Class
+-----------------
+
+.. automodule:: game.test_suite.tests.test_avatar
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Avatar Inventory
+---------------------
+
+.. automodule:: game.test_suite.tests.test_avatar_inventory
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Gameboard Class
+--------------------
+
+.. automodule:: game.test_suite.tests.test_game_board
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Gameboard (No Generation)
+------------------------------
+
+.. automodule:: game.test_suite.tests.test_game_board_no_gen
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Initialization File
+------------------------
+
+.. automodule:: game.test_suite.tests.test_initialization
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Interact Controller File
+-----------------------------
+
+.. automodule:: game.test_suite.tests.test_interact_controller
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Inventory Controller Class
+-------------------------------
+
+.. automodule:: game.test_suite.tests.test_inventory_controller
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Item Class
+---------------
+
+.. automodule:: game.test_suite.tests.test_item
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Master Controller Class
+----------------------------
+
+.. automodule:: game.test_suite.tests.test_master_controller
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Movement Controller Class
+------------------------------
+
+.. automodule:: game.test_suite.tests.test_movement_controller
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Movement Controller with Occupiable Stations the Avatar can Occupy
+-----------------------------------------------------------------------
+
+.. automodule:: game.test_suite.tests.test_movement_controller_if_occupiable_station_is_occupiable
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Movement Controller with Occupiable Stations
+-------------------------------------------------
+
+.. automodule:: game.test_suite.tests.test_movement_controller_if_occupiable_stations
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Movement Controller with Stations the Avatar Occupy
+--------------------------------------------------------
+
+.. automodule:: game.test_suite.tests.test_movement_controller_if_stations
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Movement Controller with Walls
+-----------------------------------
+
+.. automodule:: game.test_suite.tests.test_movement_controller_if_wall
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Occupiable Station Class
+-----------------------------
+
+.. automodule:: game.test_suite.tests.test_occupiable_station
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Player Class
+-----------------
+
+.. automodule:: game.test_suite.tests.test_player
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Station Class
+------------------
+
+.. automodule:: game.test_suite.tests.test_station
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Test Tile Class
+---------------
+
+.. automodule:: game.test_suite.tests.test_tile
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
diff --git a/sphinx/byte_engine_docs/source/game.utils.rst b/sphinx/byte_engine_docs/source/game.utils.rst
new file mode 100644
index 0000000..4a31a55
--- /dev/null
+++ b/sphinx/byte_engine_docs/source/game.utils.rst
@@ -0,0 +1,50 @@
+Utils Package
+=============
+
+Generate Game
+-------------
+
+.. automodule:: game.utils.generate_game
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Helpers
+-------
+
+.. automodule:: game.utils.helpers
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Thread
+------
+
+.. automodule:: game.utils.thread
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Validation
+----------
+
+.. automodule:: game.utils.validation
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
+
+-----
+
+Vector
+------
+
+.. automodule:: game.utils.vector
+ :members:
+ :no-undoc-members:
+ :show-inheritance:
diff --git a/sphinx/byte_engine_docs/source/index.rst b/sphinx/byte_engine_docs/source/index.rst
new file mode 100644
index 0000000..0c03f2a
--- /dev/null
+++ b/sphinx/byte_engine_docs/source/index.rst
@@ -0,0 +1,36 @@
+.. Byte Engine documentation master file, created by
+ sphinx-quickstart on Fri Jul 21 23:39:22 2023.
+ You can adapt this file completely to your liking, but it should at least
+ contain the root `toctree` directive.
+
+=============================================
+Welcome to NDACM's Byte Engine Documentation!
+=============================================
+
+NDSU's ACM chapter hosts an annual competition called "Byte-le Royale." This competition was created by Riley Conlin,
+Jordan Goetze, Jacob Baumann, Ajay Brown, and Nick Hilger. It promotes working with others and developing critical
+thinking skills, while challenging competitors under a time limit.
+
+This project provides the framework for developing games for Byte-le. The README document is attached to this page.
+Refer to that for additional info to what's here!
+
+
+README Document
+===============
+
+.. include:: ../../../README.md
+ :parser: myst_parser.sphinx_
+
+-----
+
+.. toctree::
+ game
+
+-----
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
diff --git a/sphinx/conf.py b/sphinx/conf.py
deleted file mode 100644
index b112408..0000000
--- a/sphinx/conf.py
+++ /dev/null
@@ -1,191 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-#
-# Byte-le-Royale documentation build configuration file, created by
-# sphinx-quickstart on Fri Nov 17 10:32:30 2017.
-#
-# This file is execfile()d with the current directory set to its
-# containing dir.
-#
-# Note that not all possible configuration values are present in this
-# autogenerated file.
-#
-# All configuration values have a default; values that are commented out
-# serve to show the default.
-
-# If extensions (or modules to document with autodoc) are in another directory,
-# add these directories to sys.path here. If the directory is relative to the
-# documentation root, use os.path.abspath to make it absolute, like shown here.
-#
-# import os
-# import sys
-# sys.path.insert(0, os.path.abspath('.'))
-import recommonmark
-from recommonmark.parser import CommonMarkParser
-from recommonmark.transform import AutoStructify
-
-# -- General configuration ------------------------------------------------
-
-# If your documentation needs a minimal Sphinx version, state it here.
-#
-# needs_sphinx = '1.0'
-
-# Add any Sphinx extension module names here, as strings. They can be
-# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
-# ones.
-extensions = ['recommonmark', 'sphinx.ext.todo', 'sphinx.ext.githubpages']
-
-# Add any paths that contain templates here, relative to this directory.
-templates_path = ['_templates']
-
-# The suffix(es) of source filenames.
-# You can specify multiple suffix as a list of string:
-#
-# source_suffix = ['.rst', '.md']
-source_suffix = [ '.rst', '.md' ]
-
-# The master toctree document.
-master_doc = 'index'
-
-# General information about the project.
-project = 'Byte-le-Royale 20XX'
-copyright = '20XX-20XX, NDSU ACM'
-author = 'NDSU ACM'
-
-# The version info for the project you're documenting, acts as replacement for
-# |version| and |release|, also used in various other places throughout the
-# built documents.
-#
-# The short X.Y version.
-version = 'Version 1.0'
-# The full version, including alpha/beta/rc tags.
-release = '9'
-
-# The language for content autogenerated by Sphinx. Refer to documentation
-# for a list of supported languages.
-#
-# This is also used if you do content translation via gettext catalogs.
-# Usually you set "language" from the command line for these cases.
-language = None
-
-# List of patterns, relative to source directory, that match files and
-# directories to ignore when looking for source files.
-# This patterns also effect to html_static_path and html_extra_path
-exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
-
-# The name of the Pygments (syntax highlighting) style to use.
-pygments_style = 'sphinx'
-
-# If true, `todo` and `todoList` produce output, else they produce nothing.
-todo_include_todos = True
-
-
-# -- Options for HTML output ----------------------------------------------
-
-# The theme to use for HTML and HTML Help pages. See the documentation for
-# a list of builtin themes.
-#
-html_theme = "sphinx_rtd_theme"
-html_theme_path = ["_themes"]
-
-# Theme options are theme-specific and customize the look and feel of a theme
-# further. For a list of options available for each theme, see the
-# documentation.
-#
-#html_theme_options = {}
-
-# Add any paths that contain custom static files (such as style sheets) here,
-# relative to this directory. They are copied after the builtin static files,
-# so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = ['_static']
-
-# Custom sidebar templates, must be a dictionary that maps document names
-# to template names.
-#
-# This is required for the alabaster theme
-# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
-html_sidebars = {
- '**': [
- 'about.html',
- 'navigation.html',
- 'relations.html', # needs 'show_related': True theme option to display
- 'searchbox.html',
- 'donate.html',
- ]
-}
-
-
-# -- Options for HTMLHelp output ------------------------------------------
-
-# Output file base name for HTML help builder.
-htmlhelp_basename = 'Byte-le-Royale'
-
-
-# -- Options for LaTeX output ---------------------------------------------
-
-latex_elements = {
- # The paper size ('letterpaper' or 'a4paper').
- #
- # 'papersize': 'letterpaper',
-
- # The font size ('10pt', '11pt' or '12pt').
- #
- # 'pointsize': '10pt',
-
- # Additional stuff for the LaTeX preamble.
- #
- # 'preamble': '',
-
- # Latex figure (float) alignment
- #
- # 'figure_align': 'htbp',
-}
-
-# Grouping the document tree into LaTeX files. List of tuples
-# (source start file, target name, title,
-# author, documentclass [howto, manual, or own class]).
-latex_documents = [
- (master_doc, 'Byte-le-Royale.tex', 'Byte-le Royale Documentation',
- 'NDSU ACM', 'manual'),
-]
-
-
-# -- Options for manual page output ---------------------------------------
-
-# One entry per manual page. List of tuples
-# (source start file, name, description, authors, manual section).
-man_pages = [
- (master_doc, 'byte-le-royale', 'Byte-le Royale Documentation',
- [author], 1)
-]
-
-
-# -- Options for Texinfo output -------------------------------------------
-
-# Grouping the document tree into Texinfo files. List of tuples
-# (source start file, target name, title, author,
-# dir menu entry, description, category)
-texinfo_documents = [
- (master_doc, 'Byte-le Royale"', 'Game Name',
- author, 'Byte-le-Royale', 'One line description of project.',
- 'Miscellaneous'),
-]
-
-
-# source_parsers = {
-# '.md': CommonMarkParser,
-# }
-
-# At the bottom of conf.py
-github_doc_root = "https://royale.ndacm.org/GameURL/"
-def setup(app):
- app.add_config_value('recommonmark_config', {
- 'url_resolver': lambda url: github_doc_root + url,
- 'enable_auto_toc_tree': True,
- 'enable_eval_rst': True,
- 'enable_auto_doc_ref': False,
- }, True)
- app.add_transform(AutoStructify)
-
- app.add_stylesheet('accordion.css')
- app.add_javascript('accordion.js')
diff --git a/sphinx/index.rst b/sphinx/index.rst
deleted file mode 100644
index 4cf57de..0000000
--- a/sphinx/index.rst
+++ /dev/null
@@ -1,22 +0,0 @@
-.. Placeholder documentation master file, created by
- sphinx-quickstart on Tue Jan 19 18:18:11 2021.
- You can adapt this file completely to your liking, but it should at least
- contain the root `toctree` directive.
-
-Welcome to Placeholder's documentation!
-=======================================
-
-.. toctree::
- :maxdepth: 2
- :caption: Contents:
-
- test
-
-
-
-Indices and tables
-==================
-
-* :ref:`genindex`
-* :ref:`modindex`
-* :ref:`search`
diff --git a/sphinx/test.rst b/sphinx/test.rst
deleted file mode 100644
index 68ad0f0..0000000
--- a/sphinx/test.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-My Title
-*********
-
-This is a test of Sphinx.
\ No newline at end of file
diff --git a/visualizer/adapter.py b/visualizer/adapter.py
new file mode 100644
index 0000000..dc749fd
--- /dev/null
+++ b/visualizer/adapter.py
@@ -0,0 +1,112 @@
+import random
+
+import pygame
+from game.config import *
+from typing import Callable, Any
+from visualizer.bytesprites.exampleTileBS import TileBytespriteFactoryExample
+from visualizer.bytesprites.exampleWallBS import WallBytespriteFactoryExample
+from visualizer.bytesprites.exampleBS import AvatarBytespriteFactoryExample
+from game.utils.vector import Vector
+from visualizer.utils.text import Text
+from visualizer.utils.button import Button, ButtonColors
+from visualizer.bytesprites.bytesprite import ByteSprite
+from visualizer.templates.menu_templates import Basic, MenuTemplate
+from visualizer.templates.playback_template import PlaybackTemplate, PlaybackButtons
+
+
+class Adapter:
+ """
+ The Adapter class can be considered the "Master Controller" of the Visualizer; it works in tandem with main.py.
+ Main.py will call many of the methods that are provided in here to keep the Visualizer moving smoothly.
+ """
+
+ def __init__(self, screen):
+ self.screen: pygame.Surface = screen
+ self.bytesprites: list[ByteSprite] = []
+ self.populate_bytesprite: pygame.sprite.Group = pygame.sprite.Group()
+ self.menu: MenuTemplate = Basic(screen, 'Basic Title')
+ self.playback: PlaybackTemplate = PlaybackTemplate(screen)
+ self.turn_number: int = 0
+ self.turn_max: int = MAX_TICKS
+
+ # Define any methods button may run
+
+ def start_menu_event(self, event: pygame.event) -> Any:
+ """
+ This method is used to manage any events that will occur on the starting screen. For example, a start button
+ is implemented currently. Pressing it or pressing enter will start the visualizer to show the game's results.
+ This method will manage any specified events and return them (hence why the return type is Any). Refer to
+ menu_templates.py's start_events method for more info.
+ :param event:
+ :return: Any specified event desired in the start_events method
+ """
+ return self.menu.start_events(event)
+
+ def start_menu_render(self) -> None:
+ """
+ Renders and shows everything in the start menu.
+ :return: None
+ """
+ self.menu.start_render()
+
+ def on_event(self, event) -> PlaybackButtons:
+ """
+ By giving this method an event, this method can execute whatever is specified. An example is provided below
+ and commented out. Use as necessary.
+ :param event:
+ :return: None
+ """
+
+ # The line below is an example of what this method could be used for.
+ # self.button.mouse_clicked(event)
+ return self.playback.playback_events(event)
+
+ def prerender(self) -> None:
+ """
+ This will handle anything that needs to be completed before animations start.
+ :return: None
+ """
+ ...
+
+ def continue_animation(self) -> None:
+ """
+ This method is used after the main.py continue_animation() method.
+ :return:
+ """
+ ...
+
+ def recalc_animation(self, turn_log: dict) -> None:
+ self.turn_number = turn_log['tick']
+
+ def populate_bytesprite_factories(self) -> dict[int: Callable[[pygame.Surface], ByteSprite]]:
+ # Instantiate all bytesprites for each object ands add them here
+ return {
+ 4: AvatarBytespriteFactoryExample().create_bytesprite,
+ 7: TileBytespriteFactoryExample().create_bytesprite,
+ 8: WallBytespriteFactoryExample().create_bytesprite,
+ }
+
+ def render(self) -> None:
+ # self.button.render()
+ # any logic for rendering text, buttons, and other visuals
+ text = Text(self.screen, f'{self.turn_number} / {self.turn_max}', 48)
+ text.rect.center = Vector.add_vectors(Vector(*self.screen.get_rect().midtop), Vector(0, 50)).as_tuple()
+ text.render()
+ self.playback.playback_render()
+
+ def clean_up(self) -> None:
+ ...
+
+ def results_load(self, results: dict) -> None:
+ self.menu.load_results_screen(results)
+
+ def results_event(self, event: pygame.event) -> Any:
+ return self.menu.results_events(event)
+
+ def results_render(self) -> None:
+ """
+ This renders the results for the
+ :return:
+ """
+ self.menu.results_render()
+
diff --git a/visualizer/bytesprites/bytesprite.py b/visualizer/bytesprites/bytesprite.py
new file mode 100644
index 0000000..35974b8
--- /dev/null
+++ b/visualizer/bytesprites/bytesprite.py
@@ -0,0 +1,229 @@
+from __future__ import annotations
+from typing import Callable
+
+import pygame as pyg
+
+from visualizer.config import Config
+from visualizer.utils.spritesheet import SpriteSheet
+from game.utils.vector import Vector
+
+
+class ByteSprite(pyg.sprite.Sprite):
+ """
+ `ByteSprite Class Notes:`
+
+ PyGame Notes
+ ------------
+ Here are listed definitions of the PyGame objects that are used in this file:
+ PyGame.Rect:
+ "An object for storing rectangular coordinates." This is used to help position things on the screen.
+
+ PyGame.Surface:
+ "An object for representing images." This is used mostly for getting the screen and individual images in
+ a spritesheet.
+
+
+ Class Variables
+ ---------------
+ Active Sheet:
+ The active_sheet is the list of images (sprites) that is currently being used. In other words, it's a strip
+ of sprites that will be used.
+
+ Spritesheets:
+ This is a 2D array of sprites. For example, refer to the ``ExampleSpritesheet.png`` file. The entirety of the
+ 4x4 would be a spritesheet. One row of it would be used as an active sheet.
+
+ Object Type:
+ This is an int that represents the enum value of the Object the sprite represents. For example, the
+ ``ExampleSpritesheet.png`` shows the Avatar. The Avatar object_type's enum value is found in the JSON logs and
+ is the number 4. This would change if the order of the ObjectType enum changes, so be mindful of that and
+ refer to the JSON logs for the exact values.
+
+ Rect:
+ The rect is an object used for rectangular objects. You can offset the top left corner of the Rect by
+ passing parameters.
+
+ Example:
+
+ On the left, the Rect's offset is depicted as being at (0, 0), meaning there is no offset. A Rect object
+ has parameters that will determine the offset by passing in (x, y). The 'x' is the offset from the left
+ side, and the 'y' is the offset from the top. Therefore, passing in an (x, y) of (3, 2) in a Rect object
+ will move the object 3 units to the right, and 2 units down.
+
+ In the visual below, the left side shows a Rect at (0, 0) (i.e., no offset). The image on the right depicts
+ the Rect object further to the right, showing its offset from the left corner of the screen.
+
+ Rect Example:
+ ::
+ ----------------------- -----------------------
+ |------ | | ------ |
+ || | | | | | |
+ |______ | --------> | ______ |
+ | | | |
+ | | | |
+ | | | |
+ ----------------------- -----------------------
+
+ Screen:
+ The screen is also a PyGame.Screen object, so it simply represents an image of the screen itself.
+
+ Image:
+ The image is an individual sprite in a spritesheet.
+
+ Frame Index:
+ The frame index is an int that is used to determine which sprite to use from the active_sheet. For example,
+ say the active_sheet is the first row in the ``ExampleSpritesheet.png``. If the frame_index is 1, the first
+ image will be used where the head is centered. If the frame_index is 3, the sprite will now have the head of
+ the Avatar in a different position than in frame_index 1.
+
+ Config:
+ This is an object reference to the ``config.py`` file. It's used to access the fixed values that are only
+ accessed in the configurations of the file.
+
+ Update Function:
+ The update function is a method that is assigned during instantiation of the ByteSprite. That function is
+ used to update what the active_sheet is depending on what is implemented in ByteSprite classes.
+
+ Examine the ``exampleBS.py`` file. In that implementation of the update method, it selects the active_sheet
+ based on a chain of if statements. Next, in the ``create_bytesprite`` method, the implemented ``update``
+ method is passed into the returned ByteSprite object.
+
+ Now, in the ByteSprite object's update method, it will set the active_sheet to be based on what is returned
+ from the BytespriteFactory's method.
+
+ To recap, first, a ByteSprite's update function depends on the BytespriteFactory's implementation. Then, the
+ BytespriteFactory's implementation will return which sprite_sheet is supposed to be used. Finally, the
+ ByteSprite's update function will take what is returned from the BytespriteFactory's method and assign
+ the active_sheet to be what is returned. The two work in tandem.
+ """
+
+ active_sheet: list[pyg.Surface] # The current spritesheet being used.
+ spritesheets: list[list[pyg.Surface]]
+ object_type: int
+ rect: pyg.Rect
+ screen: pyg.Surface
+ image: pyg.Surface
+ __frame_index: int # Selects the sprite from the spritesheet to be used. Used for animation
+ __config: Config = Config()
+ __update_function: Callable[[dict, int, Vector, list[list[pyg.Surface]]], list[pyg.Surface]]
+
+ # make sure that all inherited classes constructors only take screen as a parameter
+ def __init__(self, screen: pyg.Surface, filename: str, num_of_states: int, object_type: int,
+ update_function: Callable[[dict, int, Vector, list[list[pyg.Surface]]], list[pyg.Surface]],
+ colorkey: pyg.Color | None = None, top_left: Vector = Vector(0, 0)):
+ # Add implementation here for selecting the sprite sheet to use
+ super().__init__()
+ self.spritesheet_parser: SpriteSheet = SpriteSheet(filename)
+ self.spritesheets: list[list[pyg.Surface]] = [self.spritesheet_parser.load_strip(
+ pyg.Rect(0, self.__config.TILE_SIZE * row, self.__config.TILE_SIZE, self.__config.TILE_SIZE),
+ self.__config.NUMBER_OF_FRAMES_PER_TURN, colorkey)
+ for row in range(num_of_states)]
+
+ self.rect: pyg.Rect = pyg.Rect(top_left.as_tuple(), (self.__config.TILE_SIZE * self.__config.SCALE,) * 2)
+
+ self.spritesheets = [
+ [pyg.transform.scale(frame, self.rect.size) for frame in
+ sheet] for sheet in self.spritesheets]
+
+ self.update_function = update_function
+
+ self.active_sheet: list[pyg.Surface] = self.spritesheets[0]
+ self.object_type: int = object_type
+ self.screen: pyg.Surface = screen
+
+ @property
+ def active_sheet(self) -> list[pyg.Surface]:
+ return self.__active_sheet
+
+ @property
+ def spritesheets(self) -> list[list[pyg.Surface]]:
+ return self.__spritesheets
+
+ @property
+ def object_type(self) -> int:
+ return self.__object_type
+ @property
+ def rect(self) -> pyg.Rect:
+ return self.__rect
+
+ @property
+ def screen(self) -> pyg.Surface:
+ return self.__screen
+
+ @property
+ def update_function(self) -> Callable[[dict, int, Vector, list[list[pyg.Surface]]], list[pyg.Surface]]:
+ return self.__update_function
+
+ @active_sheet.setter
+ def active_sheet(self, sheet: list[pyg.Surface]) -> None:
+ if sheet is None or not isinstance(sheet, list) and \
+ any(map(lambda sprite: not isinstance(sprite, pyg.Surface), sheet)):
+ raise ValueError(f'{self.__class__.__name__}.active_sheet must be a list of pyg.Surface objects.')
+ self.__active_sheet = sheet
+
+ @spritesheets.setter
+ def spritesheets(self, spritesheets: list[list[pyg.Surface]]) -> None:
+ if spritesheets is None or (
+ not isinstance(spritesheets, list) or any(map(lambda sheet: not isinstance(sheet, list), spritesheets))
+ or any([any(map(lambda sprite: not isinstance(sprite, pyg.Surface), sheet))
+ for sheet in spritesheets])):
+ raise ValueError(f'{self.__class__.__name__}.spritesheets must be a list of lists of pyg.Surface objects.')
+
+ self.__spritesheets = spritesheets
+
+ @object_type.setter
+ def object_type(self, object_type: int) -> None:
+ if object_type is None or not isinstance(object_type, int):
+ raise ValueError(f'{self.__class__.__name__}.object_type must be an int.')
+
+ if object_type < 0:
+ raise ValueError(f'{self.__class__.__name__}.object_type can\'t be negative.')
+ self.__object_type = object_type
+
+ @rect.setter
+ def rect(self, rect: pyg.Rect) -> None:
+ if rect is None or not isinstance(rect, pyg.Rect):
+ raise ValueError(f'{self.__class__.__name__}.rect must be a pyg.Rect object.')
+ self.__rect = rect
+
+ @screen.setter
+ def screen(self, screen: pyg.Surface) -> None:
+ if screen is None or not isinstance(screen, pyg.Surface):
+ raise ValueError(f'{self.__class__.__name__}.screen must be a pyg.Screen object.')
+ self.__screen = screen
+
+ @update_function.setter
+ def update_function(self, update_function: Callable[[dict, int, Vector, list[list[pyg.Surface]]], list[pyg.Surface]]) -> None:
+ if update_function is None or not isinstance(update_function, Callable):
+ raise ValueError(f'{self.__class__.__name__}.update_function must be a Callable object.')
+ self.__update_function = update_function
+
+ # Inherit this method to implement sprite logic
+ def update(self, data: dict, layer: int, pos: Vector) -> None:
+ """
+ This method will start an animation based on the currently set active_sheet. Then, it will reassign the
+ active_sheet based on what the BytespriteFactory's update method will return. Lastly, the
+ ``set_image_and_render`` method is then called to then display the new sprites in the active_sheet.
+ :param data:
+ :param layer:
+ :param pos:
+ :return: None
+ """
+
+ self.__frame_index = 0 # Starts the new spritesheet at the beginning
+ self.rect.topleft = (
+ pos.x * self.__config.TILE_SIZE * self.__config.SCALE + self.__config.GAME_BOARD_MARGIN_LEFT,
+ pos.y * self.__config.TILE_SIZE * self.__config.SCALE + self.__config.GAME_BOARD_MARGIN_TOP)
+
+ self.active_sheet = self.update_function(data, layer, pos, self.spritesheets)
+ self.set_image_and_render()
+
+ # Call this method at the end of the implemented logic and for each frame
+ def set_image_and_render(self):
+ """
+ This method will take a single image from the current active_sheet and then display it on the screen.
+ :return:
+ """
+ self.image = self.active_sheet[self.__frame_index]
+ self.__frame_index = (self.__frame_index + 1) % self.__config.NUMBER_OF_FRAMES_PER_TURN
+ self.screen.blit(self.image, self.rect)
diff --git a/visualizer/bytesprites/bytesprite_factory.py b/visualizer/bytesprites/bytesprite_factory.py
new file mode 100644
index 0000000..627d64b
--- /dev/null
+++ b/visualizer/bytesprites/bytesprite_factory.py
@@ -0,0 +1,29 @@
+import pygame as pyg
+
+from game.utils.vector import Vector
+from visualizer.bytesprites.bytesprite import ByteSprite
+
+
+class ByteSpriteFactory:
+ @staticmethod
+ def update(data: dict, layer: int, pos: Vector, spritesheets: list[list[pyg.Surface]]) -> list[pyg.Surface]:
+ """
+ This is a method that **must** be implemented in every ByteSpriteFactory class. Look at the example files
+ to see how this *could* be implemented. Implementation may vary.
+ :param data:
+ :param layer:
+ :param pos:
+ :param spritesheets:
+ :return: list[pyg.Surface]
+ """
+ ...
+
+ @staticmethod
+ def create_bytesprite(screen: pyg.Surface) -> ByteSprite:
+ """
+ This is a method that **must** be implemented in every ByteSpriteFactory class. Look at the example files
+ to see how this can be implemented.
+ :param screen:
+ :return:
+ """
+ ...
diff --git a/visualizer/bytesprites/exampleBS.py b/visualizer/bytesprites/exampleBS.py
new file mode 100644
index 0000000..d5efeae
--- /dev/null
+++ b/visualizer/bytesprites/exampleBS.py
@@ -0,0 +1,47 @@
+import os
+import random
+
+import pygame as pyg
+
+from visualizer.bytesprites.bytesprite import ByteSprite
+from game.utils.vector import Vector
+from visualizer.bytesprites.bytesprite_factory import ByteSpriteFactory
+
+
+class AvatarBytespriteFactoryExample(ByteSpriteFactory):
+ """
+ `Avatar Bytesprite Factory Example Notes`:
+
+ This is a factory class that will produce Bytesprite objects of the Avatar.
+ """
+ @staticmethod
+ def update(data: dict, layer: int, pos: Vector, spritesheets: list[list[pyg.Surface]]) -> list[pyg.Surface]:
+ """
+ This method will select which spritesheet to select from the ``ExampleSpritesheet.png`` file. For example,
+ the first if statement will return the second row of sprites in the image if conditions are met.
+ :param data:
+ :param layer:
+ :param pos:
+ :param spritesheets:
+ :return: list[pyg.Surface]
+ """
+
+ # Logic for selecting active animation
+ if data['inventory'][data['held_index']] is not None:
+ return spritesheets[1]
+ elif random.randint(1, 6) == 6:
+ return spritesheets[2]
+ elif random.randint(1, 4) == 4:
+ return spritesheets[3]
+ else:
+ return spritesheets[0]
+
+ @staticmethod
+ def create_bytesprite(screen: pyg.Surface) -> ByteSprite:
+ """
+ This file will return a new ByteSprite object that is to be displayed on the screen.
+ :param screen: ByteSprite
+ :return:
+ """
+ return ByteSprite(screen, os.path.join(os.getcwd(), 'visualizer/spritesheets/ExampleSpritesheet.png'), 4,
+ 4, AvatarBytespriteFactoryExample.update, pyg.Color("#FBBBAD"))
diff --git a/visualizer/bytesprites/exampleTileBS.py b/visualizer/bytesprites/exampleTileBS.py
new file mode 100644
index 0000000..5f4aef8
--- /dev/null
+++ b/visualizer/bytesprites/exampleTileBS.py
@@ -0,0 +1,48 @@
+import os
+
+import pygame as pyg
+
+from visualizer.bytesprites.bytesprite import ByteSprite
+from game.utils.vector import Vector
+from visualizer.bytesprites.bytesprite_factory import ByteSpriteFactory
+
+
+class TileBytespriteFactoryExample(ByteSpriteFactory):
+ """
+ This class is used to demonstrate an example of the Tile Bytesprite. It demonstrates how any class inheriting
+ from ByteSpriteFactory must implement the `update()` and `create_bytesprite()` static methods. These methods may
+ have unique implementations based on how the sprites are meant to look and interact with other objects in the game.
+ """
+ @staticmethod
+ def update(data: dict, layer: int, pos: Vector, spritesheets: list[list[pyg.Surface]]) -> list[pyg.Surface]:
+ """
+ This implementation of the update method is different from the exampleWallBS.py file. In this method, the
+ data dictionary is used. The `data` is a dict representing a Tile object in JSON notation.
+
+ For this unique implementation, an if statement is used to check if something is occupying the Tile object.
+ If true, the second spritesheet is used. If false, the first spritesheet is used.
+
+ Examining the ExampleTileSS.png, it is apparent that the first spritesheet shows a Tile with an animation with
+ only the pink color. However, the second spritesheet (the one used if something occupies that tile) has a unique
+ animation that is blue instead.
+ :param data:
+ :param layer:
+ :param pos:
+ :param spritesheets:
+ :return:
+ """
+ if data['occupied_by'] is not None:
+ return spritesheets[1]
+ else:
+ return spritesheets[0]
+
+ @staticmethod
+ def create_bytesprite(screen: pyg.Surface) -> ByteSprite:
+ """
+ This method takes a screen from Pygame.Surface. That screen is then passed in as a parameter into the
+ returned Bytesprite object.
+ :param screen:
+ :return:
+ """
+ return ByteSprite(screen, os.path.join(os.getcwd(), 'visualizer/spritesheets/ExampleTileSS.png'), 2,
+ 7, TileBytespriteFactoryExample.update)
diff --git a/visualizer/bytesprites/exampleWallBS.py b/visualizer/bytesprites/exampleWallBS.py
new file mode 100644
index 0000000..659cd1a
--- /dev/null
+++ b/visualizer/bytesprites/exampleWallBS.py
@@ -0,0 +1,39 @@
+import os
+
+import pygame as pyg
+
+from visualizer.bytesprites.bytesprite import ByteSprite
+from game.utils.vector import Vector
+from visualizer.bytesprites.bytesprite_factory import ByteSpriteFactory
+
+
+class WallBytespriteFactoryExample(ByteSpriteFactory):
+ """
+ This class is used to demonstrate an example of the Wall Bytesprite. It demonstrates how any class inheriting
+ from ByteSpriteFactory must implement the `update()` and `create_bytesprite()` static methods. These methods may
+ have unique implementations based on how the sprites are meant to look and interact with other objects in the game.
+ """
+ @staticmethod
+ def update(data: dict, layer: int, pos: Vector, spritesheets: list[list[pyg.Surface]]) -> list[pyg.Surface]:
+ """
+ This method implementation simply returns the first spritesheet in the list of given spritesheets. Examining the
+ `ExampleWallSS.png` file, it is clear that there is only one spritesheet, so that is all this method needs to
+ do.
+ :param data:
+ :param layer:
+ :param pos:
+ :param spritesheets:
+ :return:
+ """
+ return spritesheets[0]
+
+ @staticmethod
+ def create_bytesprite(screen: pyg.Surface) -> ByteSprite:
+ """
+ This method takes a screen from Pygame.Surface. That screen is then passed in as a parameter into the
+ returned Bytesprite object.
+ :param screen:
+ :return: a ByteSprite object
+ """
+ return ByteSprite(screen, os.path.join(os.getcwd(), 'visualizer/spritesheets/ExampleWallSS.png'), 1,
+ 8, WallBytespriteFactoryExample.update)
diff --git a/visualizer/config.py b/visualizer/config.py
new file mode 100644
index 0000000..07499f1
--- /dev/null
+++ b/visualizer/config.py
@@ -0,0 +1,59 @@
+from game.utils.vector import Vector
+
+
+class Config:
+ __NUMBER_OF_FRAMES_PER_TURN: int = 4
+ __TILE_SIZE: int = 16
+ __SCALE: int = 5
+ __SCREEN_SIZE: Vector = Vector(x=1366, y=768) # width, height
+ __FRAME_RATE: int = 12
+ __BACKGROUND_COLOR: (int, int, int) = 0, 0, 0
+ __GAME_BOARD_MARGIN_LEFT: int = 440
+ __GAME_BOARD_MARGIN_TOP: int = 100
+ __VISUALIZE_HELD_ITEMS: bool = True
+
+ # if you have an animation, this will be the number of frames the animation goes through for each turn
+ @property
+ def NUMBER_OF_FRAMES_PER_TURN(self) -> int:
+ return self.__NUMBER_OF_FRAMES_PER_TURN
+
+ # this will be the size of the tile-its going to be squares
+ @property
+ def TILE_SIZE(self) -> int:
+ return self.__TILE_SIZE
+
+ # scale is for the tile size being scaled larger,
+ # for ex: if you have a 16x16 tile, we can scale it to 4 so it looks larger
+ @property
+ def SCALE(self) -> int:
+ return self.__SCALE
+
+ # the screen size is the overall screen size
+ @property
+ def SCREEN_SIZE(self) -> Vector:
+ return self.__SCREEN_SIZE
+
+ # frame rate is the overall frame rate
+ @property
+ def FRAME_RATE(self) -> int:
+ return self.__FRAME_RATE
+
+ # this is where you can set the default background color
+ @property
+ def BACKGROUND_COLOR(self) -> (int, int, int):
+ return self.__BACKGROUND_COLOR
+
+ @property
+ def GAME_BOARD_MARGIN_LEFT(self) -> int:
+ return self.__GAME_BOARD_MARGIN_LEFT
+
+ @property
+ def GAME_BOARD_MARGIN_TOP(self) -> int:
+ return self.__GAME_BOARD_MARGIN_TOP
+
+ @property
+ def VISUALIZE_HELD_ITEMS(self) -> bool:
+ return self.__VISUALIZE_HELD_ITEMS
+
+
+
diff --git a/visualizer/main.py b/visualizer/main.py
new file mode 100644
index 0000000..60089df
--- /dev/null
+++ b/visualizer/main.py
@@ -0,0 +1,307 @@
+import math
+import sys
+import os
+
+import numpy
+import pygame
+import cv2
+
+import game.config
+from typing import Callable
+from game.utils.vector import Vector
+from visualizer.adapter import Adapter
+from visualizer.bytesprites.bytesprite import ByteSprite
+from visualizer.config import Config
+from visualizer.utils.log_reader import logs_to_dict
+from visualizer.templates.playback_template import PlaybackButtons
+from threading import Thread
+
+
+class ByteVisualiser:
+
+ def __init__(self):
+ pygame.init()
+ self.config: Config = Config()
+ self.turn_logs: dict[str:dict] = {}
+ self.size: Vector = self.config.SCREEN_SIZE
+ self.tile_size: int = self.config.TILE_SIZE
+
+ self.screen: pygame.display = pygame.display.set_mode(self.size.as_tuple())
+ self.adapter: Adapter = Adapter(self.screen)
+
+ self.clock: pygame.time.Clock = pygame.time.Clock()
+
+ self.tick: int = 0
+ self.bytesprite_factories: dict[int: Callable[[pygame.Surface], ByteSprite]] = {}
+ self.bytesprite_map: [[[ByteSprite]]] = list()
+
+ self.default_frame_rate: int = self.config.FRAME_RATE
+
+ self.playback_speed: int = 1
+ self.paused: bool = False
+ self.recording: bool = False
+
+ # Scale for video saving (division can be adjusted, higher division = lower quality)
+ self.scaled: tuple[int, int] = (self.size.x // 2, self.size.y // 2)
+ self.writer: cv2.VideoWriter = cv2.VideoWriter("out.mp4", cv2.VideoWriter_fourcc(*'mp4v'),
+ self.default_frame_rate, self.scaled)
+
+ def load(self) -> None:
+ self.turn_logs: dict = logs_to_dict()
+ self.bytesprite_factories = self.adapter.populate_bytesprite_factories()
+
+ def prerender(self) -> None:
+ self.screen.fill(self.config.BACKGROUND_COLOR)
+ self.adapter.prerender()
+
+ def render(self, button_pressed: PlaybackButtons) -> bool:
+ # Run playback buttons method
+ self.__playback_controls(button_pressed)
+
+ if self.tick % self.config.NUMBER_OF_FRAMES_PER_TURN == 0:
+ # NEXT TURN
+ if self.turn_logs.get(f'turn_{self.tick // self.config.NUMBER_OF_FRAMES_PER_TURN + 1:04d}') is None:
+ return False
+ self.recalc_animation(self.turn_logs[f'turn_{self.tick // self.config.NUMBER_OF_FRAMES_PER_TURN + 1:04d}'])
+ self.adapter.recalc_animation(
+ self.turn_logs[f'turn_{self.tick // self.config.NUMBER_OF_FRAMES_PER_TURN + 1:04d}'])
+
+ else:
+ # NEXT ANIMATION FRAME
+ self.continue_animation()
+ self.adapter.continue_animation()
+
+ self.adapter.render()
+ pygame.display.flip()
+
+ # If recording, save frames into video
+ if self.recording:
+ self.save_video()
+ # Reduce ticks to just one frame per turn for saving video (can be adjusted)
+ self.tick += self.config.NUMBER_OF_FRAMES_PER_TURN - 1
+ self.tick += 1
+ return True
+
+ # Method to deal with playback_controls in visualizer ran in render method
+ def __playback_controls(self, button_pressed: PlaybackButtons) -> None:
+ # If recording, do not allow button to work
+ if not self.recording:
+ # Save button
+ if PlaybackButtons.SAVE_BUTTON in button_pressed:
+ self.recording = True
+ self.playback_speed = 10
+ self.tick = 0
+ if self.tick % self.config.NUMBER_OF_FRAMES_PER_TURN == 0 and self.paused:
+ self.tick = max(self.tick - self.config.NUMBER_OF_FRAMES_PER_TURN, 0)
+ # Prev button to go back a frame
+ if PlaybackButtons.PREV_BUTTON in button_pressed:
+ turn = self.tick // self.config.NUMBER_OF_FRAMES_PER_TURN
+ self.tick = (turn - 1) * self.config.NUMBER_OF_FRAMES_PER_TURN
+ # Next button to go forward a frame
+ if PlaybackButtons.NEXT_BUTTON in button_pressed:
+ turn = self.tick // self.config.NUMBER_OF_FRAMES_PER_TURN
+ self.tick = (turn + 1) * self.config.NUMBER_OF_FRAMES_PER_TURN
+ # Start button to restart visualizer
+ if PlaybackButtons.START_BUTTON in button_pressed:
+ self.tick = 0
+ # End button to end visualizer
+ if PlaybackButtons.END_BUTTON in button_pressed:
+ self.tick = self.config.NUMBER_OF_FRAMES_PER_TURN * (game.config.MAX_TICKS + 1)
+ # Pause button to pause visualizer (allow looping of turn animation)
+ if PlaybackButtons.PAUSE_BUTTON in button_pressed:
+ self.paused = not self.paused
+ if PlaybackButtons.NORMAL_SPEED_BUTTON in button_pressed:
+ self.playback_speed = 1
+ if PlaybackButtons.FAST_SPEED_BUTTON in button_pressed:
+ self.playback_speed = 2
+ if PlaybackButtons.FASTEST_SPEED_BUTTON in button_pressed:
+ self.playback_speed = 4
+
+ # Method to deal with saving game to mp4 (called in render if save button pressed)
+ def save_video(self) -> None:
+ # Convert to PIL Image
+ new_image = pygame.surfarray.pixels3d(self.screen.copy())
+ # Rotate ndarray
+ new_image = new_image.swapaxes(1, 0)
+ # shrink size for recording
+ new_image = cv2.resize(new_image, self.scaled)
+ # Convert to OpenCV Image with numpy
+ new_image = cv2.cvtColor(new_image, cv2.COLOR_RGBA2BGR)
+ # Write image and go to next turn
+ self.writer.write(new_image)
+
+ def recalc_animation(self, turn_data: dict) -> None:
+ """
+ Determine what bytesprites are needed at which location and calls logic to determine active spritesheet and render
+ :param turn_data: A dictionary of all the turn data for current turn
+ :return: None
+ """
+ game_map: [[dict]] = turn_data['game_board']['game_map']
+ # Iterate on each row on the game map
+ row: list
+ for y, row in enumerate(game_map):
+ # Add rows to bytesprite_map if needed
+ self.__add_rows(y)
+ # Iterate on each tile in the row
+ tile: dict
+ for x, tile in enumerate(row):
+ # Add tiles to row if needed
+ if len(self.bytesprite_map[y]) < x + 1:
+ self.bytesprite_map[y].append(list())
+ # Render layers on tile
+ temp_tile: dict | None = tile
+ z: int = 0
+ while temp_tile is not None:
+ # Add layers if needed
+ self.__add_needed_layers(x, y, z)
+
+ # Create or replace bytesprite at current tile on this current layer
+ self.__create_bytesprite(x, y, z, temp_tile)
+
+ # Call render logic on bytesprite
+ self.bytesprite_map[y][x][z].update(temp_tile, z, Vector(y=y, x=x))
+ # increase iteration
+ temp_tile = temp_tile.get('occupied_by') if temp_tile.get('occupied_by') is not None \
+ else (temp_tile.get('held_item') if self.config.VISUALIZE_HELD_ITEMS
+ else None)
+ z += 1
+
+ # clean up additional layers
+ self.__clean_up_layers(x, y, z)
+
+ # Add rows to bytesprite_map ran in recalc_animation method
+ def __add_rows(self, y: int) -> None:
+ if len(self.bytesprite_map) < y + 1:
+ self.bytesprite_map.append(list())
+
+ # Add layers ran in recalc_animation method
+ def __add_needed_layers(self, x: int, y: int, z: int) -> None:
+ if len(self.bytesprite_map[y][x]) < z + 1:
+ self.bytesprite_map[y][x].append(None)
+
+ # Create bytesprite at current tile ran in recalc_animation method
+ def __create_bytesprite(self, x: int, y: int, z: int, temp_tile: dict | None) -> None:
+ if self.bytesprite_map[y][x][z] is None or \
+ self.bytesprite_map[y][x][z].object_type != temp_tile['object_type']:
+ if len(self.bytesprite_factories) == 0:
+ raise ValueError(f'must provide bytesprite factories for visualization!')
+ # Check that a bytesprite template exists for current object type
+ factory_function: Callable[[pygame.Surface], ByteSprite] | None = self.bytesprite_factories.get(temp_tile['object_type'])
+ if factory_function is None:
+ raise ValueError(
+ f'Must provide a bytesprite for each object type! Missing object_type: {temp_tile["object_type"]}')
+
+ # Instantiate a new bytesprite on current layer
+ self.bytesprite_map[y][x][z] = factory_function(self.screen)
+
+ # Additional layer clean up method ran in recalc_animation method
+ def __clean_up_layers(self, x: int, y: int, z: int) -> None:
+ while len(self.bytesprite_map[y][x]) > z:
+ self.bytesprite_map[y][x].pop()
+
+ def continue_animation(self) -> None:
+ row: list
+ tile: list
+ sprite: ByteSprite
+ [sprite.set_image_and_render() for row in self.bytesprite_map for tile in row for sprite in tile]
+
+ def postrender(self) -> None:
+ self.adapter.clean_up()
+ self.clock.tick(self.default_frame_rate * self.playback_speed)
+
+ def loop(self) -> None:
+ thread: Thread = Thread(target=self.load)
+ thread.start()
+
+ # Start Menu loop
+ in_phase: bool = True
+ self.__start_menu_loop(in_phase)
+
+ thread.join()
+
+ # Playback Menu loop
+ in_phase = True
+ self.__play_back_menu_loop(in_phase)
+
+ # Results
+ in_phase = True
+ self.__results_loop(in_phase)
+
+ if self.recording:
+ self.writer.release()
+
+ sys.exit()
+
+ # Start menu loop ran in loop method
+ def __start_menu_loop(self, in_phase: bool) -> None:
+ while True:
+ for event in pygame.event.get():
+ if event.type == pygame.QUIT: sys.exit()
+
+ if event.type == pygame.KEYDOWN:
+ if event.key == pygame.K_ESCAPE: sys.exit()
+ if event.key == pygame.K_RETURN: in_phase = False
+
+ if in_phase:
+ in_phase = self.adapter.start_menu_event(event)
+
+ self.adapter.start_menu_render()
+
+ pygame.display.flip()
+
+ if not in_phase:
+ break
+ self.clock.tick(self.default_frame_rate * self.playback_speed)
+
+ # Playback menu loop ran in loop method
+ def __play_back_menu_loop(self, in_phase: bool) -> None:
+ while True:
+ playback_buttons: PlaybackButtons = PlaybackButtons(0)
+ # pygame events used to exit the loop
+ for event in pygame.event.get():
+ if event.type == pygame.QUIT: sys.exit()
+
+ if event.type == pygame.KEYDOWN:
+ if event.key == pygame.K_ESCAPE: sys.exit()
+ if event.key == pygame.K_RETURN: in_phase = False
+
+ playback_buttons = self.adapter.on_event(event)
+
+ self.prerender()
+
+ if in_phase:
+ in_phase = self.render(playback_buttons)
+
+ if not in_phase:
+ break
+ self.postrender()
+
+ # Results loop method ran in loop method
+ def __results_loop(self, in_phase: bool) -> None:
+ self.adapter.results_load(self.turn_logs['results'])
+ while True:
+ for event in pygame.event.get():
+ if event.type == pygame.QUIT: sys.exit()
+
+ if event.type == pygame.KEYDOWN:
+ if event.key == pygame.K_ESCAPE: sys.exit()
+ if event.key == pygame.K_RETURN: in_phase = False
+
+ if in_phase:
+ in_phase = self.adapter.results_event(event)
+
+ self.adapter.results_render()
+
+ pygame.display.flip()
+
+ if self.recording:
+ self.save_video()
+
+ if not in_phase:
+ break
+ self.clock.tick(math.floor(self.default_frame_rate * self.playback_speed))
+ self.writer.release()
+
+if __name__ == '__main__':
+ byte_visualiser: ByteVisualiser = ByteVisualiser()
+ byte_visualiser.loop()
diff --git a/visualizer/spritesheets/ExampleSpritesheet.png b/visualizer/spritesheets/ExampleSpritesheet.png
new file mode 100644
index 0000000..63e709b
Binary files /dev/null and b/visualizer/spritesheets/ExampleSpritesheet.png differ
diff --git a/visualizer/spritesheets/ExampleTileSS.png b/visualizer/spritesheets/ExampleTileSS.png
new file mode 100644
index 0000000..83abbab
Binary files /dev/null and b/visualizer/spritesheets/ExampleTileSS.png differ
diff --git a/visualizer/spritesheets/ExampleWallSS.png b/visualizer/spritesheets/ExampleWallSS.png
new file mode 100644
index 0000000..8755adf
Binary files /dev/null and b/visualizer/spritesheets/ExampleWallSS.png differ
diff --git a/visualizer/templates/menu_templates.py b/visualizer/templates/menu_templates.py
new file mode 100644
index 0000000..5487894
--- /dev/null
+++ b/visualizer/templates/menu_templates.py
@@ -0,0 +1,91 @@
+from typing import Any
+
+import pygame
+
+from game.utils.vector import Vector
+from visualizer.utils.button import Button
+from visualizer.utils.text import Text
+
+"""
+This is file is for creating different templates for the start menu of the visualizer. Each different menu screen
+will be a different class. The Basic class is the default template for the screen. Create extra classes for
+different start menu screens. The Basic class can be used as a template on how to do so.
+"""
+
+
+class MenuTemplate:
+ """
+ Menu Template is used as an interface. It provides a screen object from pygame.Surface and a start and
+ results button. These are common attributes to all menus, so they are provided to facilitate creating them.
+
+ This class also provides methods that are expanded upon in the Basic class. Refer to that class' documentation
+ for further detail. These provided methods can be used via inheritance and expanded upon as needed.
+
+ -----
+ Note: The provided buttons are already centered to be in the center of the screen.
+ """
+
+ def __init__(self, screen: pygame.Surface):
+ self.screen: pygame.Surface = screen
+ self.start_button: Button = Button(screen, 'Start Game', lambda: False, font_size=24, padding=10)
+ self.results_button: Button = Button(screen, 'Exit', lambda: False, font_size=24, padding=10)
+ self.start_button.rect.center = Vector.add_vectors(Vector(*self.screen.get_rect().center),
+ Vector(0, 100)).as_tuple()
+
+ self.results_button.rect.center = Vector.add_vectors(Vector(*self.screen.get_rect().center),
+ Vector(0, 100)).as_tuple()
+
+ def start_events(self, event: pygame.event) -> Any:
+ return self.start_button.mouse_clicked(event) if self.start_button.mouse_clicked(
+ event) is not None else True
+
+ def start_render(self) -> None:
+ self.start_button.render()
+
+ def load_results_screen(self, results: dict): ...
+
+ def results_events(self, event: pygame.event) -> Any:
+ return self.results_button.mouse_clicked(event) if self.results_button.mouse_clicked(
+ event) is not None else True
+
+ def results_render(self) -> None:
+ self.results_button.render()
+
+
+class Basic(MenuTemplate):
+ """
+ The Basic class is a default template that can be used for the menu screens. It inherits from MenuTemplate and
+ expands on the inherited methods. If different templates are desired, create more classes in this file. This
+ Basic class can be used as a template for any future classes.
+ """
+
+ def __init__(self, screen: pygame.Surface, title: str):
+ super().__init__(screen)
+ self.title: Text = Text(screen, title, 48)
+ self.title.rect.center = Vector.add_vectors(Vector(*self.screen.get_rect().center),
+ Vector(0, -100)).as_tuple()
+
+ self.winning_team_name: Text = Text(screen, '', 0)
+
+ def start_render(self) -> None:
+ super().start_render()
+ self.title.render()
+
+ def load_results_screen(self, results: dict) -> None:
+ winning_teams = self.__get_winning_teams(results['players'])
+ self.winning_team_name = Text(self.screen, winning_teams, 36)
+ self.winning_team_name.rect.center = self.screen.get_rect().center
+
+ def results_render(self) -> None:
+ super().results_render()
+ self.title.render()
+ self.winning_team_name.render()
+
+ def __get_winning_teams(self, players: list) -> str:
+ m = max(map(lambda player: player['avatar']['score'], players)) # Gets the max score from all results
+
+ # Compares each player in the given list to the max score
+ winners: list = [player['team_name'] for player in players if player['avatar']['score'] == m]
+
+ # Prints the winner(s) from the final results
+ return f'{"Winners" if len(winners) > 1 else "Winner"}: {", ".join(winners)}'
diff --git a/visualizer/templates/playback_template.py b/visualizer/templates/playback_template.py
new file mode 100644
index 0000000..67f138f
--- /dev/null
+++ b/visualizer/templates/playback_template.py
@@ -0,0 +1,93 @@
+from dataclasses import dataclass
+from functools import reduce
+from enum import Flag, auto
+
+import pygame
+
+from game.utils.vector import Vector
+from visualizer.utils.button import Button
+from visualizer.utils.text import Text
+
+"""
+This file is for creating a default template for the playback implementation for the Visualizer. This will be displayed
+while the game is running, with buttons including pause, speed up, slow down, restart, and save to mp4.
+"""
+
+
+class PlaybackButtons(Flag):
+ PAUSE_BUTTON = auto()
+ SAVE_BUTTON = auto()
+ NEXT_BUTTON = auto()
+ PREV_BUTTON = auto()
+ START_BUTTON = auto()
+ END_BUTTON = auto()
+ NORMAL_SPEED_BUTTON = auto()
+ FAST_SPEED_BUTTON = auto()
+ FASTEST_SPEED_BUTTON = auto()
+
+
+class PlaybackTemplate:
+ """
+ Playback Template provides a menu of buttons during runtime of the visualizer to control the playback
+ of the visualizer, including pausing, start, end, frame scrubbing, speeding up, and slowing down, as well as
+ saving it to .mp4
+
+ Buttons from this template are centered at the bottom of the screen, placed in three rows of three
+ """
+
+ def __init__(self, screen: pygame.Surface):
+ self.screen: pygame.Surface = screen
+ self.pause_button: Button = Button(self.screen, 'Pause', lambda: PlaybackButtons.PAUSE_BUTTON, font_size=18)
+ self.next_button: Button = Button(self.screen, 'Next', lambda: PlaybackButtons.NEXT_BUTTON, font_size=18)
+ self.prev_button: Button = Button(self.screen, 'Prev', lambda: PlaybackButtons.PREV_BUTTON, font_size=18)
+ self.start_button: Button = Button(self.screen, 'Start', lambda: PlaybackButtons.START_BUTTON, font_size=18)
+ self.end_button: Button = Button(self.screen, 'End', lambda: PlaybackButtons.END_BUTTON, font_size=18)
+ self.save_button: Button = Button(self.screen, 'Save', lambda: PlaybackButtons.SAVE_BUTTON, font_size=18)
+ self.normal_speed_button: Button = Button(self.screen, '1x', lambda: PlaybackButtons.NORMAL_SPEED_BUTTON,
+ font_size=18)
+ self.fast_speed_button: Button = Button(self.screen, '2x', lambda: PlaybackButtons.FAST_SPEED_BUTTON,
+ font_size=18)
+ self.fastest_speed_button: Button = Button(self.screen, '4x', lambda: PlaybackButtons.FASTEST_SPEED_BUTTON,
+ font_size=18)
+
+ self.prev_button.rect.center = Vector.add_vectors(Vector(*self.screen.get_rect().center),
+ Vector(-80, 225)).as_tuple()
+ self.pause_button.rect.center = Vector.add_vectors(Vector(*self.screen.get_rect().center),
+ Vector(0, 225)).as_tuple()
+ self.next_button.rect.center = Vector.add_vectors(Vector(*self.screen.get_rect().center),
+ Vector(80, 225)).as_tuple()
+ self.start_button.rect.center = Vector.add_vectors(Vector(*self.screen.get_rect().center),
+ Vector(-80, 275)).as_tuple()
+ self.save_button.rect.center = Vector.add_vectors(Vector(*self.screen.get_rect().center),
+ Vector(0, 275)).as_tuple()
+ self.end_button.rect.center = Vector.add_vectors(Vector(*self.screen.get_rect().center),
+ Vector(80, 275)).as_tuple()
+ self.normal_speed_button.rect.center = Vector.add_vectors(Vector(*self.screen.get_rect().center),
+ Vector(-80, 325)).as_tuple()
+ self.fast_speed_button.rect.center = Vector.add_vectors(Vector(*self.screen.get_rect().center),
+ Vector(0, 325)).as_tuple()
+ self.fastest_speed_button.rect.center = Vector.add_vectors(Vector(*self.screen.get_rect().center),
+ Vector(80, 325)).as_tuple()
+
+ def playback_render(self) -> None:
+ self.prev_button.render()
+ self.pause_button.render()
+ self.next_button.render()
+ self.start_button.render()
+ self.save_button.render()
+ self.end_button.render()
+ self.normal_speed_button.render()
+ self.fast_speed_button.render()
+ self.fastest_speed_button.render()
+
+ def playback_events(self, event: pygame.event) -> PlaybackButtons:
+ return reduce(lambda a, b: a | b,
+ (self.pause_button.mouse_clicked(event, default=PlaybackButtons(0)),
+ self.save_button.mouse_clicked(event, default=PlaybackButtons(0)),
+ self.next_button.mouse_clicked(event, default=PlaybackButtons(0)),
+ self.prev_button.mouse_clicked(event, default=PlaybackButtons(0)),
+ self.start_button.mouse_clicked(event, default=PlaybackButtons(0)),
+ self.end_button.mouse_clicked(event, default=PlaybackButtons(0)),
+ self.normal_speed_button.mouse_clicked(event, default=PlaybackButtons(0)),
+ self.fast_speed_button.mouse_clicked(event, default=PlaybackButtons(0)),
+ self.fastest_speed_button.mouse_clicked(event, default=PlaybackButtons(0))))
diff --git a/visualizer/utils/button.py b/visualizer/utils/button.py
new file mode 100644
index 0000000..7b9cceb
--- /dev/null
+++ b/visualizer/utils/button.py
@@ -0,0 +1,278 @@
+import pygame
+import math
+from visualizer.utils.text import Text
+from game.utils.vector import Vector
+from typing import Optional, Callable, Any
+from typing import TypeAlias
+
+# Typing alias for color
+Color: TypeAlias = str | int | tuple[int, int, int, Optional[int]] | list[
+ int, int, int, Optional[int]] | pygame.Color
+
+
+# Class for colors used for button class
+class ButtonColors:
+ """
+ Class for using colors for the Button class
+
+ Can select three colors for both the text and button: default, mouse hover, and mouse clicked
+
+ Parameters:
+ fg_color : Used to store default text color Default - #daa520
+ fg_color_hover : Text color for hovering over button Default - #fff000
+ fg_color_clicked : Text color for clicking button Default - #1ceb42
+ bg_color : bg color for button Default - #7851a9
+ bg_color_hover : bg color for hovering over button Default - #9879bf
+ bg_color_clicked : bg color for clicking button Default - #604187
+
+ In future projects, defaults for button colors should be changed according to style of game for ease of code
+ """
+
+ def __init__(self, fg_color: Color = pygame.Color('#daa520'),
+ fg_color_hover: Color = pygame.Color('#fff000'),
+ fg_color_clicked: Color = pygame.Color('#1ceb42'),
+ bg_color: Color = pygame.Color('#7851a9'),
+ bg_color_hover: Color = pygame.Color('#9879bf'),
+ bg_color_clicked: Color = pygame.Color('#604187')):
+ self.fg_color: Color = fg_color
+ self.fg_color_hover: Color = fg_color_hover
+ self.fg_color_clicked: Color = fg_color_clicked
+ self.bg_color: Color = bg_color
+ self.bg_color_hover: Color = bg_color_hover
+ self.bg_color_clicked: Color = bg_color_clicked
+
+ # Getter methods
+
+ @property
+ def fg_color(self) -> Color:
+ return self.__fg_color
+
+ @property
+ def fg_color_hover(self) -> Color:
+ return self.__fg_color_hover
+
+ @property
+ def fg_color_clicked(self) -> Color:
+ return self.__fg_color_clicked
+
+ @property
+ def bg_color(self) -> Color:
+ return self.__bg_color
+
+ @property
+ def bg_color_hover(self) -> Color:
+ return self.__bg_color_hover
+
+ @property
+ def bg_color_clicked(self) -> Color:
+ return self.__bg_color_clicked
+
+ # Setter methods
+
+ @fg_color.setter
+ def fg_color(self, fg_color: Color) -> None:
+ try:
+ self.__fg_color: Color = pygame.Color(fg_color)
+ except (ValueError, TypeError):
+ raise ValueError(
+ f'{self.__class__.__name__}.fg_color must be a one of the following types: str or int or tuple('
+ f'int, int, int, [int]) or list(int, int, int, [int]) or pygame.Color.')
+
+ @fg_color_hover.setter
+ def fg_color_hover(self, fg_color_hover: Color) -> None:
+ try:
+ self.__fg_color_hover: Color = pygame.Color(fg_color_hover)
+ except (ValueError, TypeError):
+ raise ValueError(
+ f'{self.__class__.__name__}.fg_color_hover must be a one of the following types: str or int or tuple('
+ f'int, int, int, [int]) or list(int, int, int, [int]) or pygame.Color.')
+
+ @fg_color_clicked.setter
+ def fg_color_clicked(self, fg_color_clicked: Color) -> None:
+ try:
+ self.__fg_color_clicked: Color = pygame.Color(fg_color_clicked)
+ except (ValueError, TypeError):
+ raise ValueError(
+ f'{self.__class__.__name__}.fg_color_clicked must be a one of the following types: str or int or tuple('
+ f'int, int, int, [int]) or list(int, int, int, [int]) or pygame.Color.')
+
+ @bg_color.setter
+ def bg_color(self, bg_color: Color) -> None:
+ try:
+ self.__bg_color: Color = pygame.Color(bg_color)
+ except (ValueError, TypeError):
+ raise ValueError(
+ f'{self.__class__.__name__}.bg_color must be a one of the following types: str or int or tuple('
+ f'int, int, int, [int]) or list(int, int, int, [int]) or pygame.Color.')
+
+ @bg_color_hover.setter
+ def bg_color_hover(self, bg_color_hover: Color) -> None:
+ try:
+ self.__bg_color_hover: Color = pygame.Color(bg_color_hover)
+ except (ValueError, TypeError):
+ raise ValueError(
+ f'{self.__class__.__name__}.bg_color_hover must be a one of the following types: str or int or tuple('
+ f'int, int, int, [int]) or list(int, int, int, [int]) or pygame.Color.')
+
+ @bg_color_clicked.setter
+ def bg_color_clicked(self, bg_color_clicked: Color) -> None:
+ try:
+ self.__bg_color_clicked: Color = pygame.Color(bg_color_clicked)
+ except (ValueError, TypeError):
+ raise ValueError(
+ f'{self.__class__.__name__}.bg_color_clicked must be a one of the following types: str or int or tuple('
+ f'int, int, int, [int]) or list(int, int, int, [int]) or pygame.Color.')
+
+
+class Button(Text):
+ """
+ Class that creates an intractable button extending the Text class.
+
+ Defaults same as defaults used in Text class.
+ Must give an action the button can perform upon being clicked
+ Can select padding for bg button and amount the border_radius for the bg button
+
+ Parameters:
+ Text : All parameters from the Text class (screen, text, font_size, font_name, fg_color, position)
+ action : Action performed when button is clicked
+ colors : Of type ButtonColors, contains all colors used in Button class Default - ButtonColors()
+ padding : Amount of padding given to bg rect Default - 5
+ click_duration : Duration of click on button (milliseconds) Default - 100
+ border_radius : Level of smoothing to corners of button Default - 5
+
+ In future projects, defaults for button style should be changed according to style of game for ease of code
+ """
+
+ def __init__(self, screen: pygame.Surface, text: str, action: Callable,
+ font_size: int = 12,
+ font_name: str = 'bauhaus93',
+ colors: ButtonColors = ButtonColors(),
+ padding: int = 5,
+ border_radius: int = 5,
+ click_duration: int = 100,
+ position: Vector = Vector(0, 0)):
+ super().__init__(screen, text, font_size, font_name, colors.fg_color, position)
+ self.colors: ButtonColors = colors
+ self.padding: int = padding
+ self.border_radius: int = border_radius
+ self.click_duration: int = click_duration
+ self.action: Callable = action
+ # Get mouse used for interaction of buttons
+ self.mouse: pygame.mouse = pygame.mouse
+ # Set fg_color to color of text
+ colors.fg_color = self.color
+ # Set current bg color to bg color
+ self.__bg_current_color: Color = colors.bg_color
+ # Set up counter system to display clicked colors
+ self.__isClicked: int = math.floor(self.click_duration + 1)
+ self.__clickedTime: int = 0
+
+ # Getter methods
+
+ @property
+ def colors(self) -> ButtonColors:
+ return self.__colors
+
+ @property
+ def padding(self) -> int:
+ return self.__padding
+
+ @property
+ def border_radius(self) -> int:
+ return self.__border_radius
+
+ @property
+ def click_duration(self) -> int:
+ return self.__click_duration
+
+ @property
+ def mouse(self) -> pygame.mouse:
+ return self.__mouse
+
+ @property
+ def action(self) -> Callable:
+ return self.__action
+
+ # Setter methods
+
+ @colors.setter
+ def colors(self, colors: ButtonColors) -> None:
+ if colors is None or not isinstance(colors, ButtonColors):
+ raise ValueError(f'{self.__class__.__name__}.colors must be of type ButtonColors')
+ self.__colors = colors
+
+ @padding.setter
+ def padding(self, padding: int) -> None:
+ if padding is None or not isinstance(padding, int):
+ raise ValueError(f'{self.__class__.__name__}.padding must be an int.')
+ self.__padding = padding
+
+ @border_radius.setter
+ def border_radius(self, border_radius: int) -> None:
+ if border_radius is None or not isinstance(border_radius, int):
+ raise ValueError(f'{self.__class__.__name__}.border_radius must be an int.')
+ self.__border_radius = border_radius
+
+ @click_duration.setter
+ def click_duration(self, click_duration: float) -> None:
+ if click_duration is None or not isinstance(click_duration, int):
+ raise ValueError(f'{self.__class__.__name__}.click_duration must be an int.')
+ self.__click_duration = click_duration
+
+ @mouse.setter
+ def mouse(self, mouse: pygame.mouse) -> None:
+ if mouse is None:
+ raise ValueError(f'{self.__class__.__name__}.mouse must be of type pygame.mouse')
+ self.__mouse: pygame.mouse = mouse
+
+ @action.setter
+ def action(self, action: Callable) -> None:
+ if action is None or not isinstance(action, Callable):
+ raise ValueError(f'{self.__class__.__name__}.action must be of type Callable')
+ self.__action = action
+
+ # Methods
+
+ # Method to get the bg rect for the button
+ def get_bg_rect(self) -> pygame.Rect:
+ self.position = Vector(*self.rect.topleft)
+ return pygame.Rect(
+ [self.rect.x - self.padding, self.rect.y - self.padding, self.rect.width + (self.padding * 2),
+ self.rect.height + (self.padding * 2)])
+
+ # Method that executes action parameter
+ def execute(self, *args, **kwargs) -> Any:
+ return self.action(*args, **kwargs)
+
+ # Method for rendering button, called by render method in adapter class
+ def render(self) -> None:
+ # Count isClicked up by seconds (get_ticks gets time in milliseconds)
+ self.__isClicked = math.floor(pygame.time.get_ticks() - self.__clickedTime)
+ # Get bg_rect
+ bg_rect: pygame.Rect = self.get_bg_rect()
+ # Hover logic for button
+ # If the clicked color has not been visible for ~1sec, do not change
+ if self.__isClicked > self.click_duration:
+ self.color = self.colors.fg_color
+ self.__bg_current_color = self.colors.bg_color
+ # If mouse position collides with rect, change to hover color
+ if bg_rect.collidepoint(self.__mouse.get_pos()):
+ self.color = self.colors.fg_color_hover
+ self.__bg_current_color = self.colors.bg_color_hover
+ pygame.draw.rect(self.screen, self.__bg_current_color, bg_rect, border_radius=self.border_radius)
+ # Render text on top of button
+ super().render()
+
+ # Method for when button is clicked, called by on_event method in adapter
+ def mouse_clicked(self, event: pygame.event, default: Any = None, *args, **kwargs) -> Any:
+ # Get bg_rect
+ bg_rect: pygame.Rect = self.get_bg_rect()
+ # If both the mouse is hovering over the button and clicks, change color and execute self.action
+ if bg_rect.collidepoint(self.__mouse.get_pos()) and event.type == pygame.MOUSEBUTTONDOWN and \
+ event.button == 1:
+ self.__isClicked = 0
+ self.__clickedTime = pygame.time.get_ticks()
+ self.color = self.colors.fg_color_clicked
+ self.__bg_current_color = self.colors.bg_color_clicked
+ return self.execute(*args, **kwargs)
+ return default
diff --git a/visualizer/utils/log_reader.py b/visualizer/utils/log_reader.py
new file mode 100644
index 0000000..ee8c1d1
--- /dev/null
+++ b/visualizer/utils/log_reader.py
@@ -0,0 +1,11 @@
+from pathlib import Path
+import game.config as gc
+import json
+
+
+def logs_to_dict() -> dict:
+ temp: dict = {}
+ for file in Path(gc.LOGS_DIR).glob('*.json'):
+ with open(file, 'r') as f:
+ temp[file.stem] = json.load(f)
+ return temp
diff --git a/visualizer/utils/spritesheet.py b/visualizer/utils/spritesheet.py
new file mode 100644
index 0000000..0c4bd15
--- /dev/null
+++ b/visualizer/utils/spritesheet.py
@@ -0,0 +1,33 @@
+import pygame
+
+
+class SpriteSheet:
+ def __init__(self, filename):
+ """Load the sheet."""
+ try:
+ self.sheet = pygame.image.load(filename).convert()
+ except pygame.error as e:
+ print(f"Unable to load spritesheet image: {filename}")
+ raise SystemExit(e)
+
+ def image_at(self, rectangle, colorkey=None):
+ """Load a specific image from a specific rectangle."""
+ # Loads image from x, y, x+offset, y+offset.
+ rect = pygame.Rect(rectangle)
+ image = pygame.Surface(rect.size).convert()
+ image.blit(self.sheet, (0, 0), rect)
+ if colorkey is not None:
+ if colorkey == -1:
+ colorkey = image.get_at((0, 0))
+ image.set_colorkey(colorkey, pygame.RLEACCEL)
+ return image
+
+ def images_at(self, rects, colorkey=None):
+ """Load a bunch of images and return them as a list."""
+ return [self.image_at(rect, colorkey) for rect in rects]
+
+ def load_strip(self, rect, image_count, colorkey=None):
+ """Load a whole strip of images, and return them as a list."""
+ tups = [(rect[0] + rect[2] * x, rect[1], rect[2], rect[3])
+ for x in range(image_count)]
+ return self.images_at(tups, colorkey)
diff --git a/visualizer/utils/text.py b/visualizer/utils/text.py
new file mode 100644
index 0000000..0cd204c
--- /dev/null
+++ b/visualizer/utils/text.py
@@ -0,0 +1,148 @@
+import pygame
+from game.utils.vector import Vector
+from typing import Optional, TypeAlias
+
+# Typing alias for color
+Color: TypeAlias = str | int | tuple[int, int, int, Optional[int]] | list[
+ int, int, int, Optional[int]] | pygame.Color
+
+
+class Text:
+ """
+ Class that creates text to be displayed in the visualizer
+
+ Defaults used unless otherwise stated:
+ font: Bauhaus93
+ color: #daa520 (yellowish)
+ position: Vector(0, 0) (representing pixels on screen, top left pixel)
+
+ Parameters:
+ screen : Screen being used for display
+ font_size : Font size used for text
+ font_name : Name of font used for text
+ color : Color used for text
+ position : Position of text to be displayed
+ text : Text to be displayed
+
+ In future projects, defaults for text style should be changed according to style of game for ease of code
+ """
+
+ def __init__(self, screen: pygame.Surface, text: str, font_size: int, font_name: str = 'bauhaus93',
+ color: Color = pygame.Color('#daa520'), position: Vector = Vector(0, 0)):
+ self.__is_init = True
+ self.screen: pygame.Surface = screen
+ self.font_size: int = font_size
+ self.font_name: str = font_name
+ # Get selected font from list of fonts
+ self.__font: pygame.font.Font = pygame.font.SysFont(self.font_name, self.font_size)
+ self.color: Color = color
+ self.position: Vector = position
+ self.text: str = text
+ # SysFont, adjust size
+ # Render text with color
+ self.__text_surface: pygame.Surface = self.__font.render(self.text, True, self.color)
+ # get rectangle used
+ self.__rect: pygame.Rect = self.__text_surface.get_rect()
+ # Set top left position of rect to position
+ self.__rect.topleft = self.position.as_tuple()
+ self.__is_init = False
+
+ # Render text and rectangle to screen
+ def render(self) -> None:
+ self.position = Vector(*self.__rect.topleft)
+ self.screen.blit(self.__text_surface, self.__rect)
+
+ # Getter methods
+ @property
+ def screen(self) -> pygame.Surface:
+ return self.__screen
+
+ @property
+ def text(self) -> str:
+ return self.__text
+
+ @property
+ def font_name(self) -> str:
+ return self.__font_name
+
+ @property
+ def font_size(self) -> int:
+ return self.__font_size
+
+ @property
+ def color(self) -> pygame.Color:
+ return self.__color
+
+ @property
+ def position(self) -> Vector:
+ return self.__position
+
+ @property
+ def rect(self) -> pygame.Rect:
+ return self.__rect
+
+ # Setter methods
+ @screen.setter
+ def screen(self, screen: pygame.Surface) -> None:
+ if screen is None or not isinstance(screen, pygame.Surface):
+ raise ValueError(f'{self.__class__.__name__}.screen must be of type pygame.Surface.')
+ self.__screen: pygame.Surface = screen
+
+ @text.setter
+ def text(self, text: str) -> None:
+ if text is None or not isinstance(text, str):
+ raise ValueError(f'{self.__class__.__name__}.text must be a str.')
+ self.__text: str = text
+ # Reevaluate text
+ self.__text_surface: pygame.Surface = self.__font.render(self.text, True, self.color)
+ self.__rect: pygame.Rect = self.__text_surface.get_rect()
+ self.__rect.topleft = self.position.as_tuple()
+
+ @font_name.setter
+ def font_name(self, font_name: str) -> None:
+ if font_name is None or not isinstance(font_name, str):
+ raise ValueError(f'{self.__class__.__name__}.font_name must be a str.')
+ self.__font_name: str = font_name
+ if self.__is_init: return
+ # Reevaluate text with new font
+ self.__font: pygame.font.Font = pygame.font.SysFont(self.font_name, self.font_size)
+ self.__text_surface: pygame.Surface = self.__font.render(self.text, True, self.color)
+ self.__rect: pygame.Rect = self.__text_surface.get_rect()
+ self.__rect.topleft = self.position.as_tuple()
+
+ @font_size.setter
+ def font_size(self, font_size: int) -> None:
+ if font_size is None or not isinstance(font_size, int):
+ raise ValueError(f'{self.__class__.__name__}.font_size must be an int.')
+ self.__font_size: int = font_size
+ if self.__is_init: return
+ # Reevaluate text with new font size
+ self.__font: pygame.font.Font = pygame.font.SysFont(self.font_name, self.font_size)
+ self.__text_surface: pygame.Surface = self.__font.render(self.text, True, self.color)
+ self.__rect: pygame.Rect = self.__text_surface.get_rect()
+ self.__rect.topleft = self.position.as_tuple()
+
+ @color.setter
+ def color(self, color: Color) -> None:
+ try:
+ self.__color: pygame.Color = pygame.Color(color)
+ if self.__is_init:
+ return
+ # Reevaluate text with new font color
+ self.__text_surface: pygame.Surface = self.__font.render(self.text, True, self.color)
+ self.__rect: pygame.Rect = self.__text_surface.get_rect()
+ self.__rect.topleft = self.position.as_tuple()
+ except (ValueError, TypeError):
+ raise ValueError(
+ f'{self.__class__.__name__}.color must be a one of the following types: str or int or tuple(int, int, '
+ f'int, [int]) or list(int, int, int, [int]) or pygame.Color.')
+
+ @position.setter
+ def position(self, position: Vector) -> None:
+ if position is None or not isinstance(position, Vector):
+ raise ValueError(f'{self.__class__.__name__}.position must be a Vector.')
+ self.__position: Vector = position
+ if self.__is_init:
+ return
+ # Reevaluate text position with new position
+ self.__rect.topleft = self.position.as_tuple()
diff --git a/wrapper/__main__.py b/wrapper/__main__.py
index 3bbd6ab..ec0998c 100644
--- a/wrapper/__main__.py
+++ b/wrapper/__main__.py
@@ -4,6 +4,7 @@
from game.utils.generate_game import generate
import game.config
import argparse
+from visualizer.main import ByteVisualiser
if __name__ == '__main__':
# Setup Primary Parser
@@ -14,6 +15,9 @@
# Generate Subparser
gen_subpar = spar.add_parser('generate', aliases=['g'], help='Generates a new random game map')
+
+ gen_subpar.add_argument('-seed', '-s', action='store', type=int, nargs='?', dest='seed',
+ help='Allows you to pass a seed into the generate function.')
# Run Subparser and optionals
run_subpar = spar.add_parser('run', aliases=['r'],
@@ -25,6 +29,14 @@
run_subpar.add_argument('-quiet', '-q', action='store_true', default=False,
dest='q_bool', help='Runs your AI... quietly :)')
+
+ # Visualizer Subparser and optionals
+ vis_subpar = spar.add_parser('visualize', aliases=['v'],
+ help='Runs the visualizer! "v -h" shows more options')
+
+ all_subpar = spar.add_parser('gen,run,vis', aliases=['grv'],
+ help='Generate, Run, Visualize! "grv -h" shows more options')
+
# Parse Command Line
par_args = par.parse_args()
@@ -33,7 +45,10 @@
# Generate game options
if action in ['generate', 'g']:
- generate()
+ if par_args.seed:
+ generate(par_args.seed)
+ else:
+ generate()
# Run game options
elif action in ['run', 'r']:
@@ -52,6 +67,17 @@
engine = Engine(quiet)
engine.loop()
+ elif action in ['visualize', 'v']:
+ visualiser = ByteVisualiser()
+ visualiser.loop()
+
+ elif action in ['gen,run,vis', 'grv']:
+ generate()
+ engine = Engine(False)
+ engine.loop()
+ visualiser = ByteVisualiser()
+ visualiser.loop()
+
# Print help if no arguments are passed
if len(sys.argv) == 1:
print("\nLooks like you didn't tell the launcher what to do!"