Well, finding the individual characters of a sting is pretty easy. If you have char foo = "CAT"; then foo is 'C', foo is 'A', and foo is 'T'. 67, 65, 84 if you haven't done anything special. You can subtract 64 from each character to get 1 for 'A', if that's what you had in mind.
Now, if you have an integer int bar = 12345;, the situation is more complicated. The "digits" of an integer are something that only shows up when the integer is printed (or converted to a string), so extracting the individual digits is relatively complicated (indeed, the easier way may be to convert the variable to a string first, and then just deal with the string.)
Note that to convert "DOG" to 8, you would need to do both. First you'd add up the characters of the string (giving you an integer), and then you have to add up the digits of the integer (possibly more than once, till there was only one digit left.)
I chose to reply to you first (though I am getting to those of you who are classified as an "other of you" next!), because it sounds like we are really getting somewhere here with this. All I know is that I do not know of this mysterious foo, and that it might perhaps help me. :)
In fact, I was about to inquire further for understanding, but upon reading through one more time, this makes perfect sense to me and is most helpful indeed! Believe it or not, I already wrote a non-functioning program in Java in which I was able to write the bit that compresses and re-compresses until one digit with great success. However... there was one pseudo command that checks if variable (integer) is a single digit. I assume there is some command in the Arduino language for this too? If not are there any multiplication/division/add or sub tricks I can use to figure out if I have an int with a single dig? I thought about the "roll-over" of a variable, but concluded the value at which a variable rolls over is not configurable and hence won't help me. When I get all of this working I will post my code by the way, because I believe with what you just enlightened me on, and providing I can find a solution to my "is x single digit" problem, then this code shall finally be completed.
var1(CAT) becomes 6, var2(DOG)becomes 8 (not 17!), var3(IS) becomes 1 (not 10!), var 4(GREAT) becomes 6 (not 24!)
Please explain how the values for the vars are derived.
Simply enough, I assign the values for each character in the init. If you take your 26 letter alphabet, and upon reaching any letter/number over 9, add the digits together until there is a single digit, you will get where I take my defined values from. In this sense I set A B C to 1 2 3 onward, and upon reaching J K L I set them 1 2 3 as opposed to 10 11 12.
I guess I'm iffy though on whether or not I can take a word and store it in some array somewhere as the predefined values rather than the word itself. This can be simply avoided though by storing the input string as several strings one letter long, I suppose. ie maybe the machine can't interpret ABCDE as 12345 when storing the variable in an array, but it may be able to interpret A as 1, B as 2, onward. Will post my results. While the program is of no use to anyone, I imagine a newb or two like myself could gleam some insight from a results post that describes variables and the various ways to store them and break them apart of use. I for one can tell you that it seems the arduino learning database had a lot more information on them starting out, because in my research with those materials I often had questions that weren't answered anywhere in the helpful reference.
Look each char typed on you keyboard is sent as a value in a code known as ASCII thats your starting point. Stay off the strange baccy.
Baccy is wacky indeed! I meant acig (artificial communication intelligence genesis) though, which is a project of mine I have been trying to crack for months and mentioned a few times in these parts. Perhaps my subconscious snuck the space in there because it was trying to tell me something (my, user, you are all strung out! :P) I think the fact that I used the verb smoke had something to do with the unintentional spelling blip too. Strangely enough I've never thought about my program that way.
Also, why are you doing this on an Arduino? It seems like a simple (although bizarre) text processing problem. You could solve it just as easily in Java, C++ or whatever other language you feel most comfortable with and it would be easier to program on a PC than on an Arduino. There's really nothing here that the Arduino is helping with, and it means you're doing your development in a very limited environment.
This question I am most glad of all to answer. While you make a fantastic point, I have two reasons. The first, and foremost, I actually mentioned in my original post:
I've been trying to implement something like this (albeit more complex) in Java for a week now and finally rage quitted to work with my favorite, most familiar code. Enter the Arduino - A Bamf Micro-controller tasked with crunching numbers while plugged into my number crunching machine (desktop PC) Lol.
The second reason was left undisclosed as I find a post with too much text and information often makes it far more difficult for others to assist with, and not only that but has the side-effects of causing the topic to stray, and those who would've replied were the question precise and short, might decide against it upon being confronted with a wall of "oh my gerd".
This second reason for why I am using the Arduino, is that later (as in when I tackle the things at the top of my to-do list) I plan on enclosing a 'duino with an lcd screen and qwerty keypad so that I can munch down numbers and spare myself from doing maths on the go! It should be pretty neat (for me at least, who has use for such a gadget). I look forward to sharing more with anyone interested when the time comes... because what good is a project if left unshared.
And that's perhaps what I love about the Arduino community the most. We are all working on often insane and very useless things and do so because to us (and often times for those we share our work with) the sillyness and lack of purposeful meaning is downright cool. I think you can find an Arduino behind the scenes of almost any creative art project, or strange piece, and that is a testament to just how flexible and easy to pick up the platform is.
Thank you everyone! As I mentioned above, I will be sharing my finished code and elaborating on those details I learned of to complete it that I found lacking in our helpful language reference.