mirror of
https://github.com/mfocko/blog.git
synced 2024-11-25 14:21:55 +01:00
fix(algorithms): fix the admonitions in Karel
Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
parent
2fb4765b1f
commit
2ff21c708c
1 changed files with 12 additions and 21 deletions
|
@ -79,12 +79,15 @@ You can see an example of such map here:
|
||||||
As a first step write down any ideas and things that you have noticed or came to
|
As a first step write down any ideas and things that you have noticed or came to
|
||||||
your mind. Ideally:
|
your mind. Ideally:
|
||||||
|
|
||||||
- Write down a nested list of the problems, e.g.
|
1. Write down a nested list of the problems
|
||||||
|
2. Write down list of problems that can happen
|
||||||
|
3. Write down **anything** you consider important to solving the problem
|
||||||
|
|
||||||
:::info Example
|
:::tip Example
|
||||||
|
|
||||||
Problem: I want to find out whether the display on smartphone should rotate.
|
**Problem**: I want to find out whether the display on smartphone should rotate.
|
||||||
|
|
||||||
|
- nested list of problems
|
||||||
- Check if display has been rotated
|
- Check if display has been rotated
|
||||||
- Read data from some sensor
|
- Read data from some sensor
|
||||||
- From what sensor
|
- From what sensor
|
||||||
|
@ -92,30 +95,16 @@ your mind. Ideally:
|
||||||
- How do I communicate with the sensor?
|
- How do I communicate with the sensor?
|
||||||
- What is the meaning of the data that I got?
|
- What is the meaning of the data that I got?
|
||||||
- How can I process it?
|
- How can I process it?
|
||||||
|
- any problems that can happen
|
||||||
:::
|
|
||||||
|
|
||||||
- Write down list of problems that can happen, e.g.
|
|
||||||
|
|
||||||
:::info Example continued
|
|
||||||
|
|
||||||
Following the same problem.
|
|
||||||
|
|
||||||
- What if the sensor doesn't work?
|
- What if the sensor doesn't work?
|
||||||
- What if the data doesn't conform to the specification?
|
- What if the data doesn't conform to the specification?
|
||||||
- What if my formulas are wrong?
|
- What if my formulas are wrong?
|
||||||
|
- anything important
|
||||||
:::
|
|
||||||
|
|
||||||
- Write down **anything** you consider important to solving the problem, e.g.
|
|
||||||
|
|
||||||
:::info Example continued once again
|
|
||||||
|
|
||||||
- I could probably use gyroscope.
|
- I could probably use gyroscope.
|
||||||
- I should probably look up the datasheet for that module.
|
- I should probably look up the datasheet for that module.
|
||||||
- I could write some tests to verify that my computations are correct.
|
- I could write some tests to verify that my computations are correct.
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
## »Rough« pseudocode
|
## »Rough« pseudocode
|
||||||
|
|
||||||
|
@ -155,7 +144,9 @@ the ZIP-file, you can there:
|
||||||
- `skeleton.py` - skeleton for your solution, needs to be put in the same directory
|
- `skeleton.py` - skeleton for your solution, needs to be put in the same directory
|
||||||
as `karel_tk.py` and takes path to the world as a first argument, example usage:
|
as `karel_tk.py` and takes path to the world as a first argument, example usage:
|
||||||
|
|
||||||
|
```
|
||||||
$ python3 skeleton.py stairs.kw
|
$ python3 skeleton.py stairs.kw
|
||||||
|
```
|
||||||
|
|
||||||
- of course, this file can be renamed ;)
|
- of course, this file can be renamed ;)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue