ucblogo-code icon indicating copy to clipboard operation
ucblogo-code copied to clipboard

Finish object logo

Open jrincayc opened this issue 5 years ago • 8 comments

Finish the object oriented logo additions. These are in #ifdef OBJECTS blocks.

jrincayc avatar Jan 03 '20 15:01 jrincayc

Note that this is being worked on in the fork: https://github.com/pahihu/ucblogo-code

jrincayc avatar Jan 26 '20 13:01 jrincayc

A lot of these problems have been fixed thanks to @pahihu The configure script now has a --enable-objects argument.

The manual does not mention things like kindof

So, besides the manual, is there anything else that needs to be fixed to close this bug?

jrincayc avatar Feb 03 '20 23:02 jrincayc

Just make sure USUAL works. The canonical example is

make "double-turtle kindof turtle talkto :double.turtle to forward :dist usual.forward 2*:dist end

make "dashed.turtle kindof turtle talkto :dashed.turtle to forward :dist if :dist < 10 [usual.forward :dist stop] penup usual.forward 5 pendown usual.forward 5 forward :dist-10 end

make "turtle1 (oneof :double.turtle :dashed.turtle) tell :turtle1 [pendown forward 100]

make "turtle2 (oneof :dashed.turtle :double.turtle) tell :turtle2 [pendown forward 100]

What should happen is that they both move 200 steps, but turtle1 does 20 length-5 dashes while turtle2 does 10 length-10 dashes.

If this all actually works I'll add the object primitives to the manual. I'll just copy the ones from the Object Logo manual. Pretty sure I wrote that section anyway... :)

Oh this depends on having turtles as a primitive object class. Is that implemented? I'll try reading the code.

brianharvey avatar Feb 04 '20 04:02 brianharvey

Hi,

The canonical example didn’t worked. I have changed the USUAL implementation, and now it works as expected. Pushed the changes to GitHub.

I have attached the working Logo code and the example screenshot.

Andras Pahi

On 2020. Feb 4., at 5:29, Brian Harvey [email protected] wrote:

Just make sure USUAL works. The canonical example is

make "double-turtle kindof turtle talkto :double.turtle to forward :dist usual.forward 2*:dist end

make "dashed.turtle kindof turtle talkto :dashed.turtle to forward :dist if :dist < 10 [usual.forward :dist stop] penup usual.forward 5 pendown usual.forward 5 forward :dist-10 end

make "turtle1 (oneof :double.turtle :dashed.turtle) tell :turtle1 [pendown forward 100]

make "turtle2 (oneof :dashed.turtle :double.turtle) tell :turtle2 [pendown forward 100]

What should happen is that they both move 200 steps, but turtle1 does 20 length-5 dashes while turtle2 does 10 length-10 dashes.

If this all actually works I'll add the object primitives to the manual. I'll just copy the ones from the Object Logo manual. Pretty sure I wrote that section anyway... :)

Oh this depends on having turtles as a primitive object class. Is that implemented? I'll try reading the code.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jrincayc/ucblogo-code/issues/21?email_source=notifications&email_token=ADTEB26DHOECTVISL6WIXMTRBDVKDA5CNFSM4KCO74AKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKWJ2JI#issuecomment-581737765, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADTEB2YL6S4EZZXGVF6EJ6DRBDVKDANCNFSM4KCO74AA.

pahihu avatar Feb 04 '20 16:02 pahihu

@pahihu Thanks, I made a merge request out of it.

jrincayc avatar Feb 05 '20 03:02 jrincayc

So, I realized later that there's no TURTLE primitive because ucblogo doesn't have multiple turtles. There's actually a whole bunch of "system objects" in Object Logo, at least some of which might be interesting. See attached chart. Files, turtles, windows, menus, menu items are things it would be great to have in version 7.0. Maybe I can throw some students at that. system-objects

brianharvey avatar Feb 07 '20 04:02 brianharvey

Hi,

I’ve made a simple Turtle class in Object Logo, so you can actually have multiple turtles. The code is attached.

Andras

On 2020. Feb 7., at 5:45, Brian Harvey [email protected] wrote:

So, I realized later that there's no TURTLE primitive because ucblogo doesn't have multiple turtles. There's actually a whole bunch of "system objects" in Object Logo, at least some of which might be interesting. See attached chart. Files, turtles, windows, menus, menu items are things it would be great to have in version 7.0. Maybe I can throw some students at that. https://user-images.githubusercontent.com/3885074/74001745-99204a00-4921-11ea-917a-6b0339972ce6.png — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jrincayc/ucblogo-code/issues/21?email_source=notifications&email_token=ADTEB22ACHDHKXSNJSYBVTTRBTRO3A5CNFSM4KCO74AKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELBWTJQ#issuecomment-583231910, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADTEB26WQIWPZAZLCXLPQH3RBTRO3ANCNFSM4KCO74AA.

pahihu avatar Feb 07 '20 07:02 pahihu

Excellent! Thanks so much!

brianharvey avatar Feb 07 '20 08:02 brianharvey