Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
55 changes: 55 additions & 0 deletions cs-CZ/code/target-practice-solution/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
## Import kódu knihovny

from p5 import *
from random import randint


# Zde je funkce mouse_pressed
def mouse_pressed():
# print('🎯')
if hit_colour == Color("modrá").hex:
print("Trefil jsi vnější kruh, 50 bodů!")
elif hit_colour == Color("červená").hex:
print("Trefil jsi vnitřní kruh, 200 bodů!")
elif hit_colour == Color("žlutá").hex:
print("Trefil jsi střed, 500 bodů!")
else:
print("Vedle! Žádné body!")


# Zde je funkce shoot_arrow
def shoot_arrow():
global hit_colour
arrow_x = randint(100, 300)
arrow_y = randint(100, 300)
hit_colour = get(arrow_x, arrow_y).hex
# print(hit_colour)
fill("brown")
circle(arrow_x, arrow_y, 15)


def setup():
# Zde si nastav svou hru
size(400, 400)
no_stroke()


def draw():
# Co dělat v každém snímku
fill("cyan")
rect(0, 0, 400, 250)
fill("lightgreen")
rect(0, 250, 400, 150)
fill("brown")
triangle(150, 350, 200, 150, 250, 350)
fill("blue")
circle(200, 200, 170)
fill("red")
circle(200, 200, 110) # Nakresli vnitřní kruh
fill("yellow")
circle(200, 200, 30) # Nakresli prostřední kruh
shoot_arrow()


# Toto si ponech pro spuštění kódu
run(frame_rate=2)
3 changes: 3 additions & 0 deletions cs-CZ/code/target-practice-solution/project_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: 'Cílové příklady procvičování'
identifier: 'target-practice-solution'
type: 'python'
24 changes: 24 additions & 0 deletions cs-CZ/code/target-practice-starter/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## Import kódu knihovny
from p5 import *
from random import randint

# Zde je funkce mouse_pressed


# Zde je funkce shoot_arrow


def setup():
# Zde si nastav svou hru
size(400, 400)
no_stroke()


def draw():
# Co dělat v každém snímku
fill("cyan")
rect(0, 0, 400, 250)


# Toto si ponech pro spuštění kódu
run(frame_rate=2)
3 changes: 3 additions & 0 deletions cs-CZ/code/target-practice-starter/project_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: "Cílové procvičování"
identifier: 'target-practice-starter'
type: 'python'
Binary file added cs-CZ/images/alternative-colours.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cs-CZ/images/arrow-centre.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cs-CZ/images/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cs-CZ/images/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cs-CZ/images/blue-circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cs-CZ/images/blue-points.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cs-CZ/images/blue_circle_points.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cs-CZ/images/bottom-right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cs-CZ/images/centre.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cs-CZ/images/circle-coords.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cs-CZ/images/fire_arrow.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cs-CZ/images/green-grass.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cs-CZ/images/missed_no_points.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cs-CZ/images/points-scored.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cs-CZ/images/quiz-colour.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cs-CZ/images/random-side.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cs-CZ/images/showcase_rocket.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cs-CZ/images/sky_stroke.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cs-CZ/images/stand_coords.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cs-CZ/images/target-stand.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cs-CZ/images/target_area.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cs-CZ/images/target_printed.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cs-CZ/images/three-circles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cs-CZ/images/top-left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cs-CZ/images/upgrade-ideas.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cs-CZ/images/yellow-points.png
32 changes: 32 additions & 0 deletions cs-CZ/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: Cílová praxe
hero_image: images/banner.png
description: Použij Python k nakreslení cíle a získej body tím, že do něj zasáhneš šípy
meta_title: Projekty kódování Python pro děti a dospívající | Cílová praxe
meta_description: Nauč se Python s projekty kódování pro děti a dospívající nadace Raspberry Pi Foundation. Použij Python k nakreslení cíle a zaznamenávej body tím, že ho zasáhneš šípy.
version: 4
listed: true
copyedit: true
last_tested: "2021-10-06"
steps:
- title: Co budeš dělat
- title: Nakresli trávu
- title: Nakresli svůj cíl
completion:
- engaged
- title: Přidej šíp
- title: Jakou barvu jsi trefil?
- title: Získej body
completion:
- internal
- title: Rychlý kvíz
knowledge_quiz:
path: quiz1
version: 1
questions: 3
passing_score: 3
completion:
- external
- title: Výzva
challenge: true
- title: Co můžeš dělat dál?
27 changes: 27 additions & 0 deletions cs-CZ/python-comments.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Co dělat v každém snímku

Nakreslete vnitřní kruh

Nakreslete střední kruh

Zde je funkce shoot_arrow

Zde je funkce mouse_pressed

Trefil jsi vnější kruh, 50 bodů!

Trefil jsi vnitřní kruh, 200 bodů!

Trefil jsi střed, 500 bodů!

Trefil jsi střed, 500 bodů!

Netrefil jsi! Bez bodů!

Super rychlé

Docela rychle

Velmi rychle

Rychlost nebyla rozpoznána!
9 changes: 9 additions & 0 deletions cs-CZ/python-translatable.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
shoot_arrow

arrow_x

arrow_y

hit_colour

speed
63 changes: 63 additions & 0 deletions cs-CZ/quiz1/question_1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
## Rychlý kvíz

Odpovězte na tři otázky. Existují tipy, které vás dovedou ke správné odpovědi.

Po zodpovězení každé otázky klikněte na **Zkontrolujte moji odpověď**.

Příjemnou zábavu!

--- question ---
---
legend: Otázka 1 ze 3
---
Ve svém projektu jsi přidal `randint(100, 300)` do funkce `shoot_arrow()`. Co dělá `randint(100, 300)`?

--- code ---
---
language: python
---

def shoot_arrow():
global hit_colour
arrow_x = randint(100, 300)
arrow_y = randint(100, 300)

--- /code ---

--- choices ---

- (x) Vybere náhodné celé číslo mezi 100 a 300.

--- feedback ---

Správně. Tím vyberete náhodnou souřadnici x pro vaši šipku.

--- /feedback ---

- ( ) Způsobí, že se šipka náhodně pohybuje po obrazovce.

--- feedback ---

Ne tak docela. Tento kód je součástí toho, jak se šipka pohybuje náhodně, ale k dosažení tohoto cíle potřebujete také jiný kód.

--- /feedback ---

- () Získá barvu, kterou zasáhla šipka.

--- feedback ---

Ne tak docela. K získání barvy by se použila funkce get().

--- /feedback ---

- ( ) Nakreslí kruh náhodné velikosti.

--- feedback ---

Ne tak docela. K nakreslení kruhu lze použít funkci circle().

--- /feedback ---

--- /choices ---

--- /question ---
56 changes: 56 additions & 0 deletions cs-CZ/quiz1/question_2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

--- question ---
---
legend: Otázka 2 ze 3
---

Ve svém projektu jsi použil `if` , `elif` and `else` , abys zkontroloval, na kterou barvu šipka přistála.

V níže uvedeném příkladu má proměnná s názvem `speed` uloženu hodnotu `6`. Když je spuštěn příkaz `if`, co se vytiskne ve výstupní oblasti?

--- code ---
---
language: python
---
speed = 6

if speed == 7:
print('Super rychlá')
elif speed == 5:
print('Docela rychlá')
elif speed == 6:
print('Velmi rychlá')
else:
print('Rychlost nebyla rozpoznána!')

--- /code ---

--- choices ---

- (x) `Velmi rychlá`

--- feedback ---

Správně! Proměnné **speed** byla přiřazena hodnota `6`. Podmínka `speed == 6` bude vyhodnocena jako **True** a tím pádem bude vytisknuto `Velmi rychlá`.

--- /feedback ---

- ( ) `Rychlost nebyla rozpoznána!`

--- feedback ---

