View Single Post
ITSE1429 Lab2-RE
Junior Member
Status: Offline
Posts: 11
Join Date: Sep 2014
Default ITSE1429 Lab2-RE - 10-18-2014, 10:26 AM


The Lab2 is a great learning exercise.

It was not too hard to develop methods to work ok as non-loop. I used a my first method, getlloop, jump and continue 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 my first method I defined a number variable and an If/Else to control decision for getlloop, jump & continue methods. I set this number variable value in my continue loop based on string input. More below.

The getlloop method obtains the count for actual twirls and provides this value into a variable defined by jump 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 continue method to pass information to my first method), 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 my first method (this target choice shows up in the dropdown list). Continuing this example, my first method has the variable definition. In final form, the set value statement in continue 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 getloop logic was developed similarly: I want getloop to inform the jump method. The jump method had the definition for number of twirls variable. In getloop method I first used a dummy variable, then set value, and from the dropdown pointed to the jump 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.

Reply With Quote