aroberge / reeborg-docs

Documentation (Python tutorial and how to use Reeborg) in multiple languages
http://reeborg.ca/docs/en/
Creative Commons Zero v1.0 Universal
2 stars 7 forks source link

The third version of code mentioned in "basics/rule2.html" #11

Open onelife opened 6 years ago

onelife commented 6 years ago

I will first write a simple program without any comments followed by a second version with comments added and a third version ... slightly less readable; however, I will make the same error in all three programs. Can you spot it more easily in the first program orthe second?

I can't find the third version. Is it removed? And ""orthe" should be "or the".

aroberge commented 6 years ago

Thanks for this. I used to have 3 examples of the same program but reduced it to 2 and never changed the text. I will need to fix that, as well as the typo "or the".

onelife commented 6 years ago

Instead of generating a new issue ticket, I think I'd better list the issues I found in the same one.

"basics/challenges1.rst"

Reeborg is lost in a maze. Have a look at the worlds Maze 1 and Maze 2. Can you think of a way to write a program that could get Reeborg out of both of these mazes? Later, you will learn how to do this and, in fact, you will write a program that could help Reeborg get out of almost any maze you could think of.

There is only one maze world: Maze

Once you have done that, select world Hurdles 2: that's an indoor race, and therefore shorter. (It is also the one illustrated above.) You should be able to remove a few lines of your program and have Reeborg complete that race as well.

Hurdles 2 is not shorter than Hurdles 1 and I can't see the difference between 1 and 2.

After the storm

Maybe it should be a subsection (markup by ---) instead of a subsubsection (markup by ~~~).

Reeborg's parents are so proud of his work, that they ask him to pick up all the leaves that got blown away in their backyard during the windstorm, as illustrated on Storm 3. Have Reeborg pick up all the leaves and put it in the compost bin.

Maybe you want to mention Storm 4 also.

aroberge commented 6 years ago

Thanks for these reports. I have completely changed many worlds since the tutorial was written, and did not update the tutorial. I apologize for this. I will try to fix all these mistakes today.

aroberge commented 6 years ago

For information:

Previously, Hurdles 2 was with fixed distance and shorter than Hurdles 1. Now, the distance in Hurdles 2 is variable (it is selected randomly each time a program is run) whereas it it still fixed in Hurdles 1.

Previously, Reeborg's orientation was fixed in both Maze worlds; only the starting position distinguished the two worlds. Now, there is a single world but Reeborg's orientation and starting position changes each time a program is run.

onelife commented 6 years ago

"basics/newspaper1.rst"

With the exception of one customer, mentioned below, get the money (tokens) left by the customer.

There is no money left by customer in world Newspaper. :disappointed:

  • Richard Pattis, creator of Karel (an ancestor of Reeborg); Reeborg always leaves a free copy of the newspaper at Pattis's home. Richard Pattis lives on the third floor of his building; the corresponding world is Newspaper 0.
  • The nice Ms. Ada Lovelace, who lives on the third floor of her building, always leaves a couple of extra tokens as a gift to Reeborg; hers is world Newspaper 1.
  • The old curmudgeon Mr. Charles Babbage, who lives on the fifth floor, always pays the exact amount, leaving no tip for Reeborg; his world is Newspaper 2

"basics/library.rst"

When the French library is imported, the online help (available via "Addition options" -> "Help") is updated to include all the French functions available. The only restriction however is that function arguments, such as "token" in take("token") must still be specified in English. To use a version completely translated in French, you must go to Le monde de Reeborg <http://reeborg.ca/monde.html>_

aroberge commented 6 years ago

I still need to update the tutorial... However, I just added back a Newspaper world with tokens present (and mentioning Ada Lovelace! :-) )

You are certainly free to change any language reference from French to Chinese! Do what you think is right!

aroberge commented 6 years ago

(I still have to update the corresponding French version.)

aroberge commented 6 years ago

The "Help" available from the additional menu no longer exists; I removed any mention of it from library.rst. I will need to write somewhere more detailed information about help() including the Javascript version. This should probably be included in https://github.com/aroberge/reeborg-howto after I finish migrating the existing content from https://github.com/aroberge/reeborg-world-creation

onelife commented 6 years ago

"basics/at_goal.rst"

    def move_until_done():
        if at_goal():
            # something
        move()
        if object_here():
            # something
            # something else
            # something else again

    repeat 42:
        move_until_done()

Complete the above (in the Python Code editor) and make sure it works for all four worlds mentioned above.

I think, it doesn't work for Tokens 4 which is similar to Tokens 5.

    from my_lib import turn_right
    def jump_over_hurdle():
        # some definitions

    def move_and_jump_until_done():
        # something
        if at_goal():
            done()
        # something

    repeat 42:
        move_and_jump_until_done()

while.rst

Instead of using this description of repeated blocks of code, programmers describe this as a loop: that is, you start with the first instruction (do_1()) inside the code block, continue with all the others until you reach the last instruction (do_3()), then loop back, or go back, to the test just before the beginning of the block and see if the condition is satisfied; if not, you repeat once again the cycle. If the condition never becomes False, you keep repeating and end up with an infinite loop.

I think should be if yes.

aroberge commented 6 years ago

at_goal.rst

This has been rewritten a few days ago. See https://github.com/aroberge/reeborg-docs/commit/233635d9a215129bd63d41d975f0ddc252cd7885

while.rst

Thanks. I changed it to if so.

onelife commented 6 years ago

surprises.rst

The program works for Hurdles 4 but is judged as "desired longer than taken". I think the RUR.check_path function may have some issue.

aroberge commented 6 years ago

The problem for Hurdles 4 was in the way I was recording the correct path as I was building it. I was recording the same point twice at the bottom of the hurdle after jumping over it. It should be fixed now.