Ne tak docela. Podívej se na hodnotu přiřazenou proměnné **speed**.

--- /feedback ---

- ( ) Nic se nevytiskne

--- feedback ---

Zkus to znovu, `else` se použije jako poslední možnost, když jsou všechny výše uvedené podmínky nepravdivé. Prohlédni si znovu podmínky, jsou některé z podmínek pravdivé?

--- /feedback ---

--- /choices ---

--- /question ---
64 changes: 64 additions & 0 deletions cs-CZ/quiz1/question_3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@

--- question ---
---
legend: Otázka 3 ze 3
---

Kruh se nakreslí pomocí následujícího kódu:

--- code ---
---
language: python
---

def setup():
size(400, 400)
fill(0, 255, 0)
no_stroke()

def draw():
circle(0, 0, 300)

run()

--- /code ---

Který z obrázků níže ukazuje správnou polohu tohoto kruhu ve výstupní oblasti?

--- choices ---

- ( ) ![Zelený kruh se středem v pravém dolním rohu výstupní oblasti.](images/bottom-right.png)

--- feedback ---

Ne tak docela, pro vycentrování kruhu v pravém dolním rohu by souřadnice musely být stejné jako velikost obrazovky. V tomto příkladu by elipsa byla `circle(400, 400, 300)`.

--- /feedback ---

- ( ) ![Zelený kruh uprostřed oblasti výstupu.](images/centre.png)

--- feedback ---

Ne tak docela, aby se kruh vycentroval na střed, souřadnice by musely být poloviční velikosti obrazovky. V tomto příkladu `circle(200, 200, 300)`.

--- /feedback ---

- (x) ![Zelený kruh se středem v levém horním rohu výstupní oblasti.](images/top-left.png)

--- feedback ---

Správně! Tento kruh je vycentrován na souřadnicích (0,0), v levém horním rohu obrazovky.

--- /feedback ---

- ( ) ![Zelený kruh se středem směrem k pravé horní straně výstupní oblasti.](images/random-side.png)

--- feedback ---

Ne, tento kruh by měl kód `circle(350, 150, 300)`, aby byl vycentrován směrem k pravé horní části obrazovky. Souřadnice `x` udává, jak daleko přes obrazovku je elipsa, a souřadnice `y` je, jak daleko je na obrazovce.

--- /feedback ---

--- /choices ---

--- /question ---
Empty file added cs-CZ/resources/.keep
Empty file.
Binary file added cs-CZ/resources/Target Practice.zip
Binary file not shown.
Empty file added cs-CZ/solutions/.keep
Empty file.
Binary file added cs-CZ/solutions/Target Practice.zip
Binary file not shown.
29 changes: 29 additions & 0 deletions cs-CZ/step_1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## Co budeš dělat

Použijte Python k nakreslení cíle a získejte body tím, že do něj zasáhnete šipkami.

--- print-only ---

![Lukostřelecký terč se zásahovým bodem na vnějším kruhu. Text „Trefil jsi vnější kruh, 50 bodů!“ se zobrazuje vespod](images/blue-points.png){:width="640px"}

--- /print-only ---

--- no-print ---
<div style="display: flex; flex-wrap: wrap">
<div style="flex-basis: 175px; flex-grow: 1">

Hru spustíte kliknutím na tlačítko **Spustit** níže. Když se tečka objeví na cíli 🎯, klikněte myší (nebo klepněte na tablet) a vystřelte šíp.

<iframe src="https://editor.raspberrypi.org/cs-CZ/embed/viewer/target-practice-solution" width="400" height="710" frameborder="0" marginwidth="0" marginheight="0" allowfullscreen>
</iframe>
</div>
</div>

--- /no-print ---

<div class="c-survey-banner" style="width:100%">
<a class="c-survey-banner__link" href="https://form.raspberrypi.org/f/code-editor-feedback" target="_blank">Zúčastněte se našeho průzkumu</a> a pomozte nám zlepšit náš editor kódu!
</div>



Loading
Loading