Alice Community

Alice Community (
-   The Lounge (
-   -   ITSE1429 Lab2-RE (

relliott44444 10-18-2014 10:26 AM

ITSE1429 Lab2-RE

The Lab2 is a great learning exercise.

It was not too hard to develop methods to work ok as non-loop. I used a [I]my first method[/I], [I]getlloop[/I], [I]jump[/I] and[I] continu[/I]e methods. Having loop logic took most of the effort.

Next, the development with functioning loop control & passing data needed thorough understanding of textbook chapter readings. In [I]my first method[/I] I defined a number variable and an If/Else to control decision for [I]getlloop[/I], [I]jump[/I] & [I]continue[/I] methods. I set this number variable value in my continue loop based on string input. More below.

The [I]getlloop[/I] method obtains the count for actual twirls and provides this value into a variable defined by [I]jump[/I] method.

I was greatly aided by use of watch this variable and watch this parameter Alice features for testing.

Coding technique: First define a variable (a dummy I guess) in a method from which you want to pass a value to another method (e.g. I want the [I]continue[/I] method to pass information to [I]my first method[/I]), then I am able to refer to it in set value. In the set value statement I must then substitute this local variable name with name of variable defined in [I]my first method[/I] (this target choice shows up in the dropdown list). Continuing this example, [I]my first method[/I] has the variable definition. In final form, the set value statement in [I]continue[/I] method now points to it. Once this logic is setup, I may delete the local dummy variable. Then play world and verify with watch this, as noted.

My [I]getloop[/I] logic was developed similarly: I want [I]getloop[/I] to inform the [I]jump[/I] method. The [I]jump[/I] method had the definition for number of twirls variable. In [I]getloop[/I] method I first used a dummy variable, then set value, and from the dropdown pointed to the [I]jump[/I] method variable.

P.S. Loops and events can seem similar but from textbook we know they are different. This Lab2 requires the use of a loops 1) to spin, and 2) to continue.


chriskcox 11-05-2014 07:13 PM

Great job Richard. I wish it came as easy for me. Really struggling.

All times are GMT -5. The time now is 05:42 PM.

Copyright ©2020, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.