1.2. Dragon Sprint 1

  • Assignment: Dragon Sprint 1

  • Complexity: easy

  • Lines of code: 20 lines

  • Time: 21 min

  • Warning: Don't delete code, assignment will be continued

../../_images/dragon.gif

Figure 1.17. Firkraag dragon from game Baldur's Gate II: Shadows of Amn

1.2.1. English

Non-functional requirements:

  1. Commit and push the current state of the repository

  2. Modify the game code from the previous version of the task

  3. Save the code to solve the task in the dragon directory

  4. When finished, add all files from dragon to the repository

  5. Commit and push changes to a central repository (Github)

Functional requirements:

  1. Create Dragon with:

    1. Name

    2. Position on the screen

  2. Dragon can:

    1. Have position set to any place on the screen

    2. Move in any direction by specified value

  3. Assume left-top screen corner as an initial coordinates position:

    1. Going right add to x

    2. Going left subtract from x

    3. Going up subtract from y

    4. Going down add to y

  4. Run the game:

    1. Create dragon named "Wawelski"

    2. Set Dragon's initial position to x=50, y=120

    3. Set new position to x=10, y=20

    4. Move dragon left by 10 and down by 20

    5. Move dragon left by 10 and right by 15

    6. Move dragon right by 15 and up by 5

    7. Move dragon down by 5

1.2.2. Polish

Wymagania niefunkcjonalne:

  1. Zapisz (commit) i wypchnij (push) aktualny stan repozytorium

  2. Zmodyfikuj kod gry z poprzedniej wersji zadania

  3. Zapisz kod do rozwiązania zadania w katalogu dragon

  4. Po zakończeniu dodaj wszystkie pliki z dragon do repozytorium

  5. Zapisz i wypchnij zmiany do centralnego repozytorium (Github)

Wymagania funkcjonalne:

  1. Stwórz Smoka

  2. Smok ma:

    1. Nazwą

    2. Pozycją na ekranie

  1. Smok może:

    1. Być ustawiony w dowolne miejsce ekranu

    2. Być przesuwany w którymś z kierunków o zadaną wartość

  2. Przyjmij górny lewy róg ekranu za punkt początkowy:

    1. Idąc w prawo dodajesz x

    2. Idąc w lewo odejmujesz x

    3. Idąc w górę odejmujesz y

    4. Idąc w dół dodajesz y

  3. Scenariusz gry:

    1. Stwórz smoka o nazwie "Wawelski"

    2. Ustaw inicjalną pozycję smoka na x=1, y=2

    3. Ustaw nową pozycję na x=10, y=20

    4. Przesuń smoka w lewo o 10 i w dół o 20

    5. Przesuń smoka w lewo o 10 i w prawo o 15

    6. Przesuń smoka w prawo o 15 i w górę o 5

    7. Przesuń smoka w dół o 5

  4. Pozycja końcowa powinna być: x=20, y=40

1.2.3. Hints

  • Shortest solution has 24 lines of code

  • It is not a mistake: 'left by 10 and right by 15'

  • There are no errors in the assignment (testes on more than 300 trainings)

1.2.4. Solution

  • EN: Note, that this will spoil your fun and learning

  • PL: Zwróć uwagę, że to zepsuje Twoją zabawę i naukę

  • Solution