I'm making a code solver, and I need help using lists and variables...
Take this script:
It really needs to be shortened....
Offline
Ok, that can be shortened - you just have to think outside the box
Create a list, with all of those letters - f,i,l,n,p,t,u,v,w,x,y,z
Then, in that if block, just put:
if <list contains (answer)>
I hope that helps
Last edited by Lucario621 (2010-05-17 21:33:43)
Offline
Thanks!
However, what I really need to do is define a pentomino/number combination as a letter. I'm using three lists... the pentomino types, the numbers, and the end result where the message will unfold. Is there a way to do this with lists?
Offline
Lucario621 wrote:
Ok, that can be shortened - you just have to think outside the box
![]()
Create a list, with all of those letters - f,i,l,n,p,t,u,v,w,x,y,z
Then, in that if block, just put:
if <list contains (answer)>
I hope that helps![]()
I was thinking the same thing. Too bad you beat me to posting it.
Offline
Lucario621 wrote:
Ok, that can be shortened - you just have to think outside the box
![]()
Create a list, with all of those letters - f,i,l,n,p,t,u,v,w,x,y,z
Then, in that if block, just put:
if <list contains (answer)>
I hope that helps![]()
You know, that is a commonly used strategy in real programming, too - I've found it in my ventures.
By Pentomino, do you mean Strings?
Offline
Vista4563 wrote:
Thanks!
However, what I really need to do is define a pentomino/number combination as a letter. I'm using three lists... the pentomino types, the numbers, and the end result where the message will unfold. Is there a way to do this with lists?
I'm a bit confused about what you mean. Do you mean to check if it is a letter?
Offline
Dazachi wrote:
Vista4563 wrote:
Thanks!
However, what I really need to do is define a pentomino/number combination as a letter. I'm using three lists... the pentomino types, the numbers, and the end result where the message will unfold. Is there a way to do this with lists?I'm a bit confused about what you mean. Do you mean to check if it is a letter?
If so, you can use the same method with one list for the letters, one for the numbers, and if it's in list A, it's a letter, list B, it's a number... Is that what you meant? I can post a more detailed description if such is the case.
Hope that helps
Offline
coolstuff wrote:
Lucario621 wrote:
Ok, that can be shortened - you just have to think outside the box
![]()
Create a list, with all of those letters - f,i,l,n,p,t,u,v,w,x,y,z
Then, in that if block, just put:
if <list contains (answer)>
I hope that helps![]()
You know, that is a commonly used strategy in real programming, too - I've found it in my ventures.
By Pentomino, do you mean Strings?
I was going to suggest using a repeat loop to go though all the values of the list... then I noticed the "contains" feature. Often times in programming you will need to search your arrays and you use a for loop for this.
Last edited by archmage (2010-05-17 23:48:05)
Offline
Here's the problem... I have three lists (one that holds the pentomino types, one that holds the numbers one, two and three, and one that holds the message once decoded.
If you enter in a certain combination of Pentomino_type and number, I want it to show as a certain letter in the "decoded message" list.
Offline
.
http://en.wikipedia.org/wiki/Pentomino
A pentomino is a tetris-like shape consisting of 5 squares. There are 12 different free pentominoes, F, L, N, P, Y, Z, I, T, U, V, W, and X.
Thank goodness for google (LOL).
Last edited by infinitum3d (2010-05-18 18:53:13)
Offline
I know that; that's out of the question.
Here's the problem... I have three lists (one that holds the pentomino types, one that holds the numbers one, two and three, and one that holds the message once decoded.
If you enter in a certain combination of Pentomino_type and number, I want it to show as a certain letter in the "decoded message" list.
Offline
...I still need help.
Offline
Vista4563 wrote:
If you enter in a certain combination of Pentomino_type and number, I want it to show as a certain letter in the "decoded message" list.
Could you give an example what this input might look like?
Offline
Vista4563 wrote:
However, what I really need to do is define a pentomino/number combination as a letter.
So a combination like F1 would be "A", etc? Well, you could create a list of combinations:
List comboList set i to 0 set j to 0 repeat (length of [pentonimoTypes]): change i by 1 set j to 0 repeat (length of [pentominoNumbers]): change j by 1 add (join (item (i) of pentominoTypes) (item (j) of pentominoNumbers)) to comboList end end
I'm still not sure how this would help you. Could you give an example of what the input and the output would look like?
Last edited by fullmoon (2010-05-19 19:00:46)
Offline
That should work... The example input would be F, L, N, P, Y, Z, I, T, U, V, W, or X combined with a number from 1-3, and the result would be a letter from A-Z.
Last edited by Vista4563 (2010-05-19 20:54:33)
Offline
Vista4563 wrote:
That should work... The example input would be F, L, N, P, Y, Z, I, T, U, V, W, or X combined with a number from 1-3, and the result would be a letter from A-Z.
So, something like F3? Or Y2?
Offline
coolstuff wrote:
Vista4563 wrote:
That should work... The example input would be F, L, N, P, Y, Z, I, T, U, V, W, or X combined with a number from 1-3, and the result would be a letter from A-Z.
So, something like F3? Or Y2?
Exactly.
Offline