aroberge / reeborg

Enhanced Karel-the-robot clone
http://reeborg.ca/reeborg.html
Other
47 stars 36 forks source link

Another question about RUR... #460

Closed abixadamj closed 1 year ago

abixadamj commented 2 years ago

Dear @aroberge In Hurdle world, there is a code in OnLoad:

"// The following is going to be called in the Post editor",
    "// we want users to be able to use either Python or Javascript",
    "// to solve this task - so we cannot have Python or Javascript",
    "// specific syntax in either the Pre or the Post editor",
    "RUR.public.my_check = function (failure) {",
    "    if ( RUR.check_path(RUR.public['path']) ) {",
    "        return; // nothing else required.",
    "    }",
    "",

Is there something like RUR.check_intems_in_robot ? Something, which will return values like carries_object() in Python? I want to make a World in which I put random apples and want to check if all apples will be taken by user.

aroberge commented 2 years ago

I can't think of an easy function to use for this purpose. However, it is not needed.

If you look at https://reeborg.ca/reeborg.html?lang=en&mode=python&menu=worlds%2Fmenus%2Freeborg_intro_en.json&name=Around%201%20-%20apple&url=worlds%2Ftutorial_en%2Faround1c.json, you will see that it is such a world.

What you need is to create a world that has at least one goal (say, having Reeborg go to a specific location), but that is otherwise empty. Then, in the OnLoad editor, you add the apples randomly. Since the world has been created with a goal that does not include any apples, it will automatically check at the end to ensure that the apples have all been picked up.

abixadamj commented 2 years ago

Andre - thanks! I did similary, adding goal with "apple" : "all" ;-) And add description that robot have to put all apples there ;-) Thanks once again for clearify the situation. I hope my questions will help others people. PTI member: https://www.linkedin.com/in/adam-jurkiewicz-python-linux/ https://www.linkedin.com/in/adam-jurkiewicz-python-linux/ Python support for teachers: https://matrix.to/#/#python-adam-jurkiewicz:matrix.org https://matrix.to/#/#python-adam-jurkiewicz:matrix.org Teacher · Linux · Python 3 · Git: https://github.com/abixadamj https://github.com/abixadamj Mobile: +48 662 144 425 | Private Chat: @adam.jurkiewicz:matrix.org André Roberge wrote: I can't think of an easy function to use for this purpose. However, it is not needed. If you look at https://reeborg.ca/reeborg.html?lang=en&mode=python&menu=worlds%2Fmenus%2Freeborg_intro_en.json&name=Around%201%20-%20apple&url=worlds%2Ftutorial_en%2Faround1c.json https://reeborg.ca/reeborg.html?lang=en&mode=python&menu=worlds%2Fmenus%2Freeborg_intro_en.json&name=Around%201%20-%20apple&url=worlds%2Ftutorial_en%2Faround1c.json , you will see that it is such a world. What you need is to create a world that has at least one goal (say, having Reeborg go to a specific location), but that is otherwise empty. Then, in the OnLoad editor, you add the apples randomly. Since the world has been created with a goal that does not include any apples, it will automatically check at the end to ensure that the apples have all been picked up. — Reply to this email directly, view it on GitHub https://github.com/aroberge/reeborg/issues/460#issuecomment-1304558659 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ABG2LA56NM7TLVHAAYE5GOLWGZWMJANCNFSM6AAAAAARX43C2M . You are receiving this because you authored the thread.Message ID: @.***>