alice-teacher s Digest, Vol 10, Issue 12

Michael Englander MEnglander at naschools.net
Fri May 20 08:44:54 EDT 2011


re:  #3 below:  I've not used Alice for virtual 'bots, but I have used a free program called RobotBasic, which lets you program virtual bots.  However, you can only control one bot at a time.
 
Michael Englander
Information Sciences Department
North Attleboro High School
North Attleboro, MA

________________________________

From: alice-teachers-bounces+menglander=naschools.net at lists.andrew.cmu.edu on behalf of alice-teachers-request at lists.andrew.cmu.edu
Sent: Thu 5/19/2011 4:19 PM
To: alice-teachers at lists.andrew.cmu.edu
Subject: alice-teachers Digest, Vol 10, Issue 12



Send alice-teachers mailing list submissions to
        alice-teachers at lists.andrew.cmu.edu

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers
or, via email, send a message with subject or body 'help' to
        alice-teachers-request at lists.andrew.cmu.edu

You can reach the person managing the list at
        alice-teachers-owner at lists.andrew.cmu.edu

When replying, please edit your Subject line so it is more specific
than "Re: Contents of alice-teachers digest..."


Today's Topics:

   1.  (no subject) (Eric Lozaw)
   2.  robots in Alice (William Stanard)
   3.  New To Alice (jpietryka at lakelandsd.org)
   4. Re:  robots in Alice (Frank Womack)
   5. Re:  (no subject) (Don Slater)


----------------------------------------------------------------------

Message: 1
Date: Thu, 19 May 2011 12:20:10 -0400
From: Eric Lozaw <LozawEr at watertownps.org>
Subject: alice-teacher (no subject)
To: "alice-teachers at lists.andrew.cmu.edu"
        <alice-teachers at lists.andrew.cmu.edu>
Message-ID: <E2E962A35900E748940805CAC4C57AC60B8CA0FC91 at wtexch>
Content-Type: text/plain; charset="iso-8859-1"

Original question
I currently have this problem with putting a list of numbers into order.  Since you can't see the code I'm writing I'll try to explain as clear as possible.  In my program I take in a list of numbers with one method and I do one pass through and get it sorted correctly with another method. As it's being sorted the numbers are taken out of the original list and put into a temporary list. I follow the numbers and it is doing it correctly at this point. After the first pass I then set the original list to equal the temporary list and try to pass through the sort method again.  This is where it gets wierd.  On the second pass the sorting algorithm is trying to use the temporary list and not the list that is called upon in my method.

Response:
Not having a great deal of experience, but I had a similar problem once upon
a time in my college programming days. I think you need to either clear or
delete the temporary list, before doing the pass again.



Reply

I tried clearing the list...and it tried to sort a null set.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.andrew.cmu.edu/mailman/private/alice-teachers/attachments/20110519/be780618/attachment-0001.html

------------------------------

Message: 2
Date: Thu, 19 May 2011 06:57:53 -0400
From: William Stanard <wstanard at palmertrinity.org>
Subject: alice-teacher robots in Alice
To: "'Alice educators'" <alice-teachers at lists.andrew.cmu.edu>
Message-ID: <D70FAEA421990A4F8FC20FE0C2DBCDC393C2E9A625 at EXC2007>
Content-Type: text/plain; charset="us-ascii"

Fellow Alicians,

Not wanting to be left behind in the local (Miami) craze for robots in secondary schools, I wondered if anyone had experience building battling 'bots in Alice.

As I envision it, each contestant would program an Alice object (maybe, for instance, the gorilla robot) to be a warrior and would save that programmed object as a Class (lots of warrior-like methods complete with parameters to input an opponent) for placement in a world created by the Game Master (e.g., the Alice teacher). The robot who scores the most points, wins the contest. Has anyone tried anything like this?

Regards,
Bill

William W. Stanard
Chair, Academic Computing
Member, English Department
Palmer Trinity School
Miami, Florida
(305) 969-4239

The box does not exist


PTS CONFIDENTIALITY NOTICE: This e-mail and any documents, files, and previous messages attached to it may be privileged, confidential or exempt from public disclosure under applicable law.  If you are not the intended recipient, you are hereby notified that any dissemination, distribution or duplication of this communication is strictly prohibited.  If you have received this communication in error, please notify the sender immediately and delete all copies.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.andrew.cmu.edu/mailman/private/alice-teachers/attachments/20110519/82d1d3a9/attachment-0001.html

------------------------------

Message: 3
Date: Thu, 19 May 2011 13:02:00 -0400
From: <jpietryka at lakelandsd.org>
Subject: alice-teacher New To Alice
To: <alice-teachers at lists.andrew.cmu.edu>
Message-ID: <9B470C7AE09F48C193F4C5C92604400B.MAI at AcadiaSys.com>
Content-Type: text/plain; charset="us-ascii"

An HTML attachment was scrubbed...
URL: https://lists.andrew.cmu.edu/mailman/private/alice-teachers/attachments/20110519/83147639/attachment-0001.html

------------------------------

Message: 4
Date: Thu, 19 May 2011 13:20:02 -0500
From: Frank Womack <womackf at carthage.k12.mo.us>
Subject: Re: alice-teacher robots in Alice
To: Alice educators <alice-teachers at lists.andrew.cmu.edu>
Message-ID: <8565B837EB3380418F3CB3CE7E2033FC0168D47D53 at EXCHANGE>
Content-Type: text/plain; charset="utf-8"

You might look at the Carnegie Mellon page http://robotics-academy.org/blog/?p=340. A $7 million initiative that combines Alice with their RobotC language.
Here is an excerpt from that page:
The Alice team will collaborate with the Robotics Academy to add virtual worlds to ROBOTC<http://www.robotc.net/>, a programming language developed by the academy that works with many of the educational robotic platforms used in robot competitions. ?This new ROBOTC capability will allow students to design and test robots in a virtual environment when it would be impractical to do so with a physical robot. We plan to add other programming languages as the project evolves,?

From: alice-teachers-bounces+womackf=carthage.k12.mo.us at lists.andrew.cmu.edu [mailto:alice-teachers-bounces+womackf=carthage.k12.mo.us at lists.andrew.cmu.edu] On Behalf Of William Stanard
Sent: Thursday, May 19, 2011 5:58 AM
To: 'Alice educators'
Subject: alice-teacher robots in Alice

Fellow Alicians,

Not wanting to be left behind in the local (Miami) craze for robots in secondary schools, I wondered if anyone had experience building battling ?bots in Alice.

As I envision it, each contestant would program an Alice object (maybe, for instance, the gorilla robot) to be a warrior and would save that programmed object as a Class (lots of warrior-like methods complete with parameters to input an opponent) for placement in a world created by the Game Master (e.g., the Alice teacher). The robot who scores the most points, wins the contest. Has anyone tried anything like this?

Regards,
Bill

William W. Stanard
Chair, Academic Computing
Member, English Department
Palmer Trinity School
Miami, Florida
(305) 969-4239

The box does not exist


PTS CONFIDENTIALITY NOTICE: This e-mail and any documents, files, and previous messages attached to it may be privileged, confidential or exempt from public disclosure under applicable law.  If you are not the intended recipient, you are hereby notified that any dissemination, distribution or duplication of this communication is strictly prohibited.  If you have received this communication in error, please notify the sender immediately and delete all copies.





--

This email was Anti Virus checked by Astaro Security Gateway. http://www.astaro.com <http://www.astaro.com/> 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.andrew.cmu.edu/mailman/private/alice-teachers/attachments/20110519/6b116797/attachment-0001.html

------------------------------

Message: 5
Date: Thu, 19 May 2011 16:19:24 -0400
From: Don Slater <dslater at andrew.cmu.edu>
Subject: Re: alice-teacher (no subject)
To: Eric Lozaw <LozawEr at watertownps.org>
Cc: Alice Teachers <alice-teachers at lists.andrew.cmu.edu>
Message-ID: <941AA177-9E5F-4543-802E-FE475CED0B90 at andrew.cmu.edu>
Content-Type: text/plain; charset="us-ascii"

Eric,
Thank you for sending me your project. It looks like you are trying to implement a bubble sort.

First of all you are complicating your life by trying to do this using the Alice list structure, when it probably would have been a better choice to use the Alice array structure.

See the attached screen shot on how to create an array instead of a list in Alice.

The list structure is very good for maintaining a set of elements in which you may add, remove, or insert values, and it does a lot of the underlying operations for you, but it is not a very good choice for moving the elements into different positions within the list. You tried to work around this by creating the temporary list, and in fact, in doing this, you ended up trying to create a version of the selection sort.

Let me put into pseudocode what your code is doing.

1) first of all assume that the list "listNums" to be sorted contains the values {40, 30, 20, 10} and "tempList" is empty {}

2) using a loop you are going to look at every number in "listNums"

3) if the second value in listnums < first value (30 < 40) in listNums
        insert the second value into tempList
        remove second value from listNums
    or else
        insert the first value into tempList
        remove firstvalue from listNums
   

But here is the problem. You will insert either 30 into the templist, but it does not actually belong in the first position in this new list. You will also remove it from the listNums, so that listNums is now {40, 20, 10} and tempList is {30}. Also as the loop continues, you will now be comparing 40 and 20, so that 20 will be added to tempList, and removed from listNums, so that listNums is now {40, 10} and tempList is {30, 20}. You will then compare 40 and 10, adding it to the tempList {30, 20, 10} removing it from listNums {40}, and then 40 will be added to templist, so fianlly listNums is now {} and tempList is {30, 20, 10, 40}

You have successfully put 40 into its proper position, but you now need to loop through three more times to get 30, 20, and 10 into position. But the list structure really complicates this, and makes my head hurt trying to think about your next steps.

BTW, setting listNums so that it now refers to templist actually is working.

4) You check  the list, and if it is not sorted, you make one more pass through the list, but that will still not complete the task, and your code does in fact work on the revised templist {30, 20, 10, 40}



A better solution in this case, using the list would be to try a selection sort. The algorithm for this would be

        As long as listNums is not empty
                find the smallest element (which requires another loop)
                insert it at the end of tempList
                remove the current smallest
                cycle back to find the next smallest
               

I have attached a revised version of your program in which I have implemented this selection sort algorithm.

Some comments:

1) I am using the while loop structure, as opposed to "loop" or "for all in order". As I said before, using the list structure does not allow us to directly move values from one position to another in the list. We are forced to use insertions and removals, which requires a lot of extra bookkeeping. You were right to create a new list to insert values in their proper order. You just did not do this enough times. (The Alice array structure does allow you to directly "swap" values in the array, as it provides cleaner access to the index for setting values.)

2) As I am emptying one array to fill the other with the values in appropriate order, using a "While listNums is not empty", works well. "For all in order" also works well.

3) I have comments in the selection sort method to explain what is going on. Please feel free to let me know if you have questions.

4) In your testNumbers method I have added (though currently disabled) three "For all in order" structures that prints out the current values of the lists so you can see the lists after you run the sort. Also, in the details panel underneath the object tree, if you click on the properties tab, you can watch the listNums and tempList property variables as values are added and removed as the program is running.

Please let me know if you have any other questions.

All the best,
Don Slater


-------------- next part --------------
A non-text attachment was scrubbed...
Name: CreateArrayInAlice.png
Type: image/png
Size: 39556 bytes
Desc: not available
Url : https://lists.andrew.cmu.edu/mailman/private/alice-teachers/attachments/20110519/f3b81515/attachment.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: selectionSortV2.a2w
Type: application/octet-stream
Size: 587604 bytes
Desc: not available
Url : https://lists.andrew.cmu.edu/mailman/private/alice-teachers/attachments/20110519/f3b81515/attachment.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DetailsView.png
Type: image/png
Size: 77632 bytes
Desc: not available
Url : https://lists.andrew.cmu.edu/mailman/private/alice-teachers/attachments/20110519/f3b81515/attachment-0001.png
-------------- next part --------------

                

On May 19, 2011, at 12:36 PM, Eric Lozaw wrote:

> yeah I did...I'll try again.  Let me know if it's attached or not. 
>
>
> Eric 
>
> ________________________________________
> From: Don Slater [dslater at andrew.cmu.edu]
> Sent: Thursday, May 19, 2011 12:32 PM
> To: Eric Lozaw
> Subject: Re: alice-teacher (no subject)
>
> Eric,
> Have you sent me the code to look at? If so, I have missed it?
>
> Don Slater
>
> On May 19, 2011, at 12:20 PM, Eric Lozaw wrote:
>
>> Original question
>> I currently have this problem with putting a list of numbers into order.  Since you can't see the code I'm writing I'll try to explain as clear as possible.  In my program I take in a list of numbers with one method and I do one pass through and get it sorted correctly with another method. As it's being sorted the numbers are taken out of the original list and put into a temporary list. I follow the numbers and it is doing it correctly at this point. After the first pass I then set the original list to equal the temporary list and try to pass through the sort method again.  This is where it gets wierd.  On the second pass the sorting algorithm is trying to use the temporary list and not the list that is called upon in my method.
>>
>> Response:
>> Not having a great deal of experience, but I had a similar problem once upon
>> a time in my college programming days. I think you need to either clear or
>> delete the temporary list, before doing the pass again.
>>
>> Reply
>> I tried clearing the list...and it tried to sort a null set.
>>
>> _______________________________________________
>> alice-teachers mailing list
>> alice-teachers at lists.andrew.cmu.edu
>> https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers
> <bubbleSort.a2w>


------------------------------

_______________________________________________
alice-teachers mailing list
alice-teachers at lists.andrew.cmu.edu
https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers


End of alice-teachers Digest, Vol 10, Issue 12
**********************************************

--
This email was Anti Virus checked by Astaro Security Gateway. http://www.astaro.com <http://www.astaro.com/> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 17156 bytes
Desc: not available
Url : https://lists.andrew.cmu.edu/mailman/private/alice-teachers/attachments/20110520/7e021999/attachment.bin 


More information about the alice-teachers mailing list