1.3. Dragon Sprint 2¶
Assignment: Dragon Sprint 2
Complexity: easy
Lines of code: 20 lines
Time: 21 min
Warning: Don't delete code, assignment will be continued

Figure 1.18. Firkraag dragon from game Baldur's Gate II: Shadows of Amn¶
1.3.1. English¶
Non-functional requirements:
Commit and push the current state of the repository
Modify the game code from the previous version of the task
Save the code to solve the task in the
dragon
directoryWhen finished, add all files from
dragon
to the repositoryCommit and push changes to a central repository (Github)
Functional requirements:
Create Dragon with:
Name
Health points, default random
int
in range from 50 to 100Dragon can:
Make damage in range from 5 to 20
Take damage
Run the game:
Create dragon named "Wawelski"
Dragon makes damage
Make 10 points damage to the dragon
Make 5 points damage to the dragon
Make 3 points damage to the dragon
Make 2 points damage to the dragon
Make 15 points damage to the dragon
Make 25 points damage to the dragon
Make 75 points damage to the dragon
When dragon is dead:
Display
Dragon NAME is dead
, where NAME is dragon's nameDisplay how much gold dropped (random int from 1 to 100)
Display last position (should be: x=20, y=40)
1.3.2. Polish¶
Wymagania niefunkcjonalne:
Zapisz (commit) i wypchnij (push) aktualny stan repozytorium
Zmodyfikuj kod gry z poprzedniej wersji zadania
Zapisz kod do rozwiązania zadania w katalogu
dragon
Po zakończeniu dodaj wszystkie pliki z
dragon
do repozytoriumZapisz i wypchnij zmiany do centralnego repozytorium (Github)
Wymagania funkcjonalne:
Wykorzystaj kod z poprzedniego zadania i dopisz nową funkcjonalność
Smok ma losowe punkty życia z zakresu od 50 do 120
Smok może zadawać komuś losowe obrażenia z przedziału od 5 do 20
Smok może otrzymywać obrażenia
Scenariusz gry:
Stwórz smoka o nazwie "Wawelski"
Ustaw inicjalną pozycję smoka na x=1, y=2
Ustaw nową pozycję na x=10, y=20
Przesuń smoka w lewo o 10 i w dół o 20
Przesuń smoka w lewo o 10 i w prawo o 15
Przesuń smoka w prawo o 15 i w górę o 5
g. Przesuń smoka w dół o 5 i. Smok zadaje obrażenia (5-20) j. Zadaj 10 obrażeń smokowi k. Zadaj 20 obrażeń smokowi l. Zadaj 30 obrażeń smokowi m. Zadaj 40 obrażeń smokowi n. Zadaj 50 obrażeń smokowi
Gdy smok zginie:
Wyświetl
Dragon NAME is dead
, gdzie NAME to nazwa smokaWyświetl ile złota wypadło (losowa liczba od 1 do 100)
Wyświetl ostatnią pozycję (powinna być: x=20, y=40)
1.3.3. Hints¶
Shortest solution has 24 lines of code
There are no errors in the assignment (testes on more than 300 trainings)
from random import randint
randint(a, b)
- random integer betweena
andb
(inclusive!)
1.3.4. Solution¶
EN: Note, that this will spoil your fun and learning
PL: Zwróć uwagę, że to zepsuje Twoją zabawę i naukę