This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. TI-Basic Brain Teasers => TI-BASIC
Author Message
blast


Advanced Newbie


Joined: 24 Oct 2007
Posts: 55

Posted: 09 Nov 2007 12:38:59 am    Post subject:

As far as typings things in on the calculator, you have 3 major options
1. alpha lock or alpha key enables alpha characters (white)
2. 2nd key enables 2nd characters (blue)
3. just simply pressing the button enables reg chars (1, 2, 3, 4, - , /)

Your challenge is to come up with the best algorithim to create unique char ids derived from the actual getKeys, the smallest possible ids in digit size, and all ids must be the same length of digits. There are no more than 99 characters including alpha, 2nd, and reg (these are the relevant ones, for example the reg char 'MODE" is not important for typing in). So seeing that, the smallest possible ids should be at least 2 digits. I have only managed to make unique 3 digit ids.

Unique is important because 1 getKey can be used for multiple characters.
IE:
the key 63
can be an alpha char 'K'
or a 2nd char '{'
or a reg char '('
if you have to create 3 ids for each one of these 3 types that can be derived from the original getKey

So summing it up:
Given
1. getKey code
2. 1 of 3 identifications (alpha, 2nd, reg), var 'Z' will be set to 1 for alpha, 2 for 2nd, 3 for reg

You must:
1. come up with smallest unique id derived from the given information

in other words if the program is given the getKey code and the char type identification your algorithim should be able to come up with this unique char id, and each char id must be the same length of digits, all 2 digits, all 3.. all 4..etc...

Good Luck
I'd love to see any algorithim for a 2 digit ids without a lookup.


Last edited by Guest on 09 Nov 2007 01:32:15 am; edited 1 time in total
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 09 Nov 2007 12:49:24 am    Post subject:

There's only 100 possible numbers that are 2 digits or less. 90 that are exactly 2 digits. There are 162 possible getKey & modifier combinations. Something's gotta give - you can't fit them all into two digits.

For using 3 digits (if nothing besides the number of digits matters) something like this could work:
Quote:
200Z+getKey


Last edited by Guest on 09 Nov 2007 12:58:59 am; edited 1 time in total
Back to top
blast


Advanced Newbie


Joined: 24 Oct 2007
Posts: 55

Posted: 09 Nov 2007 01:06:22 am    Post subject:

I should have spelled out which keys are 'important', not all 162.

alpha chars (29)
a-z
space
?
theta

2nd chars (5)
{
}
[
]
:

reg chars (1Cool
0
1
2
3
4
5
6
7
8
9
)
(
,
-
.
+
*
/


thats a total of 52 chars in need of unique char ids, well under 90 chars

to darkerline: does your posted solution for 3 digit ids take into account dealing with some 3 digit getKeys like '0' reg char which is getkey 102
and '.' dot which is 103
for a dot (reg char)
your code would produce 20603


Last edited by Guest on 09 Nov 2007 01:12:06 am; edited 1 time in total
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 09 Nov 2007 01:15:09 am    Post subject:

blast wrote:
to darkerline: does your posted solution for 3 digit ids take into account dealing with some 3 digit getKeys like '0' reg char which is getkey 102
and '.' dot which is 103
for a dot (reg char)
your code would produce 20603
How does 200*3+103 equal 20603?

[EDIT]

It appears you got Z and getKey mixed up. Z ranges from 1 to 3, and getKey is, well...


Last edited by Guest on 04 Sep 2010 11:31:24 pm; edited 1 time in total
Back to top
blast


Advanced Newbie


Joined: 24 Oct 2007
Posts: 55

Posted: 09 Nov 2007 01:23:59 am    Post subject:

yes it appears I did Smile
anyways.. 3 digits are easy, like I said i've already done this.. the real challenge is getting it in 2
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 09 Nov 2007 01:25:30 am    Post subject:

Here's a routine which assigns the numbers 10 through 61 to the keys you list, in the order they appear. The first part of it can appear in any part of the program, while the second is the code that actually converts a pair (Z,K) to the two-digit code. It returns 0 for all keys you don't mention.

I'm too lazy to type it into an emulator and check the size, especially since I couldn't find PindurTI's key for the memory menu, but it's somewhere between 250 and 300 bytes, I think.

Quote:
[[10, 11, 12, 0, 0, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 38, 0, 0, 36, 0, 37, 0] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, 40, 0, 0, 0, 0, 0, 41, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 43, 0, 0] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 55, 54, 61, 0, 51, 52, 53, 60, 0, 48, 49, 50, 57, 0, 45, 46, 47, 59, 0, 44, 58, 0, 0 -> [A]

...

[A](Z,K-5int(.1K+4


Last edited by Guest on 09 Nov 2007 01:27:34 am; edited 1 time in total
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement