TI-BASIC (TI-84), 110 bytes
:Ans→Str1:"ABCDEFGHIJKLMNOPQRSTUVWXYZ→Str2:"35344527512513031462452312→Str3:0<sum(seq(expr(sub(Str3,inString(Str2,sub(Str1,X,1)),1)),X,1,length(Str1))-3
I used the same string for determining dot-heaviness as some of the other answers.
Program returns truthy (1
) if the input string is dot-heavy, falsy (0
) if not.
Input string must be in all-caps.
Input is stored in Ans
. Output is stored in Ans
and is automatically printed out when the program completes.
Ungolfed:
:Ans→Str1
:"ABCDEFGHIJKLMNOPQRSTUVWXYZ→Str2
:"35344527512513031462452312→Str3
:0<sum(seq(expr(sub(Str3,inString(Str2,sub(Str1,X,1)),1)),X,1,length(Str1))-3
Example:
"HELLO
HELLO
prgmCDGF3
1
"CODE
CODE
prgmCDGF3
0
Explanation:
(TI-BASIC doesn't have comments, assume that ;
indicates a commment)
:Ans→Str1 ;store the input into Str1
:"ABCDEFGHIJKLMNOPQRSTUVWXYZ→Str2 ;store the uppercase alphabet into Str2
:"35344527512513031462452312→Str3 ;store dot-dash+3 for each letter into Str3
:0<sum(seq(expr(sub(Str3,inString(Str2,sub(Str1,X,1)),1)),X,1,length(Str1))-3 ;full logic
sum( ;sum the elements of
seq( ) ;the list evaluated by
sub( ) ;the substring of
Str3, ;Str3
inString( ), ;at the index of
sub( ) ;the substring of
Str1, ;Str1
X, ;starting at X
1 ;of length 1
Str2, ;in Str2
1 ;of length 1
expr( ), ;converted to an integer
X, ;using X as the increment variable
1, ;starting at 1
length(Str1) ;ending at the length of Str1
-3 ;then subtract 3 from all elements in the list
0< ;then check if the sum is greater than 0
;implicitly output the result
Note: The byte count of a program is evaluated using the value in [MEM]>[2]>[7] (124 bytes) then subtracting the length of the program's name, CDGF3
, (5 bytes) and an extra 9 bytes used for storing the program:
124 - 5 - 9 = 110 bytes