How mate-academy/py-elves-and-dwarves works
Project type and purpose
• This is a Python library/application that models a “meta universe” of player races (Elves and Dwarves) using object-oriented design.
• It defines abstract base classes, concrete subclasses for four player types, plus utility functions to operate on groups of players.
File structure
• Top-level files:
• .flake8, .gitignore, requirements.txt, checklist.md — linting and QA
• README.md — project description and usage guide
• .github/workflows/test.yml — CI test pipeline
• app/
• main.py — entry point defining helper functions (calculate_team_total_rating, elves_concert, feast_of_the_dwarves)
• players/
– player.py — base class Player (abstract)
– elves/
· elf.py — abstract Elf class inherits from Player
· elf_ranger.py — concrete class ElfRanger
· druid.py — concrete class Druid
– dwarves/
· dwarf.py — abstract Dwarf class inherits from Player
· dwarf_warrior.py — concrete class DwarfWarrior
· dwarf_blacksmith.py — concrete class DwarfBlacksmith
• tests/
• test_main.py — unit tests for main.py functions
README for additional insights
• Confirms inheritance hierarchy: Player → {Elf, Dwarf} → {ElfRanger, Druid, DwarfWarrior, DwarfBlacksmith}
• Describes constructor parameters, protected attributes, methods play_elf_song/eat_favourite_dish, get_rating logic, player_info formatting
• Specifies utility functions and their expected behaviors
Elements
• Clear labels for each module/class component
• Concrete classes in another (e.g., blue rectangles)
• Contains: calculate_team_total_rating, elves_concert, feast_of_the_dwarves
– Elf (abstract) ← inherits from Player
– ElfRanger → inherits Elf
– Druid → inherits Elf
– Dwarf (abstract) ← inherits from Player
– DwarfWarrior → inherits Dwarf
– DwarfBlacksmith → inherits Dwarf
• From each concrete class, annotate methods: get_rating(), player_info(), plus play_elf_song() or eat_favourite_dish()