Skip to content

Commit 1756264

Browse files
MarcinOstaszewskideshipu
authored andcommitted
Gestures.rst (#7)
* introduction for buttons * Translated 4 paragraphs of tutorial buttons * First translation for hello.rst * Few fixes for hello.rst * Final fixes * half translated buttons page * next part of page buttons.rst * last part of translation buttons.rst * Update hello.rst according to review comments Fixed as suggested by deshipu in deshipu#3 * Change translation of word "flash" * Grammar fix * Corrections * one word chenged * changed; my propositions: else if -> jeśli jednak; else -> w pozostałych przypadkach * Translate buttons (#2) * introduction for buttons * Translated 4 paragraphs of tutorial buttons * half translated buttons page * next part of page buttons.rst * last part of translation buttons.rst * Corrections * one word chenged * changed; my propositions: else if -> jeśli jednak; else -> w pozostałych przypadkach * Poprawki od Radomira * Kolejne poprawki od Radomira + korekta literówek * Przywrócona właściwa wersja akapitu * tlumaczenie tutoriala modulu Random * Translation of gestures.rst (#1) * update gestures.rst - requested changes and minor corrections * update gestures.rst (#3) * Revert "tlumaczenie tutoriala modulu Random" This reverts commit fce2ece.
1 parent 15e361c commit 1756264

1 file changed

Lines changed: 59 additions & 56 deletions

File tree

docs/tutorials/gestures.rst

Lines changed: 59 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
1-
Gestures
1+
Gesty
22
--------
33

4-
The really interesting side-effect of having an accelerometer is gesture
5-
detection. If you move your BBC micro:bit in a certain way (as a gesture) then
6-
MicroPython is able to detect this.
4+
Naprawdę interesującym efektem ubocznym posiadania akcelerometru jest wykrywanie gestów.
5+
Jeśli poruszysz swoim micro:bitem w pewien specjalny sposób (jak przy wykonywaniu gestu),
6+
MicroPython jest w stanie to wykryć.
77

8-
MicroPython is able to recognise the following gestures: ``up``, ``down``,
9-
``left``, ``right``, ``face up``, ``face down``, ``freefall``, ``3g``, ``6g``,
10-
``8g``, ``shake``. Gestures are always represented as strings. While most of
11-
the names should be obvious, the ``3g``, ``6g`` and ``8g`` gestures apply when
12-
the device encounters these levels of g-force (like when an astronaut is
13-
launched into space).
8+
MicroPython potrafi rozpoznać następujące gesty: ``up`` (ang. w górę), ``down`` (ang. w dół),
9+
``left`` (ang. w lewo), ``right`` (ang. w prawo), ``face up`` (ang. zwrócony w górę),
10+
``face down`` (ang. zwrócony w dół), ``freefall`` (ang. swobodne spadanie), ``3g``, ``6g``,
11+
``8g``, ``shake`` (ang. potrząśnięcie). Gesty zawsze są reprezentowane przez ciągi znaków.
12+
Podczas gdy większość z tych nazw powinna być oczywista, gesty ``3g``, ``6g`` oraz ``8g``
13+
odnoszą się do sytuacji, w której na urządzenie oddziałują odpowiadające poziomy przeciążenia
14+
(jak na astronautę, kiedy jest wystrzeliwany w kosmos).
1415

15-
To get the current gesture use the ``accelerometer.current_gesture`` method.
16-
Its result is going to be one of the named gestures listed above. For example,
17-
this program will only make your device happy if it is face up::
16+
Aby pobrać aktualny gest użyj metody ``accelerometer.current_gesture``.
17+
Jej wynikiem będzie jeden z nazwanych gestów z powyższej listy. Na przykład,
18+
ten program sprawi, że Twoje urządzenie będzie szczęśliwe tylko,
19+
kiedy będzie zwrócone ku górze::
1820

1921
from microbit import *
2022

@@ -25,46 +27,46 @@ this program will only make your device happy if it is face up::
2527
else:
2628
display.show(Image.ANGRY)
2729

28-
Once again, because we want the device to react to changing circumstances we
29-
use a ``while`` loop. Within the *scope* of the loop the current gesture is
30-
read and put into ``gesture``. The ``if`` conditional checks if ``gesture`` is
31-
equal to ``"face up"`` (Python uses ``==`` to test for equality, a single
32-
equals sign ``=`` is used for assignment - just like how we assign the gesture
33-
reading to the ``gesture`` object). If the gesture is equal to ``"face up"``
34-
then use the display to show a happy face. Otherwise, the device is made to
35-
look angry!
30+
Ponieważ chcemy, aby urządzenie reagowało na zmieniające się okoliczności,
31+
używamy pętli ``while``. Wewnątrz pętli aktualny gest jest odczytywany
32+
i podstawiany pod zmienną ``gesture``. Warunek ``if`` sprawdza, czy ``gesture``
33+
jest równa ``"face up"`` (Python używa ``==`` aby sprawdzić równość, pojedynczy
34+
znak równości ``=`` jest używany do przypisywania - tak samo jak przypisujemy
35+
odczyt gestu do objektu ``gesture``). Jeżeli ``gesture`` jest równa ``"face up"``,
36+
używamy wyświetlacza do pokazania szczęśliwej miny. W przeciwnym przypadku,
37+
urządzenie wyświetli rozzłoszczoną minę.
3638

3739
Magic-8
3840
+++++++
3941

40-
A Magic-8 ball is a toy first invented in the 1950s. The idea is to ask
41-
it a yes/no question, shake it and wait for it to reveal the truth. It's rather
42-
easy to turn into a program::
42+
Magiczna bila 8 to zabawka wynaleziona w latach pięćdziesiątych. Pomysł polega na zadaniu
43+
pytania typu tak lub nie, potrząśnięciu bilą i poczekaniu, aż wyjawi prawdę. Raczej
44+
łatwo jest napisać działający w taki sposób program::
4345

4446
from microbit import *
4547
import random
4648

4749
answers = [
48-
"It is certain",
49-
"It is decidedly so",
50-
"Without a doubt",
51-
"Yes, definitely",
52-
"You may rely on it",
53-
"As I see it, yes",
54-
"Most likely",
55-
"Outlook good",
56-
"Yes",
57-
"Signs point to yes",
58-
"Reply hazy try again",
59-
"Ask again later",
60-
"Better not tell you now",
61-
"Cannot predict now",
62-
"Concentrate and ask again",
63-
"Don't count on it"
64-
"My reply is no",
65-
"My sources say no",
66-
"Outlook not so good",
67-
"Very doubtful",
50+
"To pewne",
51+
"Zdecydowanie tak",
52+
"Bez wątpienia",
53+
"Tak, z pewnością",
54+
"Możesz na tym polegać",
55+
"Jak ja to widzę, tak",
56+
"Najprawdopodobniej",
57+
"Wygląda dobrze",
58+
"Tak",
59+
"Znaki wskazują na tak",
60+
"Odpowiedź niejasna, spróbuj ponownie",
61+
"Zapytaj ponownie później",
62+
"Lepiej, abym teraz nie powiedziała",
63+
"Nie mogę teraz przewidzieć",
64+
"Skoncentruj się i zapytaj ponownie",
65+
"Nie licz na to",
66+
"Moja odpowiedź brzmi nie",
67+
"Moje źródła mówią nie",
68+
"Nie wygląda to dobrze",
69+
"Bardzo wątpliwe",
6870
]
6971

7072
while True:
@@ -74,17 +76,18 @@ easy to turn into a program::
7476
sleep(1000)
7577
display.scroll(random.choice(answers))
7678

77-
Most of the program is a list called ``answers``. The actual game is in the
78-
``while`` loop at the end.
79+
Większość programu to tablica nazwana ``answers`` (ang. odpowiedzi).
80+
Sama gra znajduje się w pętli ``while`` na końcu.
7981

80-
The default state of the game is to show the character ``"8"``. However, the
81-
program needs to detect if it has been shaken. The ``was_gesture`` method uses
82-
its argument (in this case, the string ``"shake"`` because we want to detect
83-
a shake) to return a ``True`` / ``False`` response. If the device was shaken
84-
the ``if`` conditional drops into its block of code where it clears the screen,
85-
waits for a second (so the device appears to be thinking about your question)
86-
and displays a randomly chosen answer.
82+
Domyślny stan gry wyświetla cyfrę ``"8"``. Jednak program musi wykryć,
83+
że nastąpiło potrząśnięcie. Metoda ``was_gesture`` używa swojego argumentu (w tym przypadku
84+
ciągu ``"shake"``, ponieważ chcemy wykryć potrząśnięcie) i zwraca ``True`` lub ``False``.
85+
86+
Jeżeli urządzenie było potrząśnięte, warunek ``if`` wykonuje swój blok kodu, w którym
87+
czyści ekran, czeka przez sekundę (aby urządzenie wyglądało, jakby zastanawiało się nad
88+
twoim pytaniem), a następnie wyświetla losowo wybraną odpowiedź.
89+
90+
Nie masz wrażenia, że jest to najlepszy program na świecie? Co mógłbyś
91+
zrobić, aby "oszukać" i uzyskać zawsze pozytywną lub negatywną odpowiedź?
92+
(Podpowiedź: użyj przycisków).
8793

88-
Why not ask it if this is the greatest program ever written? What could you do
89-
to "cheat" and make the answer always positive or negative? (Hint: use the
90-
buttons.)

0 commit comments

Comments
 (0)