# %% License
# - Copyright 2025, Matt Harasymczuk <matt@python3.info>
# - This code can be used only for learning by humans
# - This code cannot be used for teaching others
# - This code cannot be used for teaching LLMs and AI algorithms
# - This code cannot be used in commercial or proprietary products
# - This code cannot be distributed in any form
# - This code cannot be changed in any form outside of training course
# - This code cannot have its license changed
# - If you use this code in your product, you must open-source it under GPLv2
# - Exception can be granted only by the author
# %% Run
# - PyCharm: right-click in the editor and `Run Doctest in ...`
# - PyCharm: keyboard shortcut `Control + Shift + F10`
# - Terminal: `python -m doctest -v myfile.py`
# %% About
# - Name: Recap Project Dragon
# - Difficulty: medium
# - Lines: 13
# - Minutes: 21
# %% English
# 1. Define class `Dragon` with methods
# 2. Define method `__init__()` takes arguments three arguments:
# `name`, `position_x` (default 0) and `position_y=0` (default 0)
# and sets them as fields
# 3. Define method `set_position()` which takes `x` and `y`
# and sets `position_x` and `position_y`
# 4. Define method `get_position()` which returns
# a tuple with `position_x` and `position_y`
# 5. Define method `move()` which takes four arguments
# `left`, `right`, `up`, `down`, all defaults to 0
# and changes `position_x` and `position_y` accordingly
# 6. Top left corner is (0, 0):
# - Moving right increases `position_x`
# - Moving left decreases `position_x`
# - Moving down increases `position_y`
# - Moving up decreases `position_y`
# 7. Run doctests - all must succeed
# %% Polish
# 1. Zdefiniuj klasę `Dragon`
# 2. Zdefiniuj metodę `__init__()` przyjmującą trzy argumenty:
# `name`, `position_x` (domyślnie 0) i `position_y` (domyślnie 0)
# i ustawia je jako pola
# 3. Zdefiniuj metodę `set_position()` która przyjmuje `x` i `y`
# i ustawia `position_x` i `position_y`
# 4. Zdefiniuj metodę `get_position()` która zwraca
# krotkę z `position_x` i `position_y`
# 5. Zdefiniuj metodę `move()` która przyjmuje cztery argumenty
# `left`, `right`, `up`, `down`, wszystkie domyślnie 0
# i zmienia `position_x` i `position_y` odpowiednio
# 6. Lewy górny róg to (0, 0):
# - Poruszanie w prawo zwiększa `position_x`
# - Poruszanie w lewo zmniejsza `position_x`
# - Poruszanie w dół zwiększa `position_y`
# - Poruszanie w górę zmniejsza `position_y`
# 7. Uruchom doctesty - wszystkie muszą się powieść
# %% Tests
"""
>>> import sys; sys.tracebacklimit = 0
>>> assert sys.version_info >= (3, 9), \
'Python 3.9+ required'
>>> from inspect import isclass, ismethod
>>> assert isclass(Dragon)
>>> wawelski = Dragon('Wawelski', position_x=50, position_y=100)
>>> wawelski.set_position(x=10, y=20)
>>> wawelski.get_position()
(10, 20)
>>> wawelski.move(left=10, down=20)
>>> wawelski.move(left=10, right=15)
>>> wawelski.move(right=15, up=5)
>>> wawelski.move(down=5)
>>> wawelski.get_position()
(20, 40)
"""
# Define class `Dragon` with methods
#
# Define method `__init__()` takes arguments three arguments:
# `name`, `position_x` (default 0) and `position_y=0` (default 0)
# and sets them as fields
#
# Define method `set_position()` which takes `x` and `y`
# and sets `position_x` and `position_y`
#
# Define method `get_position()` which returns
# a tuple with `position_x` and `position_y`
#
# Define method `move()` which takes four arguments
# `left`, `right`, `up`, `down`, all defaults to 0
# and changes `position_x` and `position_y` accordingly
#
# Top left corner is (0, 0):
# - Moving right increases `position_x`
# - Moving left decreases `position_x`
# - Moving down increases `position_y`
# - Moving up decreases `position_y`
# type: type[Dragon]
...