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
Ed H


Member


Joined: 30 Nov 2007
Posts: 138

Posted: 14 Nov 2009 03:45:13 am    Post subject:

Given a string in Str1 consisting of a word, return in Ans the sum of the letter-values of each letter in the word.

The letter-values are given here: http://en.wikipedia.org/wiki/Scrabble_lett...butions#Italian

Example: UNO is in Str1. The program returns U + N + O = 3 + 3 + 1 = 7.

Note: Italian language scrabble features 4 less letters than English language scrabble.
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 14 Nov 2009 07:23:03 am    Post subject:

My first attempt is 72 bytes (leaving off the letters in the program name):

Spoiler wrote:
[font="courier new"]sum(1+int(.7[font="times new roman"]×[font="arial"]√int(.2seq(inString("OAIE?CRST?LMNU?BDFPVGHZ??Q",sub(Str1,X,1))-1,X,1,length(Str1


Last edited by Guest on 14 Nov 2009 07:28:35 am; edited 1 time in total
Back to top
Ed H


Member


Joined: 30 Nov 2007
Posts: 138

Posted: 14 Nov 2009 06:12:41 pm    Post subject:

I had a fairly similar solution, but mine took 74 bytes instead.

Here's a cute solution in 104 bytes:
Spoiler wrote:
[font="courier new"]:e→O:Ans→A:Ans→I:Ans→E
:e^(2→C:Ans→R:Ans→S:Ans→T
:e^(3→L:Ans→M:Ans→N:Ans→U
:e^(5→B:Ans→D:Ans→F:Ans→P:Ans→V
:AnsĀ²→Q
:e^(8→G:Ans→H:Ans→Z
:ln(expr(Str1
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