Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Array Assignment
Old
JungleJim
Guest
 
Status:
Posts: n/a
Default Array Assignment - 07-13-2007, 02:45 PM

How do I get the following code to work (assignment of the value of a variable to an array element) ??

world.my first method No parameters
-----------
[[*] numary] = [1,2] , [[123] x] = 1
-----------
x set value to 1 more...
set item 0 to 1 in numary more...
set item 0 to x in numary more...
print item 0 from numary
-----------
where [] are used to indicate tiles and buttons.
The above gives a "mean queen error".
But when the "set item 0 to x..." command is disabled, the above works and
prints out 1.0
   
Reply With Quote
Old
DickBaldwin
Guest
 
Status:
Posts: n/a
Default 07-13-2007, 11:33 PM

I don't know if this will answer your question, but you might take a look at http://www.alice.org/community/showthread.php?t=810

Dick Baldwin
   
Reply With Quote
Old
JungleJim
Guest
 
Status:
Posts: n/a
Default 07-14-2007, 09:14 PM

Thanks, that exactly answers my question - I CANT DO THAT.

And I guess my inability to put a Position value into an array of Positions has the same reply - NOT POSSIBLE.

One of my (highschool) students already figured out that a List could be used instead.

AGAIN - THANX.
   
Reply With Quote
Old
DickBaldwin
Guest
 
Status:
Posts: n/a
Default 07-17-2007, 09:16 AM

By the way, in case they are unaware of it, some of you students may be interested in a set of online Alice tutorials at http://www.dickbaldwin.com/tocalice.htm

There are also practice tests that your students may find useful, and slides for classroom use that you may find useful.

Appendix A contains detailed descriptions of the behavior plus sample programs for all of the primitive methods.

Regards,
Dick Baldwin

Last edited by DickBaldwin; 07-17-2007 at 09:18 AM. Reason: Correct grammar
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



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