Alice Community  

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

Reply
 
Thread Tools Display Modes
string to list
Old
fh123
Guest
 
Status:
Posts: n/a
Default string to list - 04-26-2011, 07:27 PM

Hi everyone,

my first post

Is there a way to take a string, say from "ask user for a string" and turn it into a list of the letters?, i.e.
"hi" -> ['h','i']

the point is to do simple encryption.

Thanks.
   
Reply With Quote
Old
reuben2011
Senior Member
 
reuben2011's Avatar
 
Status: Offline
Posts: 489
Join Date: Sep 2009
Location: Hawaii
Default 04-26-2011, 11:16 PM

Sorry, I don't think Alice has enough string manipulation related functions to do what you are trying to do. An option you can consider though, is detecting the keyboard presses and storing the value of the key pressed in the list. Here is an example. The thing though, is that it stores the "key code" and not the actual character, but you can always convert between the two.
Attached Files
File Type: a2w example.a2w (169.0 KB, 5 views)


Projects
-Escape the Kitchen
-That ninja animation
-Hill Collision

Upcoming Projects
-Some penguin adventure game?
   
Reply With Quote
Old
fh123
Guest
 
Status:
Posts: n/a
Default 04-26-2011, 11:38 PM

Thanks Rueben2011.
   
Reply With Quote
Old
reuben2011
Senior Member
 
reuben2011's Avatar
 
Status: Offline
Posts: 489
Join Date: Sep 2009
Location: Hawaii
Default 04-26-2011, 11:47 PM

Is it working for you?


Projects
-Escape the Kitchen
-That ninja animation
-Hill Collision

Upcoming Projects
-Some penguin adventure game?
   
Reply With Quote
Old
fh123
Guest
 
Status:
Posts: n/a
Default 04-27-2011, 06:14 AM

It's a nice solution. However, I was hoping for something where the kid could copy and paste in blocks of text. (I don't actually know the capacity of the text input box of the "ask user for string"). While typing it all in does simulate an old fashioned Enigma Machine, for cryptanalysis like simple frequency analysis, we will need to be able to paste largish blocks of text.

Thanks again.

Last edited by fh123; 04-27-2011 at 06:41 AM.
   
Reply With Quote
Reply

Tags
letter, list, string

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 ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.