They call me Inspector Morse












12












$begingroup$


Your mission, should you choose to accept it, is to decide whether a given input string is Dot-, or Dash-heavy.



A string is dot-heavy when its morse representation contains more dots than dashes. For example, the letter E is a single dot, which means it is Dot-heavy.



Input




  • The input string will only contain characters in the range of [a-z] or [A-Z]. You can decide if they should all be upper case, or all lower case. AAA is fine, aaa is fine, aAa is not.

  • The input string will always be at least 1 character in length.

  • You may assume that input strings will never have an equal amount of dots and dashes.


Output



You should return Truthy for inputs that contain more dot characters.

You should return Falsy for inputs that contain more dash characters.



Test cases



| input | morse representation | result          |
|------------------------------------------------|
| S | ... | Truthy |
| k | -.- | Falsy |
| HELLO | .... . .-.. .-.. --- | Truthy |
| code | -.-. --- -.. . | Falsy |


Reference



International Morse Code



This is code-golf. Shortest code in bytes wins.










share|improve this question









$endgroup$












  • $begingroup$
    Related
    $endgroup$
    – Bassdrop Cumberwubwubwub
    7 hours ago






  • 1




    $begingroup$
    Can we return a value above 0 for dotheavy and a negative value for dash-heavy?
    $endgroup$
    – Embodiment of Ignorance
    3 hours ago
















12












$begingroup$


Your mission, should you choose to accept it, is to decide whether a given input string is Dot-, or Dash-heavy.



A string is dot-heavy when its morse representation contains more dots than dashes. For example, the letter E is a single dot, which means it is Dot-heavy.



Input




  • The input string will only contain characters in the range of [a-z] or [A-Z]. You can decide if they should all be upper case, or all lower case. AAA is fine, aaa is fine, aAa is not.

  • The input string will always be at least 1 character in length.

  • You may assume that input strings will never have an equal amount of dots and dashes.


Output



You should return Truthy for inputs that contain more dot characters.

You should return Falsy for inputs that contain more dash characters.



Test cases



| input | morse representation | result          |
|------------------------------------------------|
| S | ... | Truthy |
| k | -.- | Falsy |
| HELLO | .... . .-.. .-.. --- | Truthy |
| code | -.-. --- -.. . | Falsy |


Reference



International Morse Code



This is code-golf. Shortest code in bytes wins.










share|improve this question









$endgroup$












  • $begingroup$
    Related
    $endgroup$
    – Bassdrop Cumberwubwubwub
    7 hours ago






  • 1




    $begingroup$
    Can we return a value above 0 for dotheavy and a negative value for dash-heavy?
    $endgroup$
    – Embodiment of Ignorance
    3 hours ago














12












12








12


2



$begingroup$


Your mission, should you choose to accept it, is to decide whether a given input string is Dot-, or Dash-heavy.



A string is dot-heavy when its morse representation contains more dots than dashes. For example, the letter E is a single dot, which means it is Dot-heavy.



Input




  • The input string will only contain characters in the range of [a-z] or [A-Z]. You can decide if they should all be upper case, or all lower case. AAA is fine, aaa is fine, aAa is not.

  • The input string will always be at least 1 character in length.

  • You may assume that input strings will never have an equal amount of dots and dashes.


Output



You should return Truthy for inputs that contain more dot characters.

You should return Falsy for inputs that contain more dash characters.



Test cases



| input | morse representation | result          |
|------------------------------------------------|
| S | ... | Truthy |
| k | -.- | Falsy |
| HELLO | .... . .-.. .-.. --- | Truthy |
| code | -.-. --- -.. . | Falsy |


Reference



International Morse Code



This is code-golf. Shortest code in bytes wins.










share|improve this question









$endgroup$




Your mission, should you choose to accept it, is to decide whether a given input string is Dot-, or Dash-heavy.



A string is dot-heavy when its morse representation contains more dots than dashes. For example, the letter E is a single dot, which means it is Dot-heavy.



Input




  • The input string will only contain characters in the range of [a-z] or [A-Z]. You can decide if they should all be upper case, or all lower case. AAA is fine, aaa is fine, aAa is not.

  • The input string will always be at least 1 character in length.

  • You may assume that input strings will never have an equal amount of dots and dashes.


Output



You should return Truthy for inputs that contain more dot characters.

You should return Falsy for inputs that contain more dash characters.



Test cases



| input | morse representation | result          |
|------------------------------------------------|
| S | ... | Truthy |
| k | -.- | Falsy |
| HELLO | .... . .-.. .-.. --- | Truthy |
| code | -.-. --- -.. . | Falsy |


Reference



International Morse Code



This is code-golf. Shortest code in bytes wins.







code-golf morse






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 7 hours ago









Bassdrop CumberwubwubwubBassdrop Cumberwubwubwub

4,07811446




4,07811446












  • $begingroup$
    Related
    $endgroup$
    – Bassdrop Cumberwubwubwub
    7 hours ago






  • 1




    $begingroup$
    Can we return a value above 0 for dotheavy and a negative value for dash-heavy?
    $endgroup$
    – Embodiment of Ignorance
    3 hours ago


















  • $begingroup$
    Related
    $endgroup$
    – Bassdrop Cumberwubwubwub
    7 hours ago






  • 1




    $begingroup$
    Can we return a value above 0 for dotheavy and a negative value for dash-heavy?
    $endgroup$
    – Embodiment of Ignorance
    3 hours ago
















$begingroup$
Related
$endgroup$
– Bassdrop Cumberwubwubwub
7 hours ago




$begingroup$
Related
$endgroup$
– Bassdrop Cumberwubwubwub
7 hours ago




1




1




$begingroup$
Can we return a value above 0 for dotheavy and a negative value for dash-heavy?
$endgroup$
– Embodiment of Ignorance
3 hours ago




$begingroup$
Can we return a value above 0 for dotheavy and a negative value for dash-heavy?
$endgroup$
– Embodiment of Ignorance
3 hours ago










15 Answers
15






active

oldest

votes


















3












$begingroup$


Jelly, 23 bytes



9“¡ȷṡẓh)ėḂYF@’ḃ_4ị@OS0<


Try it online!






share|improve this answer









$endgroup$





















    2












    $begingroup$


    C (gcc), 84 82 81 79 75 bytes



    Assumes all caps.





    r;f(char*s){for(r=0;*s;r+="+-+,,-*/--*-)+(+),.*,-*+)+"[*s++%65]-43);s=r>0;}


    Try it online!






    share|improve this answer











    $endgroup$





















      2












      $begingroup$


      Java (JDK), 131 124 110 84 bytes



      Interestingly, "dot" is dash-heavy and "dash" is dot-heavy.



      Assumes all caps. Thanks to Expired Data for golfing 20 bytes and to Neil for golfing another 26 bytes!





      c->{int s=0;for(int a:c)s+="35344527512513031462452313".charAt(a-65)-51;return s>0;}


      Try it online!



      Ungolfed:



      c -> { // lambda taking an array of char as input and returning a boolean
      int s = 0; // keep track of the net total of dots
      for(int a : c) // look at each character's ASCII value
      s += "35344527512513031462452313".charAt(a - 65) - 51; // add the net dot impact of each letter to the total; 65 is ASCII code for 'A'; 48 is ASCII code for '0'; to save bytes, there are no negative values in the list - subtracting 3 rectifies that => -48 - 3 = -51
      return s > 0; // if the total is positive, the string is dot-heavy
      }





      share|improve this answer











      $endgroup$









      • 1




        $begingroup$
        124 bytes
        $endgroup$
        – Expired Data
        6 hours ago






      • 1




        $begingroup$
        Make that 111 bytes
        $endgroup$
        – Expired Data
        2 hours ago










      • $begingroup$
        Nice! One more byte can be saved by using int a instead of char a.
        $endgroup$
        – O.O.Balance
        2 hours ago






      • 1




        $begingroup$
        Why not use "35344527512513031462452313".charAt(a-65)-51?
        $endgroup$
        – Neil
        1 hour ago



















      1












      $begingroup$


      Retina 0.8.2, 51 bytes



      T`L`35344527412513031462452313
      .
      $*<>>>
      +`<>|><

      ^<


      Try it online! Link includes test cases. Only accepts upper case (+6 bytes for mixed case). Shamelessly stealing @Arnauld's string but I was going to use the same algorithm anyway. Explanation:



      T`L`35344527412513031462452313
      .


      Change each letter into the difference in numbers of dots and dashes, plus three, so O=0 and H=7.



      $*<>>>


      Represent the difference as that number of <s and three >s. (Sadly I can't use dots because they're special in regex.)



      +`<>|><


      Remove matched pairs of <s and >s.



      ^<


      Check whether there are still any dots left.






      share|improve this answer









      $endgroup$





















        1












        $begingroup$


        Bash+coreutils,  64 60 bytes





        tr a-z 35344526512513031462452313|sed s/./&z-+/g|dc -eIK?^p


        Try it online!



        Takes a string in lowercase, outputs zero for falsy, nonzero for truthy



        Explanation



        Uses tr and sed to create a dc program that looks like (for the example input 'hello'):



        IK6z-+4z-+5z-+5z-+0z-+^p

        IK Push 10, then 0 to the stack
        6z-+ Push 6 (three more than the dots minus dashes in 'h'), subtract 3, and accumulate
        ... Do the same for all other letters, so the stack now has the total dots minus dashes
        ^ Raise 10 to this power - precision is zero so this turns negative/positive to falsy/truthy
        p Print result





        share|improve this answer











        $endgroup$













        • $begingroup$
          Golfed two bytes by just putting the dc in the pipeline rather than use command substitution, then another byte by replacing <space>3 with z (conveniently, I have 3 items on the stack at that point!) and another byte by replacing the quotes around my sed program with a single backslash to escape the &
          $endgroup$
          – Sophia Lechner
          5 hours ago





















        1












        $begingroup$


        APL (Dyalog Extended), 24 bytesSBCS





        Anonymous tacit prefix function taking uppercase as argument.



        ⎕CY'dfns'
        >/'.-'⍧∊∘morse


        Try it online!



        ⎕CY'dfns' copy in the dfns library



        morse convert to list of Morse strings
         then
        ϵnlist (flatten)
        '.-'⍧ count the number of dots and dashes in that
        >/ more dots than dashes? (lit. greater-than reduction)






        share|improve this answer









        $endgroup$





















          1












          $begingroup$


          05AB1E, 22 bytes



          εA•U(Õþć6Δ
          »›I•‡3-}O.±


          Try it online!



          Explanation



          •U(Õþć6Δ
          »›I•


          is 35344527512513031462452313 compressed to base 255.



          ε         }     # apply to each char in input
          ‡ # transliterate
          A # the lowercase alphabet
          •...• # with the digits from the compressed string
          3- # subtract 3 from each
          O # then sum the result
          .± # and take the sign





          share|improve this answer











          $endgroup$





















            1












            $begingroup$


            Jelly, 21 bytes



            Oị“ÆġwıMƥ)ɠịṙ{’D¤Æm>4


            Try it online!



            How?



            Oị“ÆġwıMƥ)ɠịṙ{’D¤Æm>4 - Link: list of characters ([A-Z]), S
            ¤ - nilad followed by link(s) as a nilad:
            “ÆġwıMƥ)ɠịṙ{’ - base 250 integer = 14257356342446455638623624
            D - to decimal digits
            - -- that is the number of dots less the number of dashes plus 4
            - ... for each of OPQRSTUVWXYZABCDEFGHIJKLMN
            O - ordinals of S e.g. "ATHROUGHZ" -> [65,84,72,82,79,85,71,72,90]
            ị - index into (1-indexed & modular, so O gets the 79%26 = 1st item
            - or A gets the 65%26 = 13th item
            Æm - arithmetic mean
            >4 - greater than 4?





            share|improve this answer











            $endgroup$





















              1












              $begingroup$

              IBM PC DOS, 8088 assembly, 54 35 bytes



              -19 bytes using the difference method



              ac2c 41d0 d8d7 7206 51b1 04d2 e859 240f 2c03 02e0 e2ea 3534 4527 4125 1303 1462 4523 13


              Unassembled:



              ; compare dashes and dots in a morse code string
              ; input:
              ; I: pointer to input string (default SI)
              ; IL: length of input string (default CX)
              ; TBL: pointer to data table (default BX)
              ; output:
              ; Sign/OF flags: Dot-heavy: SF == OF (JGE), Dash-heavy: SF != OF (JL)
              MORSE_DD MACRO I, IL, TBL
              LOCAL LOOP_LETTER, ODD
              IFDIFI <I>,<SI> ; skip if S is already SI
              MOV SI, I ; load string into SI
              ENDIF
              IFDIFI <IL>,<CX> ; skip if IL is already CX
              MOV CX, IL ; set up loop counter
              ENDIF
              IFDIFI <TBL>,<BX> ; skip if TBL is already BX
              MOV BX, OFFSET TBL ; load letter table into BX
              ENDIF
              LOOP_LETTER:
              LODSB ; load next char from DS:SI into AL, advance SI
              ;AND AL, 0DFH ; uppercase the input letter (+2 bytes)
              SUB AL, 'A' ; convert letter to zero-based index
              RCR AL, 1 ; divide index by 2, set CF if odd index
              XLAT ; lookup letter in table
              JC ODD ; if odd index use low nibble; if even use high nibble
              PUSH CX ; save loop counter (since SHR can only take CL on 8088)
              MOV CL, 4 ; set up right shift for 4 bits
              SHR AL, CL ; shift right
              POP CX ; restore loop counter
              ODD:
              AND AL, 0FH ; mask low nibble
              SUB AL, 3 ; unbias dash/dot difference +3 positive
              ADD AH, AL ; add letter difference to sum (set result flags)
              LOOP LOOP_LETTER
              ENDM

              TBL DB 035H, 034H, 045H, 027H, 041H, 025H, 013H, 003H, 014H, 062H, 045H, 023H, 013H


              Explanation



              Implemented in Intel/MASM syntax as a MACRO (basically a function), using only 8088 compatible instructions. Input as uppercase string (or +2 bytes to allow mixed-case), output Truthy/Falsy result is SF == OF (use JG or JL to test).



              The letter difference table values are stored as binary nibbles, so only takes 13 bytes in total.



              Original (54 bytes):



              ; compare dashes and dots in a Morse code string
              ; input:
              ; I: pointer to input string (default SI)
              ; IL: length of input string (default CX)
              ; TBL: pointer to data table
              ; output:
              ; Carry Flag: CF=1 (CY) if dot-heavy, CF=0 (NC) if dash-heavy
              MORSE_DD MACRO I, IL, TBL
              LOCAL LOOP_LETTER
              IFDIFI <I>,<SI> ; skip if S is already SI
              MOV SI, I ; load string into SI
              ENDIF
              IFDIFI <IL>,<CX> ; skip if IL is already CX
              MOV CX, IL ; set up loop counter
              ENDIF
              MOV BX, OFFSET TBL ; load score table into BX
              XOR DX, DX ; clear DX to hold total score
              LOOP_LETTER:
              LODSB ; load next char from DS:SI into AL, advance SI
              ;AND AL, 0DFH ; uppercase the input letter (+2 bytes)
              SUB AL, 'A' ; convert letter to zero-based index
              XLAT ; lookup letter in table
              MOV AH, AL ; examine dot nibble
              AND AH, 0FH ; mask off dash nibble
              ADD DH, AH ; add letter dot count to total
              PUSH CX ; save loop counter (since SHR can only take CL)
              MOV CL, 4 ; set up right shift for 4 bits
              SHR AL, CL ; shift right
              POP CX ; restore loop counter
              ADD DL, AL ; add letter dash count to total
              LOOP LOOP_LETTER
              CMP DL, DH ; if dot-heavy CF=1, if dash-heavy CF=0
              ENDM

              ; data table A-Z: MSN = count of dash, LSN = count of dot
              TBL DB 011H, 013H, 022H, 012H, 001H, 013H, 021H, 004H, 002H
              DB 031H, 021H, 013H, 020H, 011H, 030H, 022H, 031H, 012H
              DB 003H, 010H, 012H, 013H, 021H, 022H, 031H, 022H


              Explanation



              Implemented in Intel/MASM syntax as a MACRO (basically a function), using only 8088 compatible instructions. Input as string, output Truthy/Falsy result in Carry Flag. Score table contains the number of dashes and dots per letter.



              Input is upper case. Add 2 bytes to take lower or mixed case.



              Example Test Program (as IBM PC DOS standalone COM executable)



                  SHR  SI, 1              ; point SI to DOS PSP
              LODSW ; load arg length into AL, advance SI to 82H
              MOV CL, AL ; set up loop counter in CH
              DEC CX ; remove leading space from letter count

              MORSE_DD SI, CX, TBL ; execute above function, result is in CF

              MOV DX, OFFSET F ; default output to "Falsy" string
              JA DISP_OUT ; if CF=0, result is falsy, skip to output
              MOV DX, OFFSET T ; otherwise CF=1, set output to "Truthy" string
              DISP_OUT:
              MOV AH, 09H ; DOS API display string function
              INT 21H
              RET

              T DB "Truthy$"
              F DB "Falsy$"


              Example Output:



              enter image description here



              Download test program DD.COM



              Or Try it Online!
              I'm not aware of an online TIO to direct link to a DOS executable, however you can use this with just a few steps:




              1. Download DD.COM as a ZIP file

              2. Go to https://virtualconsoles.com/online-emulators/DOS/

              3. Upload the ZIP file you just downloaded, click Start

              4. Type DD Hello or DD code to your heart's content






              share|improve this answer











              $endgroup$





















                0












                $begingroup$


                JavaScript (Node.js),  69  68 bytes



                Expects the input string in uppercase. Returns $0$ or $1$.





                s=>Buffer(s).map(n=>s+='30314624523133534452741251'[n%26]-3,s=0)|s>0


                Try it online!






                share|improve this answer











                $endgroup$





















                  0












                  $begingroup$


                  Python 2, 73 bytes





                  lambda s:sum(int('035344527512513031462452313'[ord(c)%32])-3for c in s)>0


                  Try it online!






                  share|improve this answer











                  $endgroup$













                  • $begingroup$
                    Change '035344527512513031462452313'[ord(c)%32] to `0x1d3c7eacfc7218bfeffc59`[ord(c)-65] for 70 bytes.
                    $endgroup$
                    – Erik the Outgolfer
                    5 hours ago





















                  0












                  $begingroup$


                  Perl 5 -pF, 53 bytes





                  $p+=y/a-z/35344526512513031462452313/r-3for@F;$_=$p>0


                  Try it online!






                  share|improve this answer









                  $endgroup$





















                    0












                    $begingroup$


                    C# (Visual C# Interactive Compiler), 49 bytes





                    n=>n.Sum(c=>""[c-65]-4)


                    Contains a lot of unprintables. Returns a positive integer for dot-heavy, and negative for dash-heavy.



                    Try it online!






                    share|improve this answer











                    $endgroup$





















                      0












                      $begingroup$

                      C++ (compiled with Visual Studio 2017) 171bytes



                      int f(string i){const char*c="1322131421130102123023121211210120032121323101112232";int j=0,h[2]={0};while(j<sizeof(i)/28)*h+=c[i[j]-97],h[1]+=c[i[j++]-71];return*h>h[1];}


                      if we take the main program that exists for test purposes into account as well its more.



                      this is the ungolfed "tidy" variant



                      #include "stdafx.h"
                      int main()
                      {
                      const int dotCount = {1,3,2,22,1,3,1,4,2,1,1,3,0,1,0,2,1,2,3,0,2,3,1,2,1,2};
                      const int dashCount = {1,1,2,1,0,1,2,0,0,3,2,1,2,1,3,2,3,1,0,1,1,1,2,2,3,2};
                      std::cout << "Enter String:n";
                      std::string input;
                      std::cin >> input;
                      int inputsHeavyness[2] = { 0 };
                      for(int i = 0;i < sizeof(input)/sizeof(std::string);i++)
                      {
                      inputsHeavyness[0] += dotCount[input[i] - 'a'];
                      inputsHeavyness[1] += dashCount[input[i] - 'a'];
                      }
                      if (inputsHeavyness[0] > inputsHeavyness[1])
                      {
                      std::cout << "Dot Heavyn";
                      }
                      else
                      {
                      std::cout << "Dash Heavy or Neutraln";
                      }
                      return 0;
                      }





                      share|improve this answer









                      $endgroup$





















                        0












                        $begingroup$


                        Stax, 20 bytes



                        ÉBÜ◙ƒ╣<Hf6─òɼsäS╗◄↔


                        Run and debug it



                        Unpacked, ungolfed, and commented, it looks like this.



                        "45D.J57KBJa`"I"    string literal with code points [52 53 68 46 74 53 55 75 66 74 97 34 73]
                        $ flatten to string "52536846745355756674973473"
                        ; push input
                        @ get string characters at indices
                        (using input codepoints as indices; lookups wrap around)
                        :V arithmetic mean
                        53> is greater than 53


                        Run this one






                        share|improve this answer









                        $endgroup$













                          Your Answer





                          StackExchange.ifUsing("editor", function () {
                          return StackExchange.using("mathjaxEditing", function () {
                          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
                          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
                          });
                          });
                          }, "mathjax-editing");

                          StackExchange.ifUsing("editor", function () {
                          StackExchange.using("externalEditor", function () {
                          StackExchange.using("snippets", function () {
                          StackExchange.snippets.init();
                          });
                          });
                          }, "code-snippets");

                          StackExchange.ready(function() {
                          var channelOptions = {
                          tags: "".split(" "),
                          id: "200"
                          };
                          initTagRenderer("".split(" "), "".split(" "), channelOptions);

                          StackExchange.using("externalEditor", function() {
                          // Have to fire editor after snippets, if snippets enabled
                          if (StackExchange.settings.snippets.snippetsEnabled) {
                          StackExchange.using("snippets", function() {
                          createEditor();
                          });
                          }
                          else {
                          createEditor();
                          }
                          });

                          function createEditor() {
                          StackExchange.prepareEditor({
                          heartbeatType: 'answer',
                          autoActivateHeartbeat: false,
                          convertImagesToLinks: false,
                          noModals: true,
                          showLowRepImageUploadWarning: true,
                          reputationToPostImages: null,
                          bindNavPrevention: true,
                          postfix: "",
                          imageUploader: {
                          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                          allowUrls: true
                          },
                          onDemand: true,
                          discardSelector: ".discard-answer"
                          ,immediatelyShowMarkdownHelp:true
                          });


                          }
                          });














                          draft saved

                          draft discarded


















                          StackExchange.ready(
                          function () {
                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f181318%2fthey-call-me-inspector-morse%23new-answer', 'question_page');
                          }
                          );

                          Post as a guest















                          Required, but never shown

























                          15 Answers
                          15






                          active

                          oldest

                          votes








                          15 Answers
                          15






                          active

                          oldest

                          votes









                          active

                          oldest

                          votes






                          active

                          oldest

                          votes









                          3












                          $begingroup$


                          Jelly, 23 bytes



                          9“¡ȷṡẓh)ėḂYF@’ḃ_4ị@OS0<


                          Try it online!






                          share|improve this answer









                          $endgroup$


















                            3












                            $begingroup$


                            Jelly, 23 bytes



                            9“¡ȷṡẓh)ėḂYF@’ḃ_4ị@OS0<


                            Try it online!






                            share|improve this answer









                            $endgroup$
















                              3












                              3








                              3





                              $begingroup$


                              Jelly, 23 bytes



                              9“¡ȷṡẓh)ėḂYF@’ḃ_4ị@OS0<


                              Try it online!






                              share|improve this answer









                              $endgroup$




                              Jelly, 23 bytes



                              9“¡ȷṡẓh)ėḂYF@’ḃ_4ị@OS0<


                              Try it online!







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered 7 hours ago









                              Erik the OutgolferErik the Outgolfer

                              32.3k429104




                              32.3k429104























                                  2












                                  $begingroup$


                                  C (gcc), 84 82 81 79 75 bytes



                                  Assumes all caps.





                                  r;f(char*s){for(r=0;*s;r+="+-+,,-*/--*-)+(+),.*,-*+)+"[*s++%65]-43);s=r>0;}


                                  Try it online!






                                  share|improve this answer











                                  $endgroup$


















                                    2












                                    $begingroup$


                                    C (gcc), 84 82 81 79 75 bytes



                                    Assumes all caps.





                                    r;f(char*s){for(r=0;*s;r+="+-+,,-*/--*-)+(+),.*,-*+)+"[*s++%65]-43);s=r>0;}


                                    Try it online!






                                    share|improve this answer











                                    $endgroup$
















                                      2












                                      2








                                      2





                                      $begingroup$


                                      C (gcc), 84 82 81 79 75 bytes



                                      Assumes all caps.





                                      r;f(char*s){for(r=0;*s;r+="+-+,,-*/--*-)+(+),.*,-*+)+"[*s++%65]-43);s=r>0;}


                                      Try it online!






                                      share|improve this answer











                                      $endgroup$




                                      C (gcc), 84 82 81 79 75 bytes



                                      Assumes all caps.





                                      r;f(char*s){for(r=0;*s;r+="+-+,,-*/--*-)+(+),.*,-*+)+"[*s++%65]-43);s=r>0;}


                                      Try it online!







                                      share|improve this answer














                                      share|improve this answer



                                      share|improve this answer








                                      edited 5 hours ago

























                                      answered 6 hours ago









                                      gastropnergastropner

                                      2,1501511




                                      2,1501511























                                          2












                                          $begingroup$


                                          Java (JDK), 131 124 110 84 bytes



                                          Interestingly, "dot" is dash-heavy and "dash" is dot-heavy.



                                          Assumes all caps. Thanks to Expired Data for golfing 20 bytes and to Neil for golfing another 26 bytes!





                                          c->{int s=0;for(int a:c)s+="35344527512513031462452313".charAt(a-65)-51;return s>0;}


                                          Try it online!



                                          Ungolfed:



                                          c -> { // lambda taking an array of char as input and returning a boolean
                                          int s = 0; // keep track of the net total of dots
                                          for(int a : c) // look at each character's ASCII value
                                          s += "35344527512513031462452313".charAt(a - 65) - 51; // add the net dot impact of each letter to the total; 65 is ASCII code for 'A'; 48 is ASCII code for '0'; to save bytes, there are no negative values in the list - subtracting 3 rectifies that => -48 - 3 = -51
                                          return s > 0; // if the total is positive, the string is dot-heavy
                                          }





                                          share|improve this answer











                                          $endgroup$









                                          • 1




                                            $begingroup$
                                            124 bytes
                                            $endgroup$
                                            – Expired Data
                                            6 hours ago






                                          • 1




                                            $begingroup$
                                            Make that 111 bytes
                                            $endgroup$
                                            – Expired Data
                                            2 hours ago










                                          • $begingroup$
                                            Nice! One more byte can be saved by using int a instead of char a.
                                            $endgroup$
                                            – O.O.Balance
                                            2 hours ago






                                          • 1




                                            $begingroup$
                                            Why not use "35344527512513031462452313".charAt(a-65)-51?
                                            $endgroup$
                                            – Neil
                                            1 hour ago
















                                          2












                                          $begingroup$


                                          Java (JDK), 131 124 110 84 bytes



                                          Interestingly, "dot" is dash-heavy and "dash" is dot-heavy.



                                          Assumes all caps. Thanks to Expired Data for golfing 20 bytes and to Neil for golfing another 26 bytes!





                                          c->{int s=0;for(int a:c)s+="35344527512513031462452313".charAt(a-65)-51;return s>0;}


                                          Try it online!



                                          Ungolfed:



                                          c -> { // lambda taking an array of char as input and returning a boolean
                                          int s = 0; // keep track of the net total of dots
                                          for(int a : c) // look at each character's ASCII value
                                          s += "35344527512513031462452313".charAt(a - 65) - 51; // add the net dot impact of each letter to the total; 65 is ASCII code for 'A'; 48 is ASCII code for '0'; to save bytes, there are no negative values in the list - subtracting 3 rectifies that => -48 - 3 = -51
                                          return s > 0; // if the total is positive, the string is dot-heavy
                                          }





                                          share|improve this answer











                                          $endgroup$









                                          • 1




                                            $begingroup$
                                            124 bytes
                                            $endgroup$
                                            – Expired Data
                                            6 hours ago






                                          • 1




                                            $begingroup$
                                            Make that 111 bytes
                                            $endgroup$
                                            – Expired Data
                                            2 hours ago










                                          • $begingroup$
                                            Nice! One more byte can be saved by using int a instead of char a.
                                            $endgroup$
                                            – O.O.Balance
                                            2 hours ago






                                          • 1




                                            $begingroup$
                                            Why not use "35344527512513031462452313".charAt(a-65)-51?
                                            $endgroup$
                                            – Neil
                                            1 hour ago














                                          2












                                          2








                                          2





                                          $begingroup$


                                          Java (JDK), 131 124 110 84 bytes



                                          Interestingly, "dot" is dash-heavy and "dash" is dot-heavy.



                                          Assumes all caps. Thanks to Expired Data for golfing 20 bytes and to Neil for golfing another 26 bytes!





                                          c->{int s=0;for(int a:c)s+="35344527512513031462452313".charAt(a-65)-51;return s>0;}


                                          Try it online!



                                          Ungolfed:



                                          c -> { // lambda taking an array of char as input and returning a boolean
                                          int s = 0; // keep track of the net total of dots
                                          for(int a : c) // look at each character's ASCII value
                                          s += "35344527512513031462452313".charAt(a - 65) - 51; // add the net dot impact of each letter to the total; 65 is ASCII code for 'A'; 48 is ASCII code for '0'; to save bytes, there are no negative values in the list - subtracting 3 rectifies that => -48 - 3 = -51
                                          return s > 0; // if the total is positive, the string is dot-heavy
                                          }





                                          share|improve this answer











                                          $endgroup$




                                          Java (JDK), 131 124 110 84 bytes



                                          Interestingly, "dot" is dash-heavy and "dash" is dot-heavy.



                                          Assumes all caps. Thanks to Expired Data for golfing 20 bytes and to Neil for golfing another 26 bytes!





                                          c->{int s=0;for(int a:c)s+="35344527512513031462452313".charAt(a-65)-51;return s>0;}


                                          Try it online!



                                          Ungolfed:



                                          c -> { // lambda taking an array of char as input and returning a boolean
                                          int s = 0; // keep track of the net total of dots
                                          for(int a : c) // look at each character's ASCII value
                                          s += "35344527512513031462452313".charAt(a - 65) - 51; // add the net dot impact of each letter to the total; 65 is ASCII code for 'A'; 48 is ASCII code for '0'; to save bytes, there are no negative values in the list - subtracting 3 rectifies that => -48 - 3 = -51
                                          return s > 0; // if the total is positive, the string is dot-heavy
                                          }






                                          share|improve this answer














                                          share|improve this answer



                                          share|improve this answer








                                          edited 1 hour ago

























                                          answered 6 hours ago









                                          O.O.BalanceO.O.Balance

                                          1,2601318




                                          1,2601318








                                          • 1




                                            $begingroup$
                                            124 bytes
                                            $endgroup$
                                            – Expired Data
                                            6 hours ago






                                          • 1




                                            $begingroup$
                                            Make that 111 bytes
                                            $endgroup$
                                            – Expired Data
                                            2 hours ago










                                          • $begingroup$
                                            Nice! One more byte can be saved by using int a instead of char a.
                                            $endgroup$
                                            – O.O.Balance
                                            2 hours ago






                                          • 1




                                            $begingroup$
                                            Why not use "35344527512513031462452313".charAt(a-65)-51?
                                            $endgroup$
                                            – Neil
                                            1 hour ago














                                          • 1




                                            $begingroup$
                                            124 bytes
                                            $endgroup$
                                            – Expired Data
                                            6 hours ago






                                          • 1




                                            $begingroup$
                                            Make that 111 bytes
                                            $endgroup$
                                            – Expired Data
                                            2 hours ago










                                          • $begingroup$
                                            Nice! One more byte can be saved by using int a instead of char a.
                                            $endgroup$
                                            – O.O.Balance
                                            2 hours ago






                                          • 1




                                            $begingroup$
                                            Why not use "35344527512513031462452313".charAt(a-65)-51?
                                            $endgroup$
                                            – Neil
                                            1 hour ago








                                          1




                                          1




                                          $begingroup$
                                          124 bytes
                                          $endgroup$
                                          – Expired Data
                                          6 hours ago




                                          $begingroup$
                                          124 bytes
                                          $endgroup$
                                          – Expired Data
                                          6 hours ago




                                          1




                                          1




                                          $begingroup$
                                          Make that 111 bytes
                                          $endgroup$
                                          – Expired Data
                                          2 hours ago




                                          $begingroup$
                                          Make that 111 bytes
                                          $endgroup$
                                          – Expired Data
                                          2 hours ago












                                          $begingroup$
                                          Nice! One more byte can be saved by using int a instead of char a.
                                          $endgroup$
                                          – O.O.Balance
                                          2 hours ago




                                          $begingroup$
                                          Nice! One more byte can be saved by using int a instead of char a.
                                          $endgroup$
                                          – O.O.Balance
                                          2 hours ago




                                          1




                                          1




                                          $begingroup$
                                          Why not use "35344527512513031462452313".charAt(a-65)-51?
                                          $endgroup$
                                          – Neil
                                          1 hour ago




                                          $begingroup$
                                          Why not use "35344527512513031462452313".charAt(a-65)-51?
                                          $endgroup$
                                          – Neil
                                          1 hour ago











                                          1












                                          $begingroup$


                                          Retina 0.8.2, 51 bytes



                                          T`L`35344527412513031462452313
                                          .
                                          $*<>>>
                                          +`<>|><

                                          ^<


                                          Try it online! Link includes test cases. Only accepts upper case (+6 bytes for mixed case). Shamelessly stealing @Arnauld's string but I was going to use the same algorithm anyway. Explanation:



                                          T`L`35344527412513031462452313
                                          .


                                          Change each letter into the difference in numbers of dots and dashes, plus three, so O=0 and H=7.



                                          $*<>>>


                                          Represent the difference as that number of <s and three >s. (Sadly I can't use dots because they're special in regex.)



                                          +`<>|><


                                          Remove matched pairs of <s and >s.



                                          ^<


                                          Check whether there are still any dots left.






                                          share|improve this answer









                                          $endgroup$


















                                            1












                                            $begingroup$


                                            Retina 0.8.2, 51 bytes



                                            T`L`35344527412513031462452313
                                            .
                                            $*<>>>
                                            +`<>|><

                                            ^<


                                            Try it online! Link includes test cases. Only accepts upper case (+6 bytes for mixed case). Shamelessly stealing @Arnauld's string but I was going to use the same algorithm anyway. Explanation:



                                            T`L`35344527412513031462452313
                                            .


                                            Change each letter into the difference in numbers of dots and dashes, plus three, so O=0 and H=7.



                                            $*<>>>


                                            Represent the difference as that number of <s and three >s. (Sadly I can't use dots because they're special in regex.)



                                            +`<>|><


                                            Remove matched pairs of <s and >s.



                                            ^<


                                            Check whether there are still any dots left.






                                            share|improve this answer









                                            $endgroup$
















                                              1












                                              1








                                              1





                                              $begingroup$


                                              Retina 0.8.2, 51 bytes



                                              T`L`35344527412513031462452313
                                              .
                                              $*<>>>
                                              +`<>|><

                                              ^<


                                              Try it online! Link includes test cases. Only accepts upper case (+6 bytes for mixed case). Shamelessly stealing @Arnauld's string but I was going to use the same algorithm anyway. Explanation:



                                              T`L`35344527412513031462452313
                                              .


                                              Change each letter into the difference in numbers of dots and dashes, plus three, so O=0 and H=7.



                                              $*<>>>


                                              Represent the difference as that number of <s and three >s. (Sadly I can't use dots because they're special in regex.)



                                              +`<>|><


                                              Remove matched pairs of <s and >s.



                                              ^<


                                              Check whether there are still any dots left.






                                              share|improve this answer









                                              $endgroup$




                                              Retina 0.8.2, 51 bytes



                                              T`L`35344527412513031462452313
                                              .
                                              $*<>>>
                                              +`<>|><

                                              ^<


                                              Try it online! Link includes test cases. Only accepts upper case (+6 bytes for mixed case). Shamelessly stealing @Arnauld's string but I was going to use the same algorithm anyway. Explanation:



                                              T`L`35344527412513031462452313
                                              .


                                              Change each letter into the difference in numbers of dots and dashes, plus three, so O=0 and H=7.



                                              $*<>>>


                                              Represent the difference as that number of <s and three >s. (Sadly I can't use dots because they're special in regex.)



                                              +`<>|><


                                              Remove matched pairs of <s and >s.



                                              ^<


                                              Check whether there are still any dots left.







                                              share|improve this answer












                                              share|improve this answer



                                              share|improve this answer










                                              answered 7 hours ago









                                              NeilNeil

                                              81.5k745178




                                              81.5k745178























                                                  1












                                                  $begingroup$


                                                  Bash+coreutils,  64 60 bytes





                                                  tr a-z 35344526512513031462452313|sed s/./&z-+/g|dc -eIK?^p


                                                  Try it online!



                                                  Takes a string in lowercase, outputs zero for falsy, nonzero for truthy



                                                  Explanation



                                                  Uses tr and sed to create a dc program that looks like (for the example input 'hello'):



                                                  IK6z-+4z-+5z-+5z-+0z-+^p

                                                  IK Push 10, then 0 to the stack
                                                  6z-+ Push 6 (three more than the dots minus dashes in 'h'), subtract 3, and accumulate
                                                  ... Do the same for all other letters, so the stack now has the total dots minus dashes
                                                  ^ Raise 10 to this power - precision is zero so this turns negative/positive to falsy/truthy
                                                  p Print result





                                                  share|improve this answer











                                                  $endgroup$













                                                  • $begingroup$
                                                    Golfed two bytes by just putting the dc in the pipeline rather than use command substitution, then another byte by replacing <space>3 with z (conveniently, I have 3 items on the stack at that point!) and another byte by replacing the quotes around my sed program with a single backslash to escape the &
                                                    $endgroup$
                                                    – Sophia Lechner
                                                    5 hours ago


















                                                  1












                                                  $begingroup$


                                                  Bash+coreutils,  64 60 bytes





                                                  tr a-z 35344526512513031462452313|sed s/./&z-+/g|dc -eIK?^p


                                                  Try it online!



                                                  Takes a string in lowercase, outputs zero for falsy, nonzero for truthy



                                                  Explanation



                                                  Uses tr and sed to create a dc program that looks like (for the example input 'hello'):



                                                  IK6z-+4z-+5z-+5z-+0z-+^p

                                                  IK Push 10, then 0 to the stack
                                                  6z-+ Push 6 (three more than the dots minus dashes in 'h'), subtract 3, and accumulate
                                                  ... Do the same for all other letters, so the stack now has the total dots minus dashes
                                                  ^ Raise 10 to this power - precision is zero so this turns negative/positive to falsy/truthy
                                                  p Print result





                                                  share|improve this answer











                                                  $endgroup$













                                                  • $begingroup$
                                                    Golfed two bytes by just putting the dc in the pipeline rather than use command substitution, then another byte by replacing <space>3 with z (conveniently, I have 3 items on the stack at that point!) and another byte by replacing the quotes around my sed program with a single backslash to escape the &
                                                    $endgroup$
                                                    – Sophia Lechner
                                                    5 hours ago
















                                                  1












                                                  1








                                                  1





                                                  $begingroup$


                                                  Bash+coreutils,  64 60 bytes





                                                  tr a-z 35344526512513031462452313|sed s/./&z-+/g|dc -eIK?^p


                                                  Try it online!



                                                  Takes a string in lowercase, outputs zero for falsy, nonzero for truthy



                                                  Explanation



                                                  Uses tr and sed to create a dc program that looks like (for the example input 'hello'):



                                                  IK6z-+4z-+5z-+5z-+0z-+^p

                                                  IK Push 10, then 0 to the stack
                                                  6z-+ Push 6 (three more than the dots minus dashes in 'h'), subtract 3, and accumulate
                                                  ... Do the same for all other letters, so the stack now has the total dots minus dashes
                                                  ^ Raise 10 to this power - precision is zero so this turns negative/positive to falsy/truthy
                                                  p Print result





                                                  share|improve this answer











                                                  $endgroup$




                                                  Bash+coreutils,  64 60 bytes





                                                  tr a-z 35344526512513031462452313|sed s/./&z-+/g|dc -eIK?^p


                                                  Try it online!



                                                  Takes a string in lowercase, outputs zero for falsy, nonzero for truthy



                                                  Explanation



                                                  Uses tr and sed to create a dc program that looks like (for the example input 'hello'):



                                                  IK6z-+4z-+5z-+5z-+0z-+^p

                                                  IK Push 10, then 0 to the stack
                                                  6z-+ Push 6 (three more than the dots minus dashes in 'h'), subtract 3, and accumulate
                                                  ... Do the same for all other letters, so the stack now has the total dots minus dashes
                                                  ^ Raise 10 to this power - precision is zero so this turns negative/positive to falsy/truthy
                                                  p Print result






                                                  share|improve this answer














                                                  share|improve this answer



                                                  share|improve this answer








                                                  edited 5 hours ago

























                                                  answered 6 hours ago









                                                  Sophia LechnerSophia Lechner

                                                  8107




                                                  8107












                                                  • $begingroup$
                                                    Golfed two bytes by just putting the dc in the pipeline rather than use command substitution, then another byte by replacing <space>3 with z (conveniently, I have 3 items on the stack at that point!) and another byte by replacing the quotes around my sed program with a single backslash to escape the &
                                                    $endgroup$
                                                    – Sophia Lechner
                                                    5 hours ago




















                                                  • $begingroup$
                                                    Golfed two bytes by just putting the dc in the pipeline rather than use command substitution, then another byte by replacing <space>3 with z (conveniently, I have 3 items on the stack at that point!) and another byte by replacing the quotes around my sed program with a single backslash to escape the &
                                                    $endgroup$
                                                    – Sophia Lechner
                                                    5 hours ago


















                                                  $begingroup$
                                                  Golfed two bytes by just putting the dc in the pipeline rather than use command substitution, then another byte by replacing <space>3 with z (conveniently, I have 3 items on the stack at that point!) and another byte by replacing the quotes around my sed program with a single backslash to escape the &
                                                  $endgroup$
                                                  – Sophia Lechner
                                                  5 hours ago






                                                  $begingroup$
                                                  Golfed two bytes by just putting the dc in the pipeline rather than use command substitution, then another byte by replacing <space>3 with z (conveniently, I have 3 items on the stack at that point!) and another byte by replacing the quotes around my sed program with a single backslash to escape the &
                                                  $endgroup$
                                                  – Sophia Lechner
                                                  5 hours ago













                                                  1












                                                  $begingroup$


                                                  APL (Dyalog Extended), 24 bytesSBCS





                                                  Anonymous tacit prefix function taking uppercase as argument.



                                                  ⎕CY'dfns'
                                                  >/'.-'⍧∊∘morse


                                                  Try it online!



                                                  ⎕CY'dfns' copy in the dfns library



                                                  morse convert to list of Morse strings
                                                   then
                                                  ϵnlist (flatten)
                                                  '.-'⍧ count the number of dots and dashes in that
                                                  >/ more dots than dashes? (lit. greater-than reduction)






                                                  share|improve this answer









                                                  $endgroup$


















                                                    1












                                                    $begingroup$


                                                    APL (Dyalog Extended), 24 bytesSBCS





                                                    Anonymous tacit prefix function taking uppercase as argument.



                                                    ⎕CY'dfns'
                                                    >/'.-'⍧∊∘morse


                                                    Try it online!



                                                    ⎕CY'dfns' copy in the dfns library



                                                    morse convert to list of Morse strings
                                                     then
                                                    ϵnlist (flatten)
                                                    '.-'⍧ count the number of dots and dashes in that
                                                    >/ more dots than dashes? (lit. greater-than reduction)






                                                    share|improve this answer









                                                    $endgroup$
















                                                      1












                                                      1








                                                      1





                                                      $begingroup$


                                                      APL (Dyalog Extended), 24 bytesSBCS





                                                      Anonymous tacit prefix function taking uppercase as argument.



                                                      ⎕CY'dfns'
                                                      >/'.-'⍧∊∘morse


                                                      Try it online!



                                                      ⎕CY'dfns' copy in the dfns library



                                                      morse convert to list of Morse strings
                                                       then
                                                      ϵnlist (flatten)
                                                      '.-'⍧ count the number of dots and dashes in that
                                                      >/ more dots than dashes? (lit. greater-than reduction)






                                                      share|improve this answer









                                                      $endgroup$




                                                      APL (Dyalog Extended), 24 bytesSBCS





                                                      Anonymous tacit prefix function taking uppercase as argument.



                                                      ⎕CY'dfns'
                                                      >/'.-'⍧∊∘morse


                                                      Try it online!



                                                      ⎕CY'dfns' copy in the dfns library



                                                      morse convert to list of Morse strings
                                                       then
                                                      ϵnlist (flatten)
                                                      '.-'⍧ count the number of dots and dashes in that
                                                      >/ more dots than dashes? (lit. greater-than reduction)







                                                      share|improve this answer












                                                      share|improve this answer



                                                      share|improve this answer










                                                      answered 4 hours ago









                                                      AdámAdám

                                                      28.6k276204




                                                      28.6k276204























                                                          1












                                                          $begingroup$


                                                          05AB1E, 22 bytes



                                                          εA•U(Õþć6Δ
                                                          »›I•‡3-}O.±


                                                          Try it online!



                                                          Explanation



                                                          •U(Õþć6Δ
                                                          »›I•


                                                          is 35344527512513031462452313 compressed to base 255.



                                                          ε         }     # apply to each char in input
                                                          ‡ # transliterate
                                                          A # the lowercase alphabet
                                                          •...• # with the digits from the compressed string
                                                          3- # subtract 3 from each
                                                          O # then sum the result
                                                          .± # and take the sign





                                                          share|improve this answer











                                                          $endgroup$


















                                                            1












                                                            $begingroup$


                                                            05AB1E, 22 bytes



                                                            εA•U(Õþć6Δ
                                                            »›I•‡3-}O.±


                                                            Try it online!



                                                            Explanation



                                                            •U(Õþć6Δ
                                                            »›I•


                                                            is 35344527512513031462452313 compressed to base 255.



                                                            ε         }     # apply to each char in input
                                                            ‡ # transliterate
                                                            A # the lowercase alphabet
                                                            •...• # with the digits from the compressed string
                                                            3- # subtract 3 from each
                                                            O # then sum the result
                                                            .± # and take the sign





                                                            share|improve this answer











                                                            $endgroup$
















                                                              1












                                                              1








                                                              1





                                                              $begingroup$


                                                              05AB1E, 22 bytes



                                                              εA•U(Õþć6Δ
                                                              »›I•‡3-}O.±


                                                              Try it online!



                                                              Explanation



                                                              •U(Õþć6Δ
                                                              »›I•


                                                              is 35344527512513031462452313 compressed to base 255.



                                                              ε         }     # apply to each char in input
                                                              ‡ # transliterate
                                                              A # the lowercase alphabet
                                                              •...• # with the digits from the compressed string
                                                              3- # subtract 3 from each
                                                              O # then sum the result
                                                              .± # and take the sign





                                                              share|improve this answer











                                                              $endgroup$




                                                              05AB1E, 22 bytes



                                                              εA•U(Õþć6Δ
                                                              »›I•‡3-}O.±


                                                              Try it online!



                                                              Explanation



                                                              •U(Õþć6Δ
                                                              »›I•


                                                              is 35344527512513031462452313 compressed to base 255.



                                                              ε         }     # apply to each char in input
                                                              ‡ # transliterate
                                                              A # the lowercase alphabet
                                                              •...• # with the digits from the compressed string
                                                              3- # subtract 3 from each
                                                              O # then sum the result
                                                              .± # and take the sign






                                                              share|improve this answer














                                                              share|improve this answer



                                                              share|improve this answer








                                                              edited 2 hours ago

























                                                              answered 2 hours ago









                                                              EmignaEmigna

                                                              46.9k433142




                                                              46.9k433142























                                                                  1












                                                                  $begingroup$


                                                                  Jelly, 21 bytes



                                                                  Oị“ÆġwıMƥ)ɠịṙ{’D¤Æm>4


                                                                  Try it online!



                                                                  How?



                                                                  Oị“ÆġwıMƥ)ɠịṙ{’D¤Æm>4 - Link: list of characters ([A-Z]), S
                                                                  ¤ - nilad followed by link(s) as a nilad:
                                                                  “ÆġwıMƥ)ɠịṙ{’ - base 250 integer = 14257356342446455638623624
                                                                  D - to decimal digits
                                                                  - -- that is the number of dots less the number of dashes plus 4
                                                                  - ... for each of OPQRSTUVWXYZABCDEFGHIJKLMN
                                                                  O - ordinals of S e.g. "ATHROUGHZ" -> [65,84,72,82,79,85,71,72,90]
                                                                  ị - index into (1-indexed & modular, so O gets the 79%26 = 1st item
                                                                  - or A gets the 65%26 = 13th item
                                                                  Æm - arithmetic mean
                                                                  >4 - greater than 4?





                                                                  share|improve this answer











                                                                  $endgroup$


















                                                                    1












                                                                    $begingroup$


                                                                    Jelly, 21 bytes



                                                                    Oị“ÆġwıMƥ)ɠịṙ{’D¤Æm>4


                                                                    Try it online!



                                                                    How?



                                                                    Oị“ÆġwıMƥ)ɠịṙ{’D¤Æm>4 - Link: list of characters ([A-Z]), S
                                                                    ¤ - nilad followed by link(s) as a nilad:
                                                                    “ÆġwıMƥ)ɠịṙ{’ - base 250 integer = 14257356342446455638623624
                                                                    D - to decimal digits
                                                                    - -- that is the number of dots less the number of dashes plus 4
                                                                    - ... for each of OPQRSTUVWXYZABCDEFGHIJKLMN
                                                                    O - ordinals of S e.g. "ATHROUGHZ" -> [65,84,72,82,79,85,71,72,90]
                                                                    ị - index into (1-indexed & modular, so O gets the 79%26 = 1st item
                                                                    - or A gets the 65%26 = 13th item
                                                                    Æm - arithmetic mean
                                                                    >4 - greater than 4?





                                                                    share|improve this answer











                                                                    $endgroup$
















                                                                      1












                                                                      1








                                                                      1





                                                                      $begingroup$


                                                                      Jelly, 21 bytes



                                                                      Oị“ÆġwıMƥ)ɠịṙ{’D¤Æm>4


                                                                      Try it online!



                                                                      How?



                                                                      Oị“ÆġwıMƥ)ɠịṙ{’D¤Æm>4 - Link: list of characters ([A-Z]), S
                                                                      ¤ - nilad followed by link(s) as a nilad:
                                                                      “ÆġwıMƥ)ɠịṙ{’ - base 250 integer = 14257356342446455638623624
                                                                      D - to decimal digits
                                                                      - -- that is the number of dots less the number of dashes plus 4
                                                                      - ... for each of OPQRSTUVWXYZABCDEFGHIJKLMN
                                                                      O - ordinals of S e.g. "ATHROUGHZ" -> [65,84,72,82,79,85,71,72,90]
                                                                      ị - index into (1-indexed & modular, so O gets the 79%26 = 1st item
                                                                      - or A gets the 65%26 = 13th item
                                                                      Æm - arithmetic mean
                                                                      >4 - greater than 4?





                                                                      share|improve this answer











                                                                      $endgroup$




                                                                      Jelly, 21 bytes



                                                                      Oị“ÆġwıMƥ)ɠịṙ{’D¤Æm>4


                                                                      Try it online!



                                                                      How?



                                                                      Oị“ÆġwıMƥ)ɠịṙ{’D¤Æm>4 - Link: list of characters ([A-Z]), S
                                                                      ¤ - nilad followed by link(s) as a nilad:
                                                                      “ÆġwıMƥ)ɠịṙ{’ - base 250 integer = 14257356342446455638623624
                                                                      D - to decimal digits
                                                                      - -- that is the number of dots less the number of dashes plus 4
                                                                      - ... for each of OPQRSTUVWXYZABCDEFGHIJKLMN
                                                                      O - ordinals of S e.g. "ATHROUGHZ" -> [65,84,72,82,79,85,71,72,90]
                                                                      ị - index into (1-indexed & modular, so O gets the 79%26 = 1st item
                                                                      - or A gets the 65%26 = 13th item
                                                                      Æm - arithmetic mean
                                                                      >4 - greater than 4?






                                                                      share|improve this answer














                                                                      share|improve this answer



                                                                      share|improve this answer








                                                                      edited 2 hours ago

























                                                                      answered 2 hours ago









                                                                      Jonathan AllanJonathan Allan

                                                                      52.8k535171




                                                                      52.8k535171























                                                                          1












                                                                          $begingroup$

                                                                          IBM PC DOS, 8088 assembly, 54 35 bytes



                                                                          -19 bytes using the difference method



                                                                          ac2c 41d0 d8d7 7206 51b1 04d2 e859 240f 2c03 02e0 e2ea 3534 4527 4125 1303 1462 4523 13


                                                                          Unassembled:



                                                                          ; compare dashes and dots in a morse code string
                                                                          ; input:
                                                                          ; I: pointer to input string (default SI)
                                                                          ; IL: length of input string (default CX)
                                                                          ; TBL: pointer to data table (default BX)
                                                                          ; output:
                                                                          ; Sign/OF flags: Dot-heavy: SF == OF (JGE), Dash-heavy: SF != OF (JL)
                                                                          MORSE_DD MACRO I, IL, TBL
                                                                          LOCAL LOOP_LETTER, ODD
                                                                          IFDIFI <I>,<SI> ; skip if S is already SI
                                                                          MOV SI, I ; load string into SI
                                                                          ENDIF
                                                                          IFDIFI <IL>,<CX> ; skip if IL is already CX
                                                                          MOV CX, IL ; set up loop counter
                                                                          ENDIF
                                                                          IFDIFI <TBL>,<BX> ; skip if TBL is already BX
                                                                          MOV BX, OFFSET TBL ; load letter table into BX
                                                                          ENDIF
                                                                          LOOP_LETTER:
                                                                          LODSB ; load next char from DS:SI into AL, advance SI
                                                                          ;AND AL, 0DFH ; uppercase the input letter (+2 bytes)
                                                                          SUB AL, 'A' ; convert letter to zero-based index
                                                                          RCR AL, 1 ; divide index by 2, set CF if odd index
                                                                          XLAT ; lookup letter in table
                                                                          JC ODD ; if odd index use low nibble; if even use high nibble
                                                                          PUSH CX ; save loop counter (since SHR can only take CL on 8088)
                                                                          MOV CL, 4 ; set up right shift for 4 bits
                                                                          SHR AL, CL ; shift right
                                                                          POP CX ; restore loop counter
                                                                          ODD:
                                                                          AND AL, 0FH ; mask low nibble
                                                                          SUB AL, 3 ; unbias dash/dot difference +3 positive
                                                                          ADD AH, AL ; add letter difference to sum (set result flags)
                                                                          LOOP LOOP_LETTER
                                                                          ENDM

                                                                          TBL DB 035H, 034H, 045H, 027H, 041H, 025H, 013H, 003H, 014H, 062H, 045H, 023H, 013H


                                                                          Explanation



                                                                          Implemented in Intel/MASM syntax as a MACRO (basically a function), using only 8088 compatible instructions. Input as uppercase string (or +2 bytes to allow mixed-case), output Truthy/Falsy result is SF == OF (use JG or JL to test).



                                                                          The letter difference table values are stored as binary nibbles, so only takes 13 bytes in total.



                                                                          Original (54 bytes):



                                                                          ; compare dashes and dots in a Morse code string
                                                                          ; input:
                                                                          ; I: pointer to input string (default SI)
                                                                          ; IL: length of input string (default CX)
                                                                          ; TBL: pointer to data table
                                                                          ; output:
                                                                          ; Carry Flag: CF=1 (CY) if dot-heavy, CF=0 (NC) if dash-heavy
                                                                          MORSE_DD MACRO I, IL, TBL
                                                                          LOCAL LOOP_LETTER
                                                                          IFDIFI <I>,<SI> ; skip if S is already SI
                                                                          MOV SI, I ; load string into SI
                                                                          ENDIF
                                                                          IFDIFI <IL>,<CX> ; skip if IL is already CX
                                                                          MOV CX, IL ; set up loop counter
                                                                          ENDIF
                                                                          MOV BX, OFFSET TBL ; load score table into BX
                                                                          XOR DX, DX ; clear DX to hold total score
                                                                          LOOP_LETTER:
                                                                          LODSB ; load next char from DS:SI into AL, advance SI
                                                                          ;AND AL, 0DFH ; uppercase the input letter (+2 bytes)
                                                                          SUB AL, 'A' ; convert letter to zero-based index
                                                                          XLAT ; lookup letter in table
                                                                          MOV AH, AL ; examine dot nibble
                                                                          AND AH, 0FH ; mask off dash nibble
                                                                          ADD DH, AH ; add letter dot count to total
                                                                          PUSH CX ; save loop counter (since SHR can only take CL)
                                                                          MOV CL, 4 ; set up right shift for 4 bits
                                                                          SHR AL, CL ; shift right
                                                                          POP CX ; restore loop counter
                                                                          ADD DL, AL ; add letter dash count to total
                                                                          LOOP LOOP_LETTER
                                                                          CMP DL, DH ; if dot-heavy CF=1, if dash-heavy CF=0
                                                                          ENDM

                                                                          ; data table A-Z: MSN = count of dash, LSN = count of dot
                                                                          TBL DB 011H, 013H, 022H, 012H, 001H, 013H, 021H, 004H, 002H
                                                                          DB 031H, 021H, 013H, 020H, 011H, 030H, 022H, 031H, 012H
                                                                          DB 003H, 010H, 012H, 013H, 021H, 022H, 031H, 022H


                                                                          Explanation



                                                                          Implemented in Intel/MASM syntax as a MACRO (basically a function), using only 8088 compatible instructions. Input as string, output Truthy/Falsy result in Carry Flag. Score table contains the number of dashes and dots per letter.



                                                                          Input is upper case. Add 2 bytes to take lower or mixed case.



                                                                          Example Test Program (as IBM PC DOS standalone COM executable)



                                                                              SHR  SI, 1              ; point SI to DOS PSP
                                                                          LODSW ; load arg length into AL, advance SI to 82H
                                                                          MOV CL, AL ; set up loop counter in CH
                                                                          DEC CX ; remove leading space from letter count

                                                                          MORSE_DD SI, CX, TBL ; execute above function, result is in CF

                                                                          MOV DX, OFFSET F ; default output to "Falsy" string
                                                                          JA DISP_OUT ; if CF=0, result is falsy, skip to output
                                                                          MOV DX, OFFSET T ; otherwise CF=1, set output to "Truthy" string
                                                                          DISP_OUT:
                                                                          MOV AH, 09H ; DOS API display string function
                                                                          INT 21H
                                                                          RET

                                                                          T DB "Truthy$"
                                                                          F DB "Falsy$"


                                                                          Example Output:



                                                                          enter image description here



                                                                          Download test program DD.COM



                                                                          Or Try it Online!
                                                                          I'm not aware of an online TIO to direct link to a DOS executable, however you can use this with just a few steps:




                                                                          1. Download DD.COM as a ZIP file

                                                                          2. Go to https://virtualconsoles.com/online-emulators/DOS/

                                                                          3. Upload the ZIP file you just downloaded, click Start

                                                                          4. Type DD Hello or DD code to your heart's content






                                                                          share|improve this answer











                                                                          $endgroup$


















                                                                            1












                                                                            $begingroup$

                                                                            IBM PC DOS, 8088 assembly, 54 35 bytes



                                                                            -19 bytes using the difference method



                                                                            ac2c 41d0 d8d7 7206 51b1 04d2 e859 240f 2c03 02e0 e2ea 3534 4527 4125 1303 1462 4523 13


                                                                            Unassembled:



                                                                            ; compare dashes and dots in a morse code string
                                                                            ; input:
                                                                            ; I: pointer to input string (default SI)
                                                                            ; IL: length of input string (default CX)
                                                                            ; TBL: pointer to data table (default BX)
                                                                            ; output:
                                                                            ; Sign/OF flags: Dot-heavy: SF == OF (JGE), Dash-heavy: SF != OF (JL)
                                                                            MORSE_DD MACRO I, IL, TBL
                                                                            LOCAL LOOP_LETTER, ODD
                                                                            IFDIFI <I>,<SI> ; skip if S is already SI
                                                                            MOV SI, I ; load string into SI
                                                                            ENDIF
                                                                            IFDIFI <IL>,<CX> ; skip if IL is already CX
                                                                            MOV CX, IL ; set up loop counter
                                                                            ENDIF
                                                                            IFDIFI <TBL>,<BX> ; skip if TBL is already BX
                                                                            MOV BX, OFFSET TBL ; load letter table into BX
                                                                            ENDIF
                                                                            LOOP_LETTER:
                                                                            LODSB ; load next char from DS:SI into AL, advance SI
                                                                            ;AND AL, 0DFH ; uppercase the input letter (+2 bytes)
                                                                            SUB AL, 'A' ; convert letter to zero-based index
                                                                            RCR AL, 1 ; divide index by 2, set CF if odd index
                                                                            XLAT ; lookup letter in table
                                                                            JC ODD ; if odd index use low nibble; if even use high nibble
                                                                            PUSH CX ; save loop counter (since SHR can only take CL on 8088)
                                                                            MOV CL, 4 ; set up right shift for 4 bits
                                                                            SHR AL, CL ; shift right
                                                                            POP CX ; restore loop counter
                                                                            ODD:
                                                                            AND AL, 0FH ; mask low nibble
                                                                            SUB AL, 3 ; unbias dash/dot difference +3 positive
                                                                            ADD AH, AL ; add letter difference to sum (set result flags)
                                                                            LOOP LOOP_LETTER
                                                                            ENDM

                                                                            TBL DB 035H, 034H, 045H, 027H, 041H, 025H, 013H, 003H, 014H, 062H, 045H, 023H, 013H


                                                                            Explanation



                                                                            Implemented in Intel/MASM syntax as a MACRO (basically a function), using only 8088 compatible instructions. Input as uppercase string (or +2 bytes to allow mixed-case), output Truthy/Falsy result is SF == OF (use JG or JL to test).



                                                                            The letter difference table values are stored as binary nibbles, so only takes 13 bytes in total.



                                                                            Original (54 bytes):



                                                                            ; compare dashes and dots in a Morse code string
                                                                            ; input:
                                                                            ; I: pointer to input string (default SI)
                                                                            ; IL: length of input string (default CX)
                                                                            ; TBL: pointer to data table
                                                                            ; output:
                                                                            ; Carry Flag: CF=1 (CY) if dot-heavy, CF=0 (NC) if dash-heavy
                                                                            MORSE_DD MACRO I, IL, TBL
                                                                            LOCAL LOOP_LETTER
                                                                            IFDIFI <I>,<SI> ; skip if S is already SI
                                                                            MOV SI, I ; load string into SI
                                                                            ENDIF
                                                                            IFDIFI <IL>,<CX> ; skip if IL is already CX
                                                                            MOV CX, IL ; set up loop counter
                                                                            ENDIF
                                                                            MOV BX, OFFSET TBL ; load score table into BX
                                                                            XOR DX, DX ; clear DX to hold total score
                                                                            LOOP_LETTER:
                                                                            LODSB ; load next char from DS:SI into AL, advance SI
                                                                            ;AND AL, 0DFH ; uppercase the input letter (+2 bytes)
                                                                            SUB AL, 'A' ; convert letter to zero-based index
                                                                            XLAT ; lookup letter in table
                                                                            MOV AH, AL ; examine dot nibble
                                                                            AND AH, 0FH ; mask off dash nibble
                                                                            ADD DH, AH ; add letter dot count to total
                                                                            PUSH CX ; save loop counter (since SHR can only take CL)
                                                                            MOV CL, 4 ; set up right shift for 4 bits
                                                                            SHR AL, CL ; shift right
                                                                            POP CX ; restore loop counter
                                                                            ADD DL, AL ; add letter dash count to total
                                                                            LOOP LOOP_LETTER
                                                                            CMP DL, DH ; if dot-heavy CF=1, if dash-heavy CF=0
                                                                            ENDM

                                                                            ; data table A-Z: MSN = count of dash, LSN = count of dot
                                                                            TBL DB 011H, 013H, 022H, 012H, 001H, 013H, 021H, 004H, 002H
                                                                            DB 031H, 021H, 013H, 020H, 011H, 030H, 022H, 031H, 012H
                                                                            DB 003H, 010H, 012H, 013H, 021H, 022H, 031H, 022H


                                                                            Explanation



                                                                            Implemented in Intel/MASM syntax as a MACRO (basically a function), using only 8088 compatible instructions. Input as string, output Truthy/Falsy result in Carry Flag. Score table contains the number of dashes and dots per letter.



                                                                            Input is upper case. Add 2 bytes to take lower or mixed case.



                                                                            Example Test Program (as IBM PC DOS standalone COM executable)



                                                                                SHR  SI, 1              ; point SI to DOS PSP
                                                                            LODSW ; load arg length into AL, advance SI to 82H
                                                                            MOV CL, AL ; set up loop counter in CH
                                                                            DEC CX ; remove leading space from letter count

                                                                            MORSE_DD SI, CX, TBL ; execute above function, result is in CF

                                                                            MOV DX, OFFSET F ; default output to "Falsy" string
                                                                            JA DISP_OUT ; if CF=0, result is falsy, skip to output
                                                                            MOV DX, OFFSET T ; otherwise CF=1, set output to "Truthy" string
                                                                            DISP_OUT:
                                                                            MOV AH, 09H ; DOS API display string function
                                                                            INT 21H
                                                                            RET

                                                                            T DB "Truthy$"
                                                                            F DB "Falsy$"


                                                                            Example Output:



                                                                            enter image description here



                                                                            Download test program DD.COM



                                                                            Or Try it Online!
                                                                            I'm not aware of an online TIO to direct link to a DOS executable, however you can use this with just a few steps:




                                                                            1. Download DD.COM as a ZIP file

                                                                            2. Go to https://virtualconsoles.com/online-emulators/DOS/

                                                                            3. Upload the ZIP file you just downloaded, click Start

                                                                            4. Type DD Hello or DD code to your heart's content






                                                                            share|improve this answer











                                                                            $endgroup$
















                                                                              1












                                                                              1








                                                                              1





                                                                              $begingroup$

                                                                              IBM PC DOS, 8088 assembly, 54 35 bytes



                                                                              -19 bytes using the difference method



                                                                              ac2c 41d0 d8d7 7206 51b1 04d2 e859 240f 2c03 02e0 e2ea 3534 4527 4125 1303 1462 4523 13


                                                                              Unassembled:



                                                                              ; compare dashes and dots in a morse code string
                                                                              ; input:
                                                                              ; I: pointer to input string (default SI)
                                                                              ; IL: length of input string (default CX)
                                                                              ; TBL: pointer to data table (default BX)
                                                                              ; output:
                                                                              ; Sign/OF flags: Dot-heavy: SF == OF (JGE), Dash-heavy: SF != OF (JL)
                                                                              MORSE_DD MACRO I, IL, TBL
                                                                              LOCAL LOOP_LETTER, ODD
                                                                              IFDIFI <I>,<SI> ; skip if S is already SI
                                                                              MOV SI, I ; load string into SI
                                                                              ENDIF
                                                                              IFDIFI <IL>,<CX> ; skip if IL is already CX
                                                                              MOV CX, IL ; set up loop counter
                                                                              ENDIF
                                                                              IFDIFI <TBL>,<BX> ; skip if TBL is already BX
                                                                              MOV BX, OFFSET TBL ; load letter table into BX
                                                                              ENDIF
                                                                              LOOP_LETTER:
                                                                              LODSB ; load next char from DS:SI into AL, advance SI
                                                                              ;AND AL, 0DFH ; uppercase the input letter (+2 bytes)
                                                                              SUB AL, 'A' ; convert letter to zero-based index
                                                                              RCR AL, 1 ; divide index by 2, set CF if odd index
                                                                              XLAT ; lookup letter in table
                                                                              JC ODD ; if odd index use low nibble; if even use high nibble
                                                                              PUSH CX ; save loop counter (since SHR can only take CL on 8088)
                                                                              MOV CL, 4 ; set up right shift for 4 bits
                                                                              SHR AL, CL ; shift right
                                                                              POP CX ; restore loop counter
                                                                              ODD:
                                                                              AND AL, 0FH ; mask low nibble
                                                                              SUB AL, 3 ; unbias dash/dot difference +3 positive
                                                                              ADD AH, AL ; add letter difference to sum (set result flags)
                                                                              LOOP LOOP_LETTER
                                                                              ENDM

                                                                              TBL DB 035H, 034H, 045H, 027H, 041H, 025H, 013H, 003H, 014H, 062H, 045H, 023H, 013H


                                                                              Explanation



                                                                              Implemented in Intel/MASM syntax as a MACRO (basically a function), using only 8088 compatible instructions. Input as uppercase string (or +2 bytes to allow mixed-case), output Truthy/Falsy result is SF == OF (use JG or JL to test).



                                                                              The letter difference table values are stored as binary nibbles, so only takes 13 bytes in total.



                                                                              Original (54 bytes):



                                                                              ; compare dashes and dots in a Morse code string
                                                                              ; input:
                                                                              ; I: pointer to input string (default SI)
                                                                              ; IL: length of input string (default CX)
                                                                              ; TBL: pointer to data table
                                                                              ; output:
                                                                              ; Carry Flag: CF=1 (CY) if dot-heavy, CF=0 (NC) if dash-heavy
                                                                              MORSE_DD MACRO I, IL, TBL
                                                                              LOCAL LOOP_LETTER
                                                                              IFDIFI <I>,<SI> ; skip if S is already SI
                                                                              MOV SI, I ; load string into SI
                                                                              ENDIF
                                                                              IFDIFI <IL>,<CX> ; skip if IL is already CX
                                                                              MOV CX, IL ; set up loop counter
                                                                              ENDIF
                                                                              MOV BX, OFFSET TBL ; load score table into BX
                                                                              XOR DX, DX ; clear DX to hold total score
                                                                              LOOP_LETTER:
                                                                              LODSB ; load next char from DS:SI into AL, advance SI
                                                                              ;AND AL, 0DFH ; uppercase the input letter (+2 bytes)
                                                                              SUB AL, 'A' ; convert letter to zero-based index
                                                                              XLAT ; lookup letter in table
                                                                              MOV AH, AL ; examine dot nibble
                                                                              AND AH, 0FH ; mask off dash nibble
                                                                              ADD DH, AH ; add letter dot count to total
                                                                              PUSH CX ; save loop counter (since SHR can only take CL)
                                                                              MOV CL, 4 ; set up right shift for 4 bits
                                                                              SHR AL, CL ; shift right
                                                                              POP CX ; restore loop counter
                                                                              ADD DL, AL ; add letter dash count to total
                                                                              LOOP LOOP_LETTER
                                                                              CMP DL, DH ; if dot-heavy CF=1, if dash-heavy CF=0
                                                                              ENDM

                                                                              ; data table A-Z: MSN = count of dash, LSN = count of dot
                                                                              TBL DB 011H, 013H, 022H, 012H, 001H, 013H, 021H, 004H, 002H
                                                                              DB 031H, 021H, 013H, 020H, 011H, 030H, 022H, 031H, 012H
                                                                              DB 003H, 010H, 012H, 013H, 021H, 022H, 031H, 022H


                                                                              Explanation



                                                                              Implemented in Intel/MASM syntax as a MACRO (basically a function), using only 8088 compatible instructions. Input as string, output Truthy/Falsy result in Carry Flag. Score table contains the number of dashes and dots per letter.



                                                                              Input is upper case. Add 2 bytes to take lower or mixed case.



                                                                              Example Test Program (as IBM PC DOS standalone COM executable)



                                                                                  SHR  SI, 1              ; point SI to DOS PSP
                                                                              LODSW ; load arg length into AL, advance SI to 82H
                                                                              MOV CL, AL ; set up loop counter in CH
                                                                              DEC CX ; remove leading space from letter count

                                                                              MORSE_DD SI, CX, TBL ; execute above function, result is in CF

                                                                              MOV DX, OFFSET F ; default output to "Falsy" string
                                                                              JA DISP_OUT ; if CF=0, result is falsy, skip to output
                                                                              MOV DX, OFFSET T ; otherwise CF=1, set output to "Truthy" string
                                                                              DISP_OUT:
                                                                              MOV AH, 09H ; DOS API display string function
                                                                              INT 21H
                                                                              RET

                                                                              T DB "Truthy$"
                                                                              F DB "Falsy$"


                                                                              Example Output:



                                                                              enter image description here



                                                                              Download test program DD.COM



                                                                              Or Try it Online!
                                                                              I'm not aware of an online TIO to direct link to a DOS executable, however you can use this with just a few steps:




                                                                              1. Download DD.COM as a ZIP file

                                                                              2. Go to https://virtualconsoles.com/online-emulators/DOS/

                                                                              3. Upload the ZIP file you just downloaded, click Start

                                                                              4. Type DD Hello or DD code to your heart's content






                                                                              share|improve this answer











                                                                              $endgroup$



                                                                              IBM PC DOS, 8088 assembly, 54 35 bytes



                                                                              -19 bytes using the difference method



                                                                              ac2c 41d0 d8d7 7206 51b1 04d2 e859 240f 2c03 02e0 e2ea 3534 4527 4125 1303 1462 4523 13


                                                                              Unassembled:



                                                                              ; compare dashes and dots in a morse code string
                                                                              ; input:
                                                                              ; I: pointer to input string (default SI)
                                                                              ; IL: length of input string (default CX)
                                                                              ; TBL: pointer to data table (default BX)
                                                                              ; output:
                                                                              ; Sign/OF flags: Dot-heavy: SF == OF (JGE), Dash-heavy: SF != OF (JL)
                                                                              MORSE_DD MACRO I, IL, TBL
                                                                              LOCAL LOOP_LETTER, ODD
                                                                              IFDIFI <I>,<SI> ; skip if S is already SI
                                                                              MOV SI, I ; load string into SI
                                                                              ENDIF
                                                                              IFDIFI <IL>,<CX> ; skip if IL is already CX
                                                                              MOV CX, IL ; set up loop counter
                                                                              ENDIF
                                                                              IFDIFI <TBL>,<BX> ; skip if TBL is already BX
                                                                              MOV BX, OFFSET TBL ; load letter table into BX
                                                                              ENDIF
                                                                              LOOP_LETTER:
                                                                              LODSB ; load next char from DS:SI into AL, advance SI
                                                                              ;AND AL, 0DFH ; uppercase the input letter (+2 bytes)
                                                                              SUB AL, 'A' ; convert letter to zero-based index
                                                                              RCR AL, 1 ; divide index by 2, set CF if odd index
                                                                              XLAT ; lookup letter in table
                                                                              JC ODD ; if odd index use low nibble; if even use high nibble
                                                                              PUSH CX ; save loop counter (since SHR can only take CL on 8088)
                                                                              MOV CL, 4 ; set up right shift for 4 bits
                                                                              SHR AL, CL ; shift right
                                                                              POP CX ; restore loop counter
                                                                              ODD:
                                                                              AND AL, 0FH ; mask low nibble
                                                                              SUB AL, 3 ; unbias dash/dot difference +3 positive
                                                                              ADD AH, AL ; add letter difference to sum (set result flags)
                                                                              LOOP LOOP_LETTER
                                                                              ENDM

                                                                              TBL DB 035H, 034H, 045H, 027H, 041H, 025H, 013H, 003H, 014H, 062H, 045H, 023H, 013H


                                                                              Explanation



                                                                              Implemented in Intel/MASM syntax as a MACRO (basically a function), using only 8088 compatible instructions. Input as uppercase string (or +2 bytes to allow mixed-case), output Truthy/Falsy result is SF == OF (use JG or JL to test).



                                                                              The letter difference table values are stored as binary nibbles, so only takes 13 bytes in total.



                                                                              Original (54 bytes):



                                                                              ; compare dashes and dots in a Morse code string
                                                                              ; input:
                                                                              ; I: pointer to input string (default SI)
                                                                              ; IL: length of input string (default CX)
                                                                              ; TBL: pointer to data table
                                                                              ; output:
                                                                              ; Carry Flag: CF=1 (CY) if dot-heavy, CF=0 (NC) if dash-heavy
                                                                              MORSE_DD MACRO I, IL, TBL
                                                                              LOCAL LOOP_LETTER
                                                                              IFDIFI <I>,<SI> ; skip if S is already SI
                                                                              MOV SI, I ; load string into SI
                                                                              ENDIF
                                                                              IFDIFI <IL>,<CX> ; skip if IL is already CX
                                                                              MOV CX, IL ; set up loop counter
                                                                              ENDIF
                                                                              MOV BX, OFFSET TBL ; load score table into BX
                                                                              XOR DX, DX ; clear DX to hold total score
                                                                              LOOP_LETTER:
                                                                              LODSB ; load next char from DS:SI into AL, advance SI
                                                                              ;AND AL, 0DFH ; uppercase the input letter (+2 bytes)
                                                                              SUB AL, 'A' ; convert letter to zero-based index
                                                                              XLAT ; lookup letter in table
                                                                              MOV AH, AL ; examine dot nibble
                                                                              AND AH, 0FH ; mask off dash nibble
                                                                              ADD DH, AH ; add letter dot count to total
                                                                              PUSH CX ; save loop counter (since SHR can only take CL)
                                                                              MOV CL, 4 ; set up right shift for 4 bits
                                                                              SHR AL, CL ; shift right
                                                                              POP CX ; restore loop counter
                                                                              ADD DL, AL ; add letter dash count to total
                                                                              LOOP LOOP_LETTER
                                                                              CMP DL, DH ; if dot-heavy CF=1, if dash-heavy CF=0
                                                                              ENDM

                                                                              ; data table A-Z: MSN = count of dash, LSN = count of dot
                                                                              TBL DB 011H, 013H, 022H, 012H, 001H, 013H, 021H, 004H, 002H
                                                                              DB 031H, 021H, 013H, 020H, 011H, 030H, 022H, 031H, 012H
                                                                              DB 003H, 010H, 012H, 013H, 021H, 022H, 031H, 022H


                                                                              Explanation



                                                                              Implemented in Intel/MASM syntax as a MACRO (basically a function), using only 8088 compatible instructions. Input as string, output Truthy/Falsy result in Carry Flag. Score table contains the number of dashes and dots per letter.



                                                                              Input is upper case. Add 2 bytes to take lower or mixed case.



                                                                              Example Test Program (as IBM PC DOS standalone COM executable)



                                                                                  SHR  SI, 1              ; point SI to DOS PSP
                                                                              LODSW ; load arg length into AL, advance SI to 82H
                                                                              MOV CL, AL ; set up loop counter in CH
                                                                              DEC CX ; remove leading space from letter count

                                                                              MORSE_DD SI, CX, TBL ; execute above function, result is in CF

                                                                              MOV DX, OFFSET F ; default output to "Falsy" string
                                                                              JA DISP_OUT ; if CF=0, result is falsy, skip to output
                                                                              MOV DX, OFFSET T ; otherwise CF=1, set output to "Truthy" string
                                                                              DISP_OUT:
                                                                              MOV AH, 09H ; DOS API display string function
                                                                              INT 21H
                                                                              RET

                                                                              T DB "Truthy$"
                                                                              F DB "Falsy$"


                                                                              Example Output:



                                                                              enter image description here



                                                                              Download test program DD.COM



                                                                              Or Try it Online!
                                                                              I'm not aware of an online TIO to direct link to a DOS executable, however you can use this with just a few steps:




                                                                              1. Download DD.COM as a ZIP file

                                                                              2. Go to https://virtualconsoles.com/online-emulators/DOS/

                                                                              3. Upload the ZIP file you just downloaded, click Start

                                                                              4. Type DD Hello or DD code to your heart's content







                                                                              share|improve this answer














                                                                              share|improve this answer



                                                                              share|improve this answer








                                                                              edited 1 hour ago

























                                                                              answered 3 hours ago









                                                                              gwaughgwaugh

                                                                              1,515515




                                                                              1,515515























                                                                                  0












                                                                                  $begingroup$


                                                                                  JavaScript (Node.js),  69  68 bytes



                                                                                  Expects the input string in uppercase. Returns $0$ or $1$.





                                                                                  s=>Buffer(s).map(n=>s+='30314624523133534452741251'[n%26]-3,s=0)|s>0


                                                                                  Try it online!






                                                                                  share|improve this answer











                                                                                  $endgroup$


















                                                                                    0












                                                                                    $begingroup$


                                                                                    JavaScript (Node.js),  69  68 bytes



                                                                                    Expects the input string in uppercase. Returns $0$ or $1$.





                                                                                    s=>Buffer(s).map(n=>s+='30314624523133534452741251'[n%26]-3,s=0)|s>0


                                                                                    Try it online!






                                                                                    share|improve this answer











                                                                                    $endgroup$
















                                                                                      0












                                                                                      0








                                                                                      0





                                                                                      $begingroup$


                                                                                      JavaScript (Node.js),  69  68 bytes



                                                                                      Expects the input string in uppercase. Returns $0$ or $1$.





                                                                                      s=>Buffer(s).map(n=>s+='30314624523133534452741251'[n%26]-3,s=0)|s>0


                                                                                      Try it online!






                                                                                      share|improve this answer











                                                                                      $endgroup$




                                                                                      JavaScript (Node.js),  69  68 bytes



                                                                                      Expects the input string in uppercase. Returns $0$ or $1$.





                                                                                      s=>Buffer(s).map(n=>s+='30314624523133534452741251'[n%26]-3,s=0)|s>0


                                                                                      Try it online!







                                                                                      share|improve this answer














                                                                                      share|improve this answer



                                                                                      share|improve this answer








                                                                                      edited 6 hours ago

























                                                                                      answered 7 hours ago









                                                                                      ArnauldArnauld

                                                                                      78.4k795327




                                                                                      78.4k795327























                                                                                          0












                                                                                          $begingroup$


                                                                                          Python 2, 73 bytes





                                                                                          lambda s:sum(int('035344527512513031462452313'[ord(c)%32])-3for c in s)>0


                                                                                          Try it online!






                                                                                          share|improve this answer











                                                                                          $endgroup$













                                                                                          • $begingroup$
                                                                                            Change '035344527512513031462452313'[ord(c)%32] to `0x1d3c7eacfc7218bfeffc59`[ord(c)-65] for 70 bytes.
                                                                                            $endgroup$
                                                                                            – Erik the Outgolfer
                                                                                            5 hours ago


















                                                                                          0












                                                                                          $begingroup$


                                                                                          Python 2, 73 bytes





                                                                                          lambda s:sum(int('035344527512513031462452313'[ord(c)%32])-3for c in s)>0


                                                                                          Try it online!






                                                                                          share|improve this answer











                                                                                          $endgroup$













                                                                                          • $begingroup$
                                                                                            Change '035344527512513031462452313'[ord(c)%32] to `0x1d3c7eacfc7218bfeffc59`[ord(c)-65] for 70 bytes.
                                                                                            $endgroup$
                                                                                            – Erik the Outgolfer
                                                                                            5 hours ago
















                                                                                          0












                                                                                          0








                                                                                          0





                                                                                          $begingroup$


                                                                                          Python 2, 73 bytes





                                                                                          lambda s:sum(int('035344527512513031462452313'[ord(c)%32])-3for c in s)>0


                                                                                          Try it online!






                                                                                          share|improve this answer











                                                                                          $endgroup$




                                                                                          Python 2, 73 bytes





                                                                                          lambda s:sum(int('035344527512513031462452313'[ord(c)%32])-3for c in s)>0


                                                                                          Try it online!







                                                                                          share|improve this answer














                                                                                          share|improve this answer



                                                                                          share|improve this answer








                                                                                          edited 5 hours ago

























                                                                                          answered 5 hours ago









                                                                                          TFeldTFeld

                                                                                          15.7k21248




                                                                                          15.7k21248












                                                                                          • $begingroup$
                                                                                            Change '035344527512513031462452313'[ord(c)%32] to `0x1d3c7eacfc7218bfeffc59`[ord(c)-65] for 70 bytes.
                                                                                            $endgroup$
                                                                                            – Erik the Outgolfer
                                                                                            5 hours ago




















                                                                                          • $begingroup$
                                                                                            Change '035344527512513031462452313'[ord(c)%32] to `0x1d3c7eacfc7218bfeffc59`[ord(c)-65] for 70 bytes.
                                                                                            $endgroup$
                                                                                            – Erik the Outgolfer
                                                                                            5 hours ago


















                                                                                          $begingroup$
                                                                                          Change '035344527512513031462452313'[ord(c)%32] to `0x1d3c7eacfc7218bfeffc59`[ord(c)-65] for 70 bytes.
                                                                                          $endgroup$
                                                                                          – Erik the Outgolfer
                                                                                          5 hours ago






                                                                                          $begingroup$
                                                                                          Change '035344527512513031462452313'[ord(c)%32] to `0x1d3c7eacfc7218bfeffc59`[ord(c)-65] for 70 bytes.
                                                                                          $endgroup$
                                                                                          – Erik the Outgolfer
                                                                                          5 hours ago













                                                                                          0












                                                                                          $begingroup$


                                                                                          Perl 5 -pF, 53 bytes





                                                                                          $p+=y/a-z/35344526512513031462452313/r-3for@F;$_=$p>0


                                                                                          Try it online!






                                                                                          share|improve this answer









                                                                                          $endgroup$


















                                                                                            0












                                                                                            $begingroup$


                                                                                            Perl 5 -pF, 53 bytes





                                                                                            $p+=y/a-z/35344526512513031462452313/r-3for@F;$_=$p>0


                                                                                            Try it online!






                                                                                            share|improve this answer









                                                                                            $endgroup$
















                                                                                              0












                                                                                              0








                                                                                              0





                                                                                              $begingroup$


                                                                                              Perl 5 -pF, 53 bytes





                                                                                              $p+=y/a-z/35344526512513031462452313/r-3for@F;$_=$p>0


                                                                                              Try it online!






                                                                                              share|improve this answer









                                                                                              $endgroup$




                                                                                              Perl 5 -pF, 53 bytes





                                                                                              $p+=y/a-z/35344526512513031462452313/r-3for@F;$_=$p>0


                                                                                              Try it online!







                                                                                              share|improve this answer












                                                                                              share|improve this answer



                                                                                              share|improve this answer










                                                                                              answered 4 hours ago









                                                                                              XcaliXcali

                                                                                              5,435520




                                                                                              5,435520























                                                                                                  0












                                                                                                  $begingroup$


                                                                                                  C# (Visual C# Interactive Compiler), 49 bytes





                                                                                                  n=>n.Sum(c=>""[c-65]-4)


                                                                                                  Contains a lot of unprintables. Returns a positive integer for dot-heavy, and negative for dash-heavy.



                                                                                                  Try it online!






                                                                                                  share|improve this answer











                                                                                                  $endgroup$


















                                                                                                    0












                                                                                                    $begingroup$


                                                                                                    C# (Visual C# Interactive Compiler), 49 bytes





                                                                                                    n=>n.Sum(c=>""[c-65]-4)


                                                                                                    Contains a lot of unprintables. Returns a positive integer for dot-heavy, and negative for dash-heavy.



                                                                                                    Try it online!






                                                                                                    share|improve this answer











                                                                                                    $endgroup$
















                                                                                                      0












                                                                                                      0








                                                                                                      0





                                                                                                      $begingroup$


                                                                                                      C# (Visual C# Interactive Compiler), 49 bytes





                                                                                                      n=>n.Sum(c=>""[c-65]-4)


                                                                                                      Contains a lot of unprintables. Returns a positive integer for dot-heavy, and negative for dash-heavy.



                                                                                                      Try it online!






                                                                                                      share|improve this answer











                                                                                                      $endgroup$




                                                                                                      C# (Visual C# Interactive Compiler), 49 bytes





                                                                                                      n=>n.Sum(c=>""[c-65]-4)


                                                                                                      Contains a lot of unprintables. Returns a positive integer for dot-heavy, and negative for dash-heavy.



                                                                                                      Try it online!







                                                                                                      share|improve this answer














                                                                                                      share|improve this answer



                                                                                                      share|improve this answer








                                                                                                      edited 2 hours ago

























                                                                                                      answered 3 hours ago









                                                                                                      Embodiment of IgnoranceEmbodiment of Ignorance

                                                                                                      1,578124




                                                                                                      1,578124























                                                                                                          0












                                                                                                          $begingroup$

                                                                                                          C++ (compiled with Visual Studio 2017) 171bytes



                                                                                                          int f(string i){const char*c="1322131421130102123023121211210120032121323101112232";int j=0,h[2]={0};while(j<sizeof(i)/28)*h+=c[i[j]-97],h[1]+=c[i[j++]-71];return*h>h[1];}


                                                                                                          if we take the main program that exists for test purposes into account as well its more.



                                                                                                          this is the ungolfed "tidy" variant



                                                                                                          #include "stdafx.h"
                                                                                                          int main()
                                                                                                          {
                                                                                                          const int dotCount = {1,3,2,22,1,3,1,4,2,1,1,3,0,1,0,2,1,2,3,0,2,3,1,2,1,2};
                                                                                                          const int dashCount = {1,1,2,1,0,1,2,0,0,3,2,1,2,1,3,2,3,1,0,1,1,1,2,2,3,2};
                                                                                                          std::cout << "Enter String:n";
                                                                                                          std::string input;
                                                                                                          std::cin >> input;
                                                                                                          int inputsHeavyness[2] = { 0 };
                                                                                                          for(int i = 0;i < sizeof(input)/sizeof(std::string);i++)
                                                                                                          {
                                                                                                          inputsHeavyness[0] += dotCount[input[i] - 'a'];
                                                                                                          inputsHeavyness[1] += dashCount[input[i] - 'a'];
                                                                                                          }
                                                                                                          if (inputsHeavyness[0] > inputsHeavyness[1])
                                                                                                          {
                                                                                                          std::cout << "Dot Heavyn";
                                                                                                          }
                                                                                                          else
                                                                                                          {
                                                                                                          std::cout << "Dash Heavy or Neutraln";
                                                                                                          }
                                                                                                          return 0;
                                                                                                          }





                                                                                                          share|improve this answer









                                                                                                          $endgroup$


















                                                                                                            0












                                                                                                            $begingroup$

                                                                                                            C++ (compiled with Visual Studio 2017) 171bytes



                                                                                                            int f(string i){const char*c="1322131421130102123023121211210120032121323101112232";int j=0,h[2]={0};while(j<sizeof(i)/28)*h+=c[i[j]-97],h[1]+=c[i[j++]-71];return*h>h[1];}


                                                                                                            if we take the main program that exists for test purposes into account as well its more.



                                                                                                            this is the ungolfed "tidy" variant



                                                                                                            #include "stdafx.h"
                                                                                                            int main()
                                                                                                            {
                                                                                                            const int dotCount = {1,3,2,22,1,3,1,4,2,1,1,3,0,1,0,2,1,2,3,0,2,3,1,2,1,2};
                                                                                                            const int dashCount = {1,1,2,1,0,1,2,0,0,3,2,1,2,1,3,2,3,1,0,1,1,1,2,2,3,2};
                                                                                                            std::cout << "Enter String:n";
                                                                                                            std::string input;
                                                                                                            std::cin >> input;
                                                                                                            int inputsHeavyness[2] = { 0 };
                                                                                                            for(int i = 0;i < sizeof(input)/sizeof(std::string);i++)
                                                                                                            {
                                                                                                            inputsHeavyness[0] += dotCount[input[i] - 'a'];
                                                                                                            inputsHeavyness[1] += dashCount[input[i] - 'a'];
                                                                                                            }
                                                                                                            if (inputsHeavyness[0] > inputsHeavyness[1])
                                                                                                            {
                                                                                                            std::cout << "Dot Heavyn";
                                                                                                            }
                                                                                                            else
                                                                                                            {
                                                                                                            std::cout << "Dash Heavy or Neutraln";
                                                                                                            }
                                                                                                            return 0;
                                                                                                            }





                                                                                                            share|improve this answer









                                                                                                            $endgroup$
















                                                                                                              0












                                                                                                              0








                                                                                                              0





                                                                                                              $begingroup$

                                                                                                              C++ (compiled with Visual Studio 2017) 171bytes



                                                                                                              int f(string i){const char*c="1322131421130102123023121211210120032121323101112232";int j=0,h[2]={0};while(j<sizeof(i)/28)*h+=c[i[j]-97],h[1]+=c[i[j++]-71];return*h>h[1];}


                                                                                                              if we take the main program that exists for test purposes into account as well its more.



                                                                                                              this is the ungolfed "tidy" variant



                                                                                                              #include "stdafx.h"
                                                                                                              int main()
                                                                                                              {
                                                                                                              const int dotCount = {1,3,2,22,1,3,1,4,2,1,1,3,0,1,0,2,1,2,3,0,2,3,1,2,1,2};
                                                                                                              const int dashCount = {1,1,2,1,0,1,2,0,0,3,2,1,2,1,3,2,3,1,0,1,1,1,2,2,3,2};
                                                                                                              std::cout << "Enter String:n";
                                                                                                              std::string input;
                                                                                                              std::cin >> input;
                                                                                                              int inputsHeavyness[2] = { 0 };
                                                                                                              for(int i = 0;i < sizeof(input)/sizeof(std::string);i++)
                                                                                                              {
                                                                                                              inputsHeavyness[0] += dotCount[input[i] - 'a'];
                                                                                                              inputsHeavyness[1] += dashCount[input[i] - 'a'];
                                                                                                              }
                                                                                                              if (inputsHeavyness[0] > inputsHeavyness[1])
                                                                                                              {
                                                                                                              std::cout << "Dot Heavyn";
                                                                                                              }
                                                                                                              else
                                                                                                              {
                                                                                                              std::cout << "Dash Heavy or Neutraln";
                                                                                                              }
                                                                                                              return 0;
                                                                                                              }





                                                                                                              share|improve this answer









                                                                                                              $endgroup$



                                                                                                              C++ (compiled with Visual Studio 2017) 171bytes



                                                                                                              int f(string i){const char*c="1322131421130102123023121211210120032121323101112232";int j=0,h[2]={0};while(j<sizeof(i)/28)*h+=c[i[j]-97],h[1]+=c[i[j++]-71];return*h>h[1];}


                                                                                                              if we take the main program that exists for test purposes into account as well its more.



                                                                                                              this is the ungolfed "tidy" variant



                                                                                                              #include "stdafx.h"
                                                                                                              int main()
                                                                                                              {
                                                                                                              const int dotCount = {1,3,2,22,1,3,1,4,2,1,1,3,0,1,0,2,1,2,3,0,2,3,1,2,1,2};
                                                                                                              const int dashCount = {1,1,2,1,0,1,2,0,0,3,2,1,2,1,3,2,3,1,0,1,1,1,2,2,3,2};
                                                                                                              std::cout << "Enter String:n";
                                                                                                              std::string input;
                                                                                                              std::cin >> input;
                                                                                                              int inputsHeavyness[2] = { 0 };
                                                                                                              for(int i = 0;i < sizeof(input)/sizeof(std::string);i++)
                                                                                                              {
                                                                                                              inputsHeavyness[0] += dotCount[input[i] - 'a'];
                                                                                                              inputsHeavyness[1] += dashCount[input[i] - 'a'];
                                                                                                              }
                                                                                                              if (inputsHeavyness[0] > inputsHeavyness[1])
                                                                                                              {
                                                                                                              std::cout << "Dot Heavyn";
                                                                                                              }
                                                                                                              else
                                                                                                              {
                                                                                                              std::cout << "Dash Heavy or Neutraln";
                                                                                                              }
                                                                                                              return 0;
                                                                                                              }






                                                                                                              share|improve this answer












                                                                                                              share|improve this answer



                                                                                                              share|improve this answer










                                                                                                              answered 1 hour ago









                                                                                                              der benderder bender

                                                                                                              111




                                                                                                              111























                                                                                                                  0












                                                                                                                  $begingroup$


                                                                                                                  Stax, 20 bytes



                                                                                                                  ÉBÜ◙ƒ╣<Hf6─òɼsäS╗◄↔


                                                                                                                  Run and debug it



                                                                                                                  Unpacked, ungolfed, and commented, it looks like this.



                                                                                                                  "45D.J57KBJa`"I"    string literal with code points [52 53 68 46 74 53 55 75 66 74 97 34 73]
                                                                                                                  $ flatten to string "52536846745355756674973473"
                                                                                                                  ; push input
                                                                                                                  @ get string characters at indices
                                                                                                                  (using input codepoints as indices; lookups wrap around)
                                                                                                                  :V arithmetic mean
                                                                                                                  53> is greater than 53


                                                                                                                  Run this one






                                                                                                                  share|improve this answer









                                                                                                                  $endgroup$


















                                                                                                                    0












                                                                                                                    $begingroup$


                                                                                                                    Stax, 20 bytes



                                                                                                                    ÉBÜ◙ƒ╣<Hf6─òɼsäS╗◄↔


                                                                                                                    Run and debug it



                                                                                                                    Unpacked, ungolfed, and commented, it looks like this.



                                                                                                                    "45D.J57KBJa`"I"    string literal with code points [52 53 68 46 74 53 55 75 66 74 97 34 73]
                                                                                                                    $ flatten to string "52536846745355756674973473"
                                                                                                                    ; push input
                                                                                                                    @ get string characters at indices
                                                                                                                    (using input codepoints as indices; lookups wrap around)
                                                                                                                    :V arithmetic mean
                                                                                                                    53> is greater than 53


                                                                                                                    Run this one






                                                                                                                    share|improve this answer









                                                                                                                    $endgroup$
















                                                                                                                      0












                                                                                                                      0








                                                                                                                      0





                                                                                                                      $begingroup$


                                                                                                                      Stax, 20 bytes



                                                                                                                      ÉBÜ◙ƒ╣<Hf6─òɼsäS╗◄↔


                                                                                                                      Run and debug it



                                                                                                                      Unpacked, ungolfed, and commented, it looks like this.



                                                                                                                      "45D.J57KBJa`"I"    string literal with code points [52 53 68 46 74 53 55 75 66 74 97 34 73]
                                                                                                                      $ flatten to string "52536846745355756674973473"
                                                                                                                      ; push input
                                                                                                                      @ get string characters at indices
                                                                                                                      (using input codepoints as indices; lookups wrap around)
                                                                                                                      :V arithmetic mean
                                                                                                                      53> is greater than 53


                                                                                                                      Run this one






                                                                                                                      share|improve this answer









                                                                                                                      $endgroup$




                                                                                                                      Stax, 20 bytes



                                                                                                                      ÉBÜ◙ƒ╣<Hf6─òɼsäS╗◄↔


                                                                                                                      Run and debug it



                                                                                                                      Unpacked, ungolfed, and commented, it looks like this.



                                                                                                                      "45D.J57KBJa`"I"    string literal with code points [52 53 68 46 74 53 55 75 66 74 97 34 73]
                                                                                                                      $ flatten to string "52536846745355756674973473"
                                                                                                                      ; push input
                                                                                                                      @ get string characters at indices
                                                                                                                      (using input codepoints as indices; lookups wrap around)
                                                                                                                      :V arithmetic mean
                                                                                                                      53> is greater than 53


                                                                                                                      Run this one







                                                                                                                      share|improve this answer












                                                                                                                      share|improve this answer



                                                                                                                      share|improve this answer










                                                                                                                      answered 45 mins ago









                                                                                                                      recursiverecursive

                                                                                                                      5,4491322




                                                                                                                      5,4491322






























                                                                                                                          draft saved

                                                                                                                          draft discarded




















































                                                                                                                          If this is an answer to a challenge…




                                                                                                                          • …Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.


                                                                                                                          • …Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
                                                                                                                            Explanations of your answer make it more interesting to read and are very much encouraged.


                                                                                                                          • …Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.



                                                                                                                          More generally…




                                                                                                                          • …Please make sure to answer the question and provide sufficient detail.


                                                                                                                          • …Avoid asking for help, clarification or responding to other answers (use comments instead).





                                                                                                                          draft saved


                                                                                                                          draft discarded














                                                                                                                          StackExchange.ready(
                                                                                                                          function () {
                                                                                                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f181318%2fthey-call-me-inspector-morse%23new-answer', 'question_page');
                                                                                                                          }
                                                                                                                          );

                                                                                                                          Post as a guest















                                                                                                                          Required, but never shown





















































                                                                                                                          Required, but never shown














                                                                                                                          Required, but never shown












                                                                                                                          Required, but never shown







                                                                                                                          Required, but never shown

































                                                                                                                          Required, but never shown














                                                                                                                          Required, but never shown












                                                                                                                          Required, but never shown







                                                                                                                          Required, but never shown







                                                                                                                          Popular posts from this blog

                                                                                                                          Paul Cézanne

                                                                                                                          UIScrollView CustomStickyHeader Resize height generates problems when scroll is too fast

                                                                                                                          Angular material date-picker (MatDatepicker) auto completes the date on focus out