Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Base Class Implemenations #17

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions docs/code_structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@
-- can return applicable list based on item type

[class] Environment
[dict] Environment Configuration
[set] Environment Configuration

[class] Build
[ref] Tree
[ref] Player

[class] Tree
[str] version
[dict] All Nodes (addressable by Node ID)
[dict] Selected Nodes (addressable by Node ID)
[set] All Nodes (addressable by Node ID)
[set] Allocated Nodes (addressable by Node ID)

[class] Player
[enum] Class Selection
[enum] Ascendancy Selection
[dict] Stats (e.g. Str/Dex/Int, Hit/Crit, Life/Mana, Block/Spell Block/Evade/Dodge, etc.)
[dict] Item Slots
[set] Stats (e.g. Str/Dex/Int, Hit/Crit, Life/Mana, Block/Spell Block/Evade/Dodge, etc.)
[set] Item Sets
[per slot ref] Item
[optional list] Minions
[optional set] Minions

[class] Item
[dict] Attribute requirements
Expand All @@ -43,24 +43,26 @@

[class] Minion
[ref] Player
[dict] Stats
[set] Stats
[ref list] Items
[ref list] Skills
[int] Quantity

[class] EnemyModel (e.g. Shaper, Maven)
[dict] Stats (e.g. Str/Dex/Int, Hit/Crit, Life/Mana, Block/Spell Block/Evade/Dodge, etc.)
[str] Name
[set] Stats (e.g. Str/Dex/Int, Hit/Crit, Life/Mana, Block/Spell Block/Evade/Dodge, etc.)

[class] Simulator
[ref] Environment(s)
[ref list] Build(s)
[ref] Enemy Model(s)

[class] Analytics Module
[module] Analytics Module
[func] Node Comparison
[func] Item Comparison
[func] Gem Comparison
[func] Minion Comparison

[list] Saved Builds
[set] Saved Builds

[dict] UI API imports/exports
34 changes: 34 additions & 0 deletions src/Build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env python3

"""
Build Class

[class] Build
[ref] Tree
[ref] Player
"""

import Tree
import Player


class Build:
def __init__(self, name: str = "temp") -> None:
self.name = name
self.tree_ref = Tree.Tree()
self.player_ref = Player.Player()

def __repr__(self) -> str:
ret_str = f"[BUILD]: '{self.name}'\n"
ret_str += f"{self.tree_ref}"
ret_str += f"{self.player_ref}"
return ret_str


def test() -> None:
build = Build()
print(build)


if __name__ == "__main__":
test()
17 changes: 17 additions & 0 deletions src/Enumerations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Enumeration Data for Path of Exile constants
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a module-level docstring.


from enum import Enum


class PlayerClasses(Enum):
SCION = 0
MARAUDER = 1
RANGER = 2
WITCH = 3
DUELIST = 4
TEMPLAR = 5
SHADOW = 6


class PlayerAscendancies(Enum):
NONE = None
45 changes: 45 additions & 0 deletions src/Player.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env python3

"""
Player Class

[class] Player
[enum] Class Selection
[enum] Ascendancy Selection
[set] Stats (e.g. Str/Dex/Int, Hit/Crit, Life/Mana,
Block/Spell Block/Evade/Dodge, etc.)
[set] Item Sets
[per slot ref] Item
[optional set] Minions
"""

from Enumerations import PlayerClasses, PlayerAscendancies
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These enums are currently used in a single place. It's best to keep them as local as possible. When they are used by more than one module on the same package, put them in a separate module. When they are used by more than one package, consider reworking the packages or put them in their own package.



class Player:
def __init__(
self,
player_class: PlayerClasses = PlayerClasses.SCION,
ascendancy: PlayerAscendancies = PlayerAscendancies.NONE,
level: int = 1,
) -> None:
self.player_class = player_class
self.ascendancy = ascendancy
self.level = level
self.stats = set()
self.item_sets = set()
self.minions = set()

def __repr__(self) -> str:
ret_str = f"Level {self.level} {self.player_class.name}"
ret_str += f" {self.ascendancy.value}\n" if self.ascendancy.value else "\n"
return ret_str


def test() -> None:
player = Player()
print(player)


if __name__ == "__main__":
test()
32 changes: 32 additions & 0 deletions src/Tree.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env python3

"""
Tree Class

[class] Tree
[str] version
[set] All Nodes (addressable by Node ID)
[set] Allocated Nodes (addressable by Node ID)
"""

_VERSION_ = "3.17"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider storing version numbers as tuples.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you supply an example ? I'm too new to Python to understand what that means.



class Tree:
def __init__(self, version: str = _VERSION_) -> None:
self.version = version
self.tree_nodes = set()
self.allocated_nodes = set()

def __repr__(self) -> str:
ret_str = f"[TREE]: version '{self.version}'\n"
return ret_str


def test() -> None:
tree = Tree()
print(tree)


if __name__ == "__main__":
test()
Empty file added src/__init__.py
Empty file.