How frustrating is my movie?












24














My parents have an home theater device. The remote is broken making it incredibly difficult to navigate rightwards in a menu. Most the time it doesn't work but when it does it moves rightwards incredibly quickly.



This is obviously frustrating but it is most frustrating when you want to enter a movie title which requires navigating a keyboard that looks like this:



a b c d e f
g h i j k l
m n o p q r
s t u v w x
y z 1 2 3 4
5 6 7 8 9 0


Your task is to take as input a movie title and calculate how "frustrating" it is to type that movie title. The frustration number of a particular string is the number of letters that require moving right from the letter before them. We don't care how far right they are, since if we start moving right we pretty much instantly go to the end of the line, and we don't care about up, down or leftwards movement because they are easy.



For example if we wanted to type in



keyboard



  • We start at k for free.


  • e is just above k so we don't need to move right.


  • y is all the way left so no need to move right.


  • b however is on the next column rightwards so we need to move right to get to it.


  • o is on the next column over so we have to move rightwards to get to it.


  • a is back in the first column so we move left to get to it.


  • r is all the way on the right so we move right to it.


  • d is two columns to the left of r's column.


The characters that need to move to the right are bor meaning that this is frustration 3.



Additional rules



This is a code-golf challenge so your answers will be scored in bytes with fewer bytes being better. The input will always consist of alphanumeric characters, you can support either capital or lowercase letters and you only need to support one. The input will never be empty.



Testcases



keyboard -> 3
2001aspaceodyssey -> 6
sorrytobotheryou -> 8
thinblueline -> 5
blast2 -> 3









share|improve this question




















  • 2




    Suggested test case: "blast2" -> 3 (not a real movie, but some answers have problems with such test cases)
    – Arnauld
    Nov 24 at 17:37










  • Suggested test case: one consisting of only digits, such as 5 -> 0
    – lirtosiast
    Nov 24 at 18:01








  • 1




    Suggested test case: 90 -> 1
    – nwellnhof
    Nov 24 at 20:46












  • Can we assume the input string will be non-empty?
    – Chas Brown
    Nov 25 at 4:06










  • @ChasBrown That is covered in the question.
    – Wît Wisarhd
    Nov 25 at 4:17
















24














My parents have an home theater device. The remote is broken making it incredibly difficult to navigate rightwards in a menu. Most the time it doesn't work but when it does it moves rightwards incredibly quickly.



This is obviously frustrating but it is most frustrating when you want to enter a movie title which requires navigating a keyboard that looks like this:



a b c d e f
g h i j k l
m n o p q r
s t u v w x
y z 1 2 3 4
5 6 7 8 9 0


Your task is to take as input a movie title and calculate how "frustrating" it is to type that movie title. The frustration number of a particular string is the number of letters that require moving right from the letter before them. We don't care how far right they are, since if we start moving right we pretty much instantly go to the end of the line, and we don't care about up, down or leftwards movement because they are easy.



For example if we wanted to type in



keyboard



  • We start at k for free.


  • e is just above k so we don't need to move right.


  • y is all the way left so no need to move right.


  • b however is on the next column rightwards so we need to move right to get to it.


  • o is on the next column over so we have to move rightwards to get to it.


  • a is back in the first column so we move left to get to it.


  • r is all the way on the right so we move right to it.


  • d is two columns to the left of r's column.


The characters that need to move to the right are bor meaning that this is frustration 3.



Additional rules



This is a code-golf challenge so your answers will be scored in bytes with fewer bytes being better. The input will always consist of alphanumeric characters, you can support either capital or lowercase letters and you only need to support one. The input will never be empty.



Testcases



keyboard -> 3
2001aspaceodyssey -> 6
sorrytobotheryou -> 8
thinblueline -> 5
blast2 -> 3









share|improve this question




















  • 2




    Suggested test case: "blast2" -> 3 (not a real movie, but some answers have problems with such test cases)
    – Arnauld
    Nov 24 at 17:37










  • Suggested test case: one consisting of only digits, such as 5 -> 0
    – lirtosiast
    Nov 24 at 18:01








  • 1




    Suggested test case: 90 -> 1
    – nwellnhof
    Nov 24 at 20:46












  • Can we assume the input string will be non-empty?
    – Chas Brown
    Nov 25 at 4:06










  • @ChasBrown That is covered in the question.
    – Wît Wisarhd
    Nov 25 at 4:17














24












24








24


1





My parents have an home theater device. The remote is broken making it incredibly difficult to navigate rightwards in a menu. Most the time it doesn't work but when it does it moves rightwards incredibly quickly.



This is obviously frustrating but it is most frustrating when you want to enter a movie title which requires navigating a keyboard that looks like this:



a b c d e f
g h i j k l
m n o p q r
s t u v w x
y z 1 2 3 4
5 6 7 8 9 0


Your task is to take as input a movie title and calculate how "frustrating" it is to type that movie title. The frustration number of a particular string is the number of letters that require moving right from the letter before them. We don't care how far right they are, since if we start moving right we pretty much instantly go to the end of the line, and we don't care about up, down or leftwards movement because they are easy.



For example if we wanted to type in



keyboard



  • We start at k for free.


  • e is just above k so we don't need to move right.


  • y is all the way left so no need to move right.


  • b however is on the next column rightwards so we need to move right to get to it.


  • o is on the next column over so we have to move rightwards to get to it.


  • a is back in the first column so we move left to get to it.


  • r is all the way on the right so we move right to it.


  • d is two columns to the left of r's column.


The characters that need to move to the right are bor meaning that this is frustration 3.



Additional rules



This is a code-golf challenge so your answers will be scored in bytes with fewer bytes being better. The input will always consist of alphanumeric characters, you can support either capital or lowercase letters and you only need to support one. The input will never be empty.



Testcases



keyboard -> 3
2001aspaceodyssey -> 6
sorrytobotheryou -> 8
thinblueline -> 5
blast2 -> 3









share|improve this question















My parents have an home theater device. The remote is broken making it incredibly difficult to navigate rightwards in a menu. Most the time it doesn't work but when it does it moves rightwards incredibly quickly.



This is obviously frustrating but it is most frustrating when you want to enter a movie title which requires navigating a keyboard that looks like this:



a b c d e f
g h i j k l
m n o p q r
s t u v w x
y z 1 2 3 4
5 6 7 8 9 0


Your task is to take as input a movie title and calculate how "frustrating" it is to type that movie title. The frustration number of a particular string is the number of letters that require moving right from the letter before them. We don't care how far right they are, since if we start moving right we pretty much instantly go to the end of the line, and we don't care about up, down or leftwards movement because they are easy.



For example if we wanted to type in



keyboard



  • We start at k for free.


  • e is just above k so we don't need to move right.


  • y is all the way left so no need to move right.


  • b however is on the next column rightwards so we need to move right to get to it.


  • o is on the next column over so we have to move rightwards to get to it.


  • a is back in the first column so we move left to get to it.


  • r is all the way on the right so we move right to it.


  • d is two columns to the left of r's column.


The characters that need to move to the right are bor meaning that this is frustration 3.



Additional rules



This is a code-golf challenge so your answers will be scored in bytes with fewer bytes being better. The input will always consist of alphanumeric characters, you can support either capital or lowercase letters and you only need to support one. The input will never be empty.



Testcases



keyboard -> 3
2001aspaceodyssey -> 6
sorrytobotheryou -> 8
thinblueline -> 5
blast2 -> 3






code-golf string






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 24 at 17:38

























asked Nov 24 at 16:30









Wît Wisarhd

34k10156365




34k10156365








  • 2




    Suggested test case: "blast2" -> 3 (not a real movie, but some answers have problems with such test cases)
    – Arnauld
    Nov 24 at 17:37










  • Suggested test case: one consisting of only digits, such as 5 -> 0
    – lirtosiast
    Nov 24 at 18:01








  • 1




    Suggested test case: 90 -> 1
    – nwellnhof
    Nov 24 at 20:46












  • Can we assume the input string will be non-empty?
    – Chas Brown
    Nov 25 at 4:06










  • @ChasBrown That is covered in the question.
    – Wît Wisarhd
    Nov 25 at 4:17














  • 2




    Suggested test case: "blast2" -> 3 (not a real movie, but some answers have problems with such test cases)
    – Arnauld
    Nov 24 at 17:37










  • Suggested test case: one consisting of only digits, such as 5 -> 0
    – lirtosiast
    Nov 24 at 18:01








  • 1




    Suggested test case: 90 -> 1
    – nwellnhof
    Nov 24 at 20:46












  • Can we assume the input string will be non-empty?
    – Chas Brown
    Nov 25 at 4:06










  • @ChasBrown That is covered in the question.
    – Wît Wisarhd
    Nov 25 at 4:17








2




2




Suggested test case: "blast2" -> 3 (not a real movie, but some answers have problems with such test cases)
– Arnauld
Nov 24 at 17:37




Suggested test case: "blast2" -> 3 (not a real movie, but some answers have problems with such test cases)
– Arnauld
Nov 24 at 17:37












Suggested test case: one consisting of only digits, such as 5 -> 0
– lirtosiast
Nov 24 at 18:01






Suggested test case: one consisting of only digits, such as 5 -> 0
– lirtosiast
Nov 24 at 18:01






1




1




Suggested test case: 90 -> 1
– nwellnhof
Nov 24 at 20:46






Suggested test case: 90 -> 1
– nwellnhof
Nov 24 at 20:46














Can we assume the input string will be non-empty?
– Chas Brown
Nov 25 at 4:06




Can we assume the input string will be non-empty?
– Chas Brown
Nov 25 at 4:06












@ChasBrown That is covered in the question.
– Wît Wisarhd
Nov 25 at 4:17




@ChasBrown That is covered in the question.
– Wît Wisarhd
Nov 25 at 4:17










14 Answers
14






active

oldest

votes


















8















JavaScript (Node.js), 61 55 54 bytes



Saved 1 byte thanks to @nwellnhof



Takes input as an array of characters.



s=>s.map(p=c=>r+=p>(p=(+c?~c:1-Buffer(c)[0])%6),r=0)|r


Try it online!



How?



For all characters but digits greater than $0$, the 0-indexed column $x$ is given by:



$$x=(c-1)bmod 6$$



where $c$ is the ASCII code of the character.



For positive digits $n$, we need to do instead:



$$x=(n+1)bmod 6$$



Examples:



"a" --> (97 - 1) mod 6 = 96 mod 6 = 0
"b" --> (98 - 1) mod 6 = 97 mod 6 = 1
"0" --> (48 - 1) mod 6 = 47 mod 6 = 5
"3" --> ( 3 + 1) mod 6 = 4 mod 6 = 4


Commented



s =>                       // s = input string (as array)
s.map(p = // initialize p to a non-numeric value
c => // for each character c in s:
r += // update the result r:
p > ( // compare p with
p = ( // the new value of p defined as:
+c ? // if c is a positive digit:
~c // -(int(c) + 1)
: // else:
1-Buffer(c)[0] // -(ord(c) - 1)
) % 6 // apply modulo 6
), // yields 1 if the previous value is greater than the new one
r = 0 // start with r = 0
) | r // end of map(); return r





share|improve this answer























  • It seems to work without the ternary for 46 bytes
    – Shaggy
    Nov 24 at 17:51






  • 1




    @Shaggy It won't. See my suggested test case "blast2".
    – Arnauld
    Nov 24 at 17:52










  • Ah. In that case: 53 bytes
    – Shaggy
    Nov 24 at 18:29






  • 1




    @Shaggy A bitwise OR would fail for, say, "234".
    – Arnauld
    Nov 24 at 18:33






  • 3




    Less whiskey is never the answer!
    – Shaggy
    Nov 24 at 18:58



















6















Jelly, 11 bytes



⁾04yO‘%6<ƝS


A monadic Link accepting a list of (uppercase) characters.



Try it online!



How?



First replaces any '0's with '4's (so the rest of the code treats them as being in the rightmost column). Then casts to ordinals, adds one and modulo's by 6 to get 0-based column indices. Then compares neighbours with is-less-than and sums the result.



⁾04yO‘%6<ƝS - Link: list of characters         e.g. "BLAST20"
⁾04 - list of characters = ['0', '4']
y - translate "BLAST24"
O - ordinals [66,76,65,83,84,50,52]
‘ - increment [67,77,66,84,85,51,53]
6 - literal six
% - modulo [ 1, 5, 0, 0, 1, 3, 5]
Ɲ - neighbourly:
< - less than? [ 1, 0, 0, 1, 1, 1 ]
S - sum 4





share|improve this answer























  • Oh my, this is art.
    – Erik the Outgolfer
    Nov 24 at 21:07



















3















Perl 6, 45 39 bytes





{sum .[1..*]Z<$_}o{(2 X-.ords)X%46 X%6}


Try it online!



Works with uppercase letters. (2-ord(c))%46%6 computes the reversed x coordinate.






share|improve this answer































    1















    K (ngn/k), 32 31 bytes



    +/>':(+6 6#,/"a10"+!'26 9 1)?0+


    Try it online!






    share|improve this answer































      1















      Clean, 85 bytes



      import StdEnv
      (s=sum[1\a<-s&b<-tl s|b>a])o map(e=(toInt e+if(e-'1'>'/')1 -1)rem 6)


      Try it online!






      share|improve this answer





























        1















        Ruby, 56 bytes





        ->s{w=9;s.count{|c|w<w=[*?a..?z,*?1..?9,?0].index(c)%6}}


        Try it online!



        Preliminary naive version, will be golfed.






        share|improve this answer





























          1















          Japt -x, 14 bytes



          ®rT4 c Ä u6Ãä<


          Try it online!



          Port of this Jelly answer. Takes input as an array of characters, with letters uppercase.



          Explanation:



          ®rT4 c Ä u6Ãä<    :
          ® Ã :Map each character through:
          rT4 : Replace 0 with 4
          c : Get the char-code
          Ä : Increment it
          u6 : Modulo 6
          ä< :Replace with 1 if you had to move right, 0 otherwise
          :Implicitly sum and output





          share|improve this answer































            1















            Java (OpenJDK 8), 73 bytes



            Not a bad solution for Java! That zero being on the right-hand side cost me several bytes.





            t->{int a=9,c=0;for(int d:t)c+=a<(a=(--d+(d/48==1?2:0))%6)?1:0;return c;}


            Try it online!



            Explained



            t -> {                          // Lambda taking a char array as input
            int a=9, // Initialise last column value
            c=0; // Initialise frustration count
            for(int d:t) // Loop through all chars in title
            c+= // increment the frustration count if...
            a< // The last column is smaller than the current column
            (a= // Set last column to current column
            (--d+ // Decrement ascii value of char
            (d/48==1 // If ascii decremented ascii value is between 48 and 95
            ?2:0) // increment by 2 (1 total) or 0 (-1 total)
            )%6) // Mod 6 to retrieve column index
            ?1:0; // Increment if to right hand side
            return c; // return calculated frustration count
            }





            share|improve this answer





























              1















              05AB1E, 12 11 bytes



              -1 byte thanks to @Kevin Cruijssen



              ¾4:Ç>6%¥1@O


              Another port of Jonathan Allan's Jelly answer. Takes input in uppercase.



              Explanation:



              ¾4:Ç>6%¥1@O   //full program
              ¾4: //replace all '0's with '4's
              Ç //get ASCII code points
              > //increment
              6% //modulo 6
              ¥ //get deltas
              1@ //is >= 1
              O //sum


              Try it online!






              share|improve this answer



















              • 1




                0'4 can be ¾4 to save a byte (relevant 05AB1E tip).
                – Kevin Cruijssen
                Nov 28 at 9:06





















              0















              Retina 0.8.2, 46 bytes



              T`l1-90`1-61-61-61-61-61-6
              .
              ;$&$*
              &`;(1+);11


              Try it online! Link includes test cases. Explanation:



              T`l1-90`1-61-61-61-61-61-6


              List the alphabet and digits in the order on the OSK and map each one to a (1-indexed) column number.



              .
              ;$&$*


              Convert each column number to unary.



              &`;(1+);11


              Count the number of columns that are followed by a larger (i.e. rightwards) column. The &` allows the matches to overlap.






              share|improve this answer





























                0















                Python 2, 84 bytes





                def f(s,k=6):j=(ord(s[0])+('0'<s[0]<':')*2-1)%6;return(j>k)+(~-len(s)and f(s[1:],j))


                Try it online!






                share|improve this answer































                  0














                  Mathematica, 102 bytes



                  Differences[Last@@Join[Alphabet,ToString/@Range@9,{"0"}]~Partition~6~Position~#&/@#]~Count~_?(#>0&)&


                  Pure function. Takes a list of characters as input and returns a number as output. This is a pretty naive solution, golfing suggestions welcome.






                  share|improve this answer





























                    0














                    PHP, 74 81 77 bytes



                    for(;$o=ord($argn[$i]);$i++&&$f+=$p<$x,$p=$x)$x=(--$o/48^1?$o:$o+2)%6;echo$f;


                    Run as pipe with -nR or try it online.






                    share|improve this answer































                      0















                      C (gcc),  82 79  77 bytes





                      o;c(i){i+=i<60&i>48?1:5;i%=6;}f(char*s){for(o=0;*++s;o+=c(*s)>c(s[-1]));o=o;}


                      Try it online!



                      This function will only support lowercase inputs





                      Ungolfed and commented:





                      o; //Used for output
                      c(i){ //Calculates the column of given character
                      i+= //Correct i to get the correct column
                      i<60 //If i is a digit...
                      & i>48 //... but not '0'
                      ?1 //Then move it one column on the right
                      :5; //Else move it five columns on the right
                      i%=6; //Get the column number
                      }
                      f(char*s){ // The actual "frustrating" function
                      for( //Loop for each character
                      o=0; //reinitialize output
                      *++s; //move to next character / while this is not ''
                      o+=c(*s)>c(s[-1]) //Increment if current character is on the right of the previous one
                      );
                      o=o; // Outputs result
                      }




                      If my function is allowed to accept wide character strings, it can be reduced to 76 bytes with:





                      o;c(i){i+=i<60&i>48?1:5;i%=6;}f(int*s){for(o=0;*++s;o+=c(*s)>c(s[-1]));o=o;}


                      Try it online!



                      This version just accept input as int* instead of char*





                      Edits:




                      • Golfed 3 bytes in the calculation of the column (function c)

                      • Golfed 2 bytes thanks to ceilingcat






                      share|improve this answer























                      • And there, 77 bytes
                        – Rogem
                        Nov 26 at 16:59











                      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%2f176492%2fhow-frustrating-is-my-movie%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown

























                      14 Answers
                      14






                      active

                      oldest

                      votes








                      14 Answers
                      14






                      active

                      oldest

                      votes









                      active

                      oldest

                      votes






                      active

                      oldest

                      votes









                      8















                      JavaScript (Node.js), 61 55 54 bytes



                      Saved 1 byte thanks to @nwellnhof



                      Takes input as an array of characters.



                      s=>s.map(p=c=>r+=p>(p=(+c?~c:1-Buffer(c)[0])%6),r=0)|r


                      Try it online!



                      How?



                      For all characters but digits greater than $0$, the 0-indexed column $x$ is given by:



                      $$x=(c-1)bmod 6$$



                      where $c$ is the ASCII code of the character.



                      For positive digits $n$, we need to do instead:



                      $$x=(n+1)bmod 6$$



                      Examples:



                      "a" --> (97 - 1) mod 6 = 96 mod 6 = 0
                      "b" --> (98 - 1) mod 6 = 97 mod 6 = 1
                      "0" --> (48 - 1) mod 6 = 47 mod 6 = 5
                      "3" --> ( 3 + 1) mod 6 = 4 mod 6 = 4


                      Commented



                      s =>                       // s = input string (as array)
                      s.map(p = // initialize p to a non-numeric value
                      c => // for each character c in s:
                      r += // update the result r:
                      p > ( // compare p with
                      p = ( // the new value of p defined as:
                      +c ? // if c is a positive digit:
                      ~c // -(int(c) + 1)
                      : // else:
                      1-Buffer(c)[0] // -(ord(c) - 1)
                      ) % 6 // apply modulo 6
                      ), // yields 1 if the previous value is greater than the new one
                      r = 0 // start with r = 0
                      ) | r // end of map(); return r





                      share|improve this answer























                      • It seems to work without the ternary for 46 bytes
                        – Shaggy
                        Nov 24 at 17:51






                      • 1




                        @Shaggy It won't. See my suggested test case "blast2".
                        – Arnauld
                        Nov 24 at 17:52










                      • Ah. In that case: 53 bytes
                        – Shaggy
                        Nov 24 at 18:29






                      • 1




                        @Shaggy A bitwise OR would fail for, say, "234".
                        – Arnauld
                        Nov 24 at 18:33






                      • 3




                        Less whiskey is never the answer!
                        – Shaggy
                        Nov 24 at 18:58
















                      8















                      JavaScript (Node.js), 61 55 54 bytes



                      Saved 1 byte thanks to @nwellnhof



                      Takes input as an array of characters.



                      s=>s.map(p=c=>r+=p>(p=(+c?~c:1-Buffer(c)[0])%6),r=0)|r


                      Try it online!



                      How?



                      For all characters but digits greater than $0$, the 0-indexed column $x$ is given by:



                      $$x=(c-1)bmod 6$$



                      where $c$ is the ASCII code of the character.



                      For positive digits $n$, we need to do instead:



                      $$x=(n+1)bmod 6$$



                      Examples:



                      "a" --> (97 - 1) mod 6 = 96 mod 6 = 0
                      "b" --> (98 - 1) mod 6 = 97 mod 6 = 1
                      "0" --> (48 - 1) mod 6 = 47 mod 6 = 5
                      "3" --> ( 3 + 1) mod 6 = 4 mod 6 = 4


                      Commented



                      s =>                       // s = input string (as array)
                      s.map(p = // initialize p to a non-numeric value
                      c => // for each character c in s:
                      r += // update the result r:
                      p > ( // compare p with
                      p = ( // the new value of p defined as:
                      +c ? // if c is a positive digit:
                      ~c // -(int(c) + 1)
                      : // else:
                      1-Buffer(c)[0] // -(ord(c) - 1)
                      ) % 6 // apply modulo 6
                      ), // yields 1 if the previous value is greater than the new one
                      r = 0 // start with r = 0
                      ) | r // end of map(); return r





                      share|improve this answer























                      • It seems to work without the ternary for 46 bytes
                        – Shaggy
                        Nov 24 at 17:51






                      • 1




                        @Shaggy It won't. See my suggested test case "blast2".
                        – Arnauld
                        Nov 24 at 17:52










                      • Ah. In that case: 53 bytes
                        – Shaggy
                        Nov 24 at 18:29






                      • 1




                        @Shaggy A bitwise OR would fail for, say, "234".
                        – Arnauld
                        Nov 24 at 18:33






                      • 3




                        Less whiskey is never the answer!
                        – Shaggy
                        Nov 24 at 18:58














                      8












                      8








                      8







                      JavaScript (Node.js), 61 55 54 bytes



                      Saved 1 byte thanks to @nwellnhof



                      Takes input as an array of characters.



                      s=>s.map(p=c=>r+=p>(p=(+c?~c:1-Buffer(c)[0])%6),r=0)|r


                      Try it online!



                      How?



                      For all characters but digits greater than $0$, the 0-indexed column $x$ is given by:



                      $$x=(c-1)bmod 6$$



                      where $c$ is the ASCII code of the character.



                      For positive digits $n$, we need to do instead:



                      $$x=(n+1)bmod 6$$



                      Examples:



                      "a" --> (97 - 1) mod 6 = 96 mod 6 = 0
                      "b" --> (98 - 1) mod 6 = 97 mod 6 = 1
                      "0" --> (48 - 1) mod 6 = 47 mod 6 = 5
                      "3" --> ( 3 + 1) mod 6 = 4 mod 6 = 4


                      Commented



                      s =>                       // s = input string (as array)
                      s.map(p = // initialize p to a non-numeric value
                      c => // for each character c in s:
                      r += // update the result r:
                      p > ( // compare p with
                      p = ( // the new value of p defined as:
                      +c ? // if c is a positive digit:
                      ~c // -(int(c) + 1)
                      : // else:
                      1-Buffer(c)[0] // -(ord(c) - 1)
                      ) % 6 // apply modulo 6
                      ), // yields 1 if the previous value is greater than the new one
                      r = 0 // start with r = 0
                      ) | r // end of map(); return r





                      share|improve this answer















                      JavaScript (Node.js), 61 55 54 bytes



                      Saved 1 byte thanks to @nwellnhof



                      Takes input as an array of characters.



                      s=>s.map(p=c=>r+=p>(p=(+c?~c:1-Buffer(c)[0])%6),r=0)|r


                      Try it online!



                      How?



                      For all characters but digits greater than $0$, the 0-indexed column $x$ is given by:



                      $$x=(c-1)bmod 6$$



                      where $c$ is the ASCII code of the character.



                      For positive digits $n$, we need to do instead:



                      $$x=(n+1)bmod 6$$



                      Examples:



                      "a" --> (97 - 1) mod 6 = 96 mod 6 = 0
                      "b" --> (98 - 1) mod 6 = 97 mod 6 = 1
                      "0" --> (48 - 1) mod 6 = 47 mod 6 = 5
                      "3" --> ( 3 + 1) mod 6 = 4 mod 6 = 4


                      Commented



                      s =>                       // s = input string (as array)
                      s.map(p = // initialize p to a non-numeric value
                      c => // for each character c in s:
                      r += // update the result r:
                      p > ( // compare p with
                      p = ( // the new value of p defined as:
                      +c ? // if c is a positive digit:
                      ~c // -(int(c) + 1)
                      : // else:
                      1-Buffer(c)[0] // -(ord(c) - 1)
                      ) % 6 // apply modulo 6
                      ), // yields 1 if the previous value is greater than the new one
                      r = 0 // start with r = 0
                      ) | r // end of map(); return r






                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Nov 24 at 20:55

























                      answered Nov 24 at 16:47









                      Arnauld

                      72.4k689304




                      72.4k689304












                      • It seems to work without the ternary for 46 bytes
                        – Shaggy
                        Nov 24 at 17:51






                      • 1




                        @Shaggy It won't. See my suggested test case "blast2".
                        – Arnauld
                        Nov 24 at 17:52










                      • Ah. In that case: 53 bytes
                        – Shaggy
                        Nov 24 at 18:29






                      • 1




                        @Shaggy A bitwise OR would fail for, say, "234".
                        – Arnauld
                        Nov 24 at 18:33






                      • 3




                        Less whiskey is never the answer!
                        – Shaggy
                        Nov 24 at 18:58


















                      • It seems to work without the ternary for 46 bytes
                        – Shaggy
                        Nov 24 at 17:51






                      • 1




                        @Shaggy It won't. See my suggested test case "blast2".
                        – Arnauld
                        Nov 24 at 17:52










                      • Ah. In that case: 53 bytes
                        – Shaggy
                        Nov 24 at 18:29






                      • 1




                        @Shaggy A bitwise OR would fail for, say, "234".
                        – Arnauld
                        Nov 24 at 18:33






                      • 3




                        Less whiskey is never the answer!
                        – Shaggy
                        Nov 24 at 18:58
















                      It seems to work without the ternary for 46 bytes
                      – Shaggy
                      Nov 24 at 17:51




                      It seems to work without the ternary for 46 bytes
                      – Shaggy
                      Nov 24 at 17:51




                      1




                      1




                      @Shaggy It won't. See my suggested test case "blast2".
                      – Arnauld
                      Nov 24 at 17:52




                      @Shaggy It won't. See my suggested test case "blast2".
                      – Arnauld
                      Nov 24 at 17:52












                      Ah. In that case: 53 bytes
                      – Shaggy
                      Nov 24 at 18:29




                      Ah. In that case: 53 bytes
                      – Shaggy
                      Nov 24 at 18:29




                      1




                      1




                      @Shaggy A bitwise OR would fail for, say, "234".
                      – Arnauld
                      Nov 24 at 18:33




                      @Shaggy A bitwise OR would fail for, say, "234".
                      – Arnauld
                      Nov 24 at 18:33




                      3




                      3




                      Less whiskey is never the answer!
                      – Shaggy
                      Nov 24 at 18:58




                      Less whiskey is never the answer!
                      – Shaggy
                      Nov 24 at 18:58











                      6















                      Jelly, 11 bytes



                      ⁾04yO‘%6<ƝS


                      A monadic Link accepting a list of (uppercase) characters.



                      Try it online!



                      How?



                      First replaces any '0's with '4's (so the rest of the code treats them as being in the rightmost column). Then casts to ordinals, adds one and modulo's by 6 to get 0-based column indices. Then compares neighbours with is-less-than and sums the result.



                      ⁾04yO‘%6<ƝS - Link: list of characters         e.g. "BLAST20"
                      ⁾04 - list of characters = ['0', '4']
                      y - translate "BLAST24"
                      O - ordinals [66,76,65,83,84,50,52]
                      ‘ - increment [67,77,66,84,85,51,53]
                      6 - literal six
                      % - modulo [ 1, 5, 0, 0, 1, 3, 5]
                      Ɲ - neighbourly:
                      < - less than? [ 1, 0, 0, 1, 1, 1 ]
                      S - sum 4





                      share|improve this answer























                      • Oh my, this is art.
                        – Erik the Outgolfer
                        Nov 24 at 21:07
















                      6















                      Jelly, 11 bytes



                      ⁾04yO‘%6<ƝS


                      A monadic Link accepting a list of (uppercase) characters.



                      Try it online!



                      How?



                      First replaces any '0's with '4's (so the rest of the code treats them as being in the rightmost column). Then casts to ordinals, adds one and modulo's by 6 to get 0-based column indices. Then compares neighbours with is-less-than and sums the result.



                      ⁾04yO‘%6<ƝS - Link: list of characters         e.g. "BLAST20"
                      ⁾04 - list of characters = ['0', '4']
                      y - translate "BLAST24"
                      O - ordinals [66,76,65,83,84,50,52]
                      ‘ - increment [67,77,66,84,85,51,53]
                      6 - literal six
                      % - modulo [ 1, 5, 0, 0, 1, 3, 5]
                      Ɲ - neighbourly:
                      < - less than? [ 1, 0, 0, 1, 1, 1 ]
                      S - sum 4





                      share|improve this answer























                      • Oh my, this is art.
                        – Erik the Outgolfer
                        Nov 24 at 21:07














                      6












                      6








                      6







                      Jelly, 11 bytes



                      ⁾04yO‘%6<ƝS


                      A monadic Link accepting a list of (uppercase) characters.



                      Try it online!



                      How?



                      First replaces any '0's with '4's (so the rest of the code treats them as being in the rightmost column). Then casts to ordinals, adds one and modulo's by 6 to get 0-based column indices. Then compares neighbours with is-less-than and sums the result.



                      ⁾04yO‘%6<ƝS - Link: list of characters         e.g. "BLAST20"
                      ⁾04 - list of characters = ['0', '4']
                      y - translate "BLAST24"
                      O - ordinals [66,76,65,83,84,50,52]
                      ‘ - increment [67,77,66,84,85,51,53]
                      6 - literal six
                      % - modulo [ 1, 5, 0, 0, 1, 3, 5]
                      Ɲ - neighbourly:
                      < - less than? [ 1, 0, 0, 1, 1, 1 ]
                      S - sum 4





                      share|improve this answer















                      Jelly, 11 bytes



                      ⁾04yO‘%6<ƝS


                      A monadic Link accepting a list of (uppercase) characters.



                      Try it online!



                      How?



                      First replaces any '0's with '4's (so the rest of the code treats them as being in the rightmost column). Then casts to ordinals, adds one and modulo's by 6 to get 0-based column indices. Then compares neighbours with is-less-than and sums the result.



                      ⁾04yO‘%6<ƝS - Link: list of characters         e.g. "BLAST20"
                      ⁾04 - list of characters = ['0', '4']
                      y - translate "BLAST24"
                      O - ordinals [66,76,65,83,84,50,52]
                      ‘ - increment [67,77,66,84,85,51,53]
                      6 - literal six
                      % - modulo [ 1, 5, 0, 0, 1, 3, 5]
                      Ɲ - neighbourly:
                      < - less than? [ 1, 0, 0, 1, 1, 1 ]
                      S - sum 4






                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Nov 24 at 18:05

























                      answered Nov 24 at 17:21









                      Jonathan Allan

                      50.7k534165




                      50.7k534165












                      • Oh my, this is art.
                        – Erik the Outgolfer
                        Nov 24 at 21:07


















                      • Oh my, this is art.
                        – Erik the Outgolfer
                        Nov 24 at 21:07
















                      Oh my, this is art.
                      – Erik the Outgolfer
                      Nov 24 at 21:07




                      Oh my, this is art.
                      – Erik the Outgolfer
                      Nov 24 at 21:07











                      3















                      Perl 6, 45 39 bytes





                      {sum .[1..*]Z<$_}o{(2 X-.ords)X%46 X%6}


                      Try it online!



                      Works with uppercase letters. (2-ord(c))%46%6 computes the reversed x coordinate.






                      share|improve this answer




























                        3















                        Perl 6, 45 39 bytes





                        {sum .[1..*]Z<$_}o{(2 X-.ords)X%46 X%6}


                        Try it online!



                        Works with uppercase letters. (2-ord(c))%46%6 computes the reversed x coordinate.






                        share|improve this answer


























                          3












                          3








                          3







                          Perl 6, 45 39 bytes





                          {sum .[1..*]Z<$_}o{(2 X-.ords)X%46 X%6}


                          Try it online!



                          Works with uppercase letters. (2-ord(c))%46%6 computes the reversed x coordinate.






                          share|improve this answer















                          Perl 6, 45 39 bytes





                          {sum .[1..*]Z<$_}o{(2 X-.ords)X%46 X%6}


                          Try it online!



                          Works with uppercase letters. (2-ord(c))%46%6 computes the reversed x coordinate.







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Nov 25 at 11:13

























                          answered Nov 24 at 20:13









                          nwellnhof

                          6,48511125




                          6,48511125























                              1















                              K (ngn/k), 32 31 bytes



                              +/>':(+6 6#,/"a10"+!'26 9 1)?0+


                              Try it online!






                              share|improve this answer




























                                1















                                K (ngn/k), 32 31 bytes



                                +/>':(+6 6#,/"a10"+!'26 9 1)?0+


                                Try it online!






                                share|improve this answer


























                                  1












                                  1








                                  1







                                  K (ngn/k), 32 31 bytes



                                  +/>':(+6 6#,/"a10"+!'26 9 1)?0+


                                  Try it online!






                                  share|improve this answer















                                  K (ngn/k), 32 31 bytes



                                  +/>':(+6 6#,/"a10"+!'26 9 1)?0+


                                  Try it online!







                                  share|improve this answer














                                  share|improve this answer



                                  share|improve this answer








                                  edited Nov 24 at 20:53

























                                  answered Nov 24 at 20:44









                                  ngn

                                  6,94112559




                                  6,94112559























                                      1















                                      Clean, 85 bytes



                                      import StdEnv
                                      (s=sum[1\a<-s&b<-tl s|b>a])o map(e=(toInt e+if(e-'1'>'/')1 -1)rem 6)


                                      Try it online!






                                      share|improve this answer


























                                        1















                                        Clean, 85 bytes



                                        import StdEnv
                                        (s=sum[1\a<-s&b<-tl s|b>a])o map(e=(toInt e+if(e-'1'>'/')1 -1)rem 6)


                                        Try it online!






                                        share|improve this answer
























                                          1












                                          1








                                          1







                                          Clean, 85 bytes



                                          import StdEnv
                                          (s=sum[1\a<-s&b<-tl s|b>a])o map(e=(toInt e+if(e-'1'>'/')1 -1)rem 6)


                                          Try it online!






                                          share|improve this answer













                                          Clean, 85 bytes



                                          import StdEnv
                                          (s=sum[1\a<-s&b<-tl s|b>a])o map(e=(toInt e+if(e-'1'>'/')1 -1)rem 6)


                                          Try it online!







                                          share|improve this answer












                                          share|improve this answer



                                          share|improve this answer










                                          answered Nov 25 at 21:26









                                          Οurous

                                          6,42311033




                                          6,42311033























                                              1















                                              Ruby, 56 bytes





                                              ->s{w=9;s.count{|c|w<w=[*?a..?z,*?1..?9,?0].index(c)%6}}


                                              Try it online!



                                              Preliminary naive version, will be golfed.






                                              share|improve this answer


























                                                1















                                                Ruby, 56 bytes





                                                ->s{w=9;s.count{|c|w<w=[*?a..?z,*?1..?9,?0].index(c)%6}}


                                                Try it online!



                                                Preliminary naive version, will be golfed.






                                                share|improve this answer
























                                                  1












                                                  1








                                                  1







                                                  Ruby, 56 bytes





                                                  ->s{w=9;s.count{|c|w<w=[*?a..?z,*?1..?9,?0].index(c)%6}}


                                                  Try it online!



                                                  Preliminary naive version, will be golfed.






                                                  share|improve this answer













                                                  Ruby, 56 bytes





                                                  ->s{w=9;s.count{|c|w<w=[*?a..?z,*?1..?9,?0].index(c)%6}}


                                                  Try it online!



                                                  Preliminary naive version, will be golfed.







                                                  share|improve this answer












                                                  share|improve this answer



                                                  share|improve this answer










                                                  answered Nov 26 at 15:02









                                                  G B

                                                  7,6861328




                                                  7,6861328























                                                      1















                                                      Japt -x, 14 bytes



                                                      ®rT4 c Ä u6Ãä<


                                                      Try it online!



                                                      Port of this Jelly answer. Takes input as an array of characters, with letters uppercase.



                                                      Explanation:



                                                      ®rT4 c Ä u6Ãä<    :
                                                      ® Ã :Map each character through:
                                                      rT4 : Replace 0 with 4
                                                      c : Get the char-code
                                                      Ä : Increment it
                                                      u6 : Modulo 6
                                                      ä< :Replace with 1 if you had to move right, 0 otherwise
                                                      :Implicitly sum and output





                                                      share|improve this answer




























                                                        1















                                                        Japt -x, 14 bytes



                                                        ®rT4 c Ä u6Ãä<


                                                        Try it online!



                                                        Port of this Jelly answer. Takes input as an array of characters, with letters uppercase.



                                                        Explanation:



                                                        ®rT4 c Ä u6Ãä<    :
                                                        ® Ã :Map each character through:
                                                        rT4 : Replace 0 with 4
                                                        c : Get the char-code
                                                        Ä : Increment it
                                                        u6 : Modulo 6
                                                        ä< :Replace with 1 if you had to move right, 0 otherwise
                                                        :Implicitly sum and output





                                                        share|improve this answer


























                                                          1












                                                          1








                                                          1







                                                          Japt -x, 14 bytes



                                                          ®rT4 c Ä u6Ãä<


                                                          Try it online!



                                                          Port of this Jelly answer. Takes input as an array of characters, with letters uppercase.



                                                          Explanation:



                                                          ®rT4 c Ä u6Ãä<    :
                                                          ® Ã :Map each character through:
                                                          rT4 : Replace 0 with 4
                                                          c : Get the char-code
                                                          Ä : Increment it
                                                          u6 : Modulo 6
                                                          ä< :Replace with 1 if you had to move right, 0 otherwise
                                                          :Implicitly sum and output





                                                          share|improve this answer















                                                          Japt -x, 14 bytes



                                                          ®rT4 c Ä u6Ãä<


                                                          Try it online!



                                                          Port of this Jelly answer. Takes input as an array of characters, with letters uppercase.



                                                          Explanation:



                                                          ®rT4 c Ä u6Ãä<    :
                                                          ® Ã :Map each character through:
                                                          rT4 : Replace 0 with 4
                                                          c : Get the char-code
                                                          Ä : Increment it
                                                          u6 : Modulo 6
                                                          ä< :Replace with 1 if you had to move right, 0 otherwise
                                                          :Implicitly sum and output






                                                          share|improve this answer














                                                          share|improve this answer



                                                          share|improve this answer








                                                          edited Nov 26 at 15:05

























                                                          answered Nov 25 at 19:36









                                                          Kamil Drakari

                                                          2,971416




                                                          2,971416























                                                              1















                                                              Java (OpenJDK 8), 73 bytes



                                                              Not a bad solution for Java! That zero being on the right-hand side cost me several bytes.





                                                              t->{int a=9,c=0;for(int d:t)c+=a<(a=(--d+(d/48==1?2:0))%6)?1:0;return c;}


                                                              Try it online!



                                                              Explained



                                                              t -> {                          // Lambda taking a char array as input
                                                              int a=9, // Initialise last column value
                                                              c=0; // Initialise frustration count
                                                              for(int d:t) // Loop through all chars in title
                                                              c+= // increment the frustration count if...
                                                              a< // The last column is smaller than the current column
                                                              (a= // Set last column to current column
                                                              (--d+ // Decrement ascii value of char
                                                              (d/48==1 // If ascii decremented ascii value is between 48 and 95
                                                              ?2:0) // increment by 2 (1 total) or 0 (-1 total)
                                                              )%6) // Mod 6 to retrieve column index
                                                              ?1:0; // Increment if to right hand side
                                                              return c; // return calculated frustration count
                                                              }





                                                              share|improve this answer


























                                                                1















                                                                Java (OpenJDK 8), 73 bytes



                                                                Not a bad solution for Java! That zero being on the right-hand side cost me several bytes.





                                                                t->{int a=9,c=0;for(int d:t)c+=a<(a=(--d+(d/48==1?2:0))%6)?1:0;return c;}


                                                                Try it online!



                                                                Explained



                                                                t -> {                          // Lambda taking a char array as input
                                                                int a=9, // Initialise last column value
                                                                c=0; // Initialise frustration count
                                                                for(int d:t) // Loop through all chars in title
                                                                c+= // increment the frustration count if...
                                                                a< // The last column is smaller than the current column
                                                                (a= // Set last column to current column
                                                                (--d+ // Decrement ascii value of char
                                                                (d/48==1 // If ascii decremented ascii value is between 48 and 95
                                                                ?2:0) // increment by 2 (1 total) or 0 (-1 total)
                                                                )%6) // Mod 6 to retrieve column index
                                                                ?1:0; // Increment if to right hand side
                                                                return c; // return calculated frustration count
                                                                }





                                                                share|improve this answer
























                                                                  1












                                                                  1








                                                                  1







                                                                  Java (OpenJDK 8), 73 bytes



                                                                  Not a bad solution for Java! That zero being on the right-hand side cost me several bytes.





                                                                  t->{int a=9,c=0;for(int d:t)c+=a<(a=(--d+(d/48==1?2:0))%6)?1:0;return c;}


                                                                  Try it online!



                                                                  Explained



                                                                  t -> {                          // Lambda taking a char array as input
                                                                  int a=9, // Initialise last column value
                                                                  c=0; // Initialise frustration count
                                                                  for(int d:t) // Loop through all chars in title
                                                                  c+= // increment the frustration count if...
                                                                  a< // The last column is smaller than the current column
                                                                  (a= // Set last column to current column
                                                                  (--d+ // Decrement ascii value of char
                                                                  (d/48==1 // If ascii decremented ascii value is between 48 and 95
                                                                  ?2:0) // increment by 2 (1 total) or 0 (-1 total)
                                                                  )%6) // Mod 6 to retrieve column index
                                                                  ?1:0; // Increment if to right hand side
                                                                  return c; // return calculated frustration count
                                                                  }





                                                                  share|improve this answer













                                                                  Java (OpenJDK 8), 73 bytes



                                                                  Not a bad solution for Java! That zero being on the right-hand side cost me several bytes.





                                                                  t->{int a=9,c=0;for(int d:t)c+=a<(a=(--d+(d/48==1?2:0))%6)?1:0;return c;}


                                                                  Try it online!



                                                                  Explained



                                                                  t -> {                          // Lambda taking a char array as input
                                                                  int a=9, // Initialise last column value
                                                                  c=0; // Initialise frustration count
                                                                  for(int d:t) // Loop through all chars in title
                                                                  c+= // increment the frustration count if...
                                                                  a< // The last column is smaller than the current column
                                                                  (a= // Set last column to current column
                                                                  (--d+ // Decrement ascii value of char
                                                                  (d/48==1 // If ascii decremented ascii value is between 48 and 95
                                                                  ?2:0) // increment by 2 (1 total) or 0 (-1 total)
                                                                  )%6) // Mod 6 to retrieve column index
                                                                  ?1:0; // Increment if to right hand side
                                                                  return c; // return calculated frustration count
                                                                  }






                                                                  share|improve this answer












                                                                  share|improve this answer



                                                                  share|improve this answer










                                                                  answered Nov 26 at 17:34









                                                                  Luke Stevens

                                                                  744214




                                                                  744214























                                                                      1















                                                                      05AB1E, 12 11 bytes



                                                                      -1 byte thanks to @Kevin Cruijssen



                                                                      ¾4:Ç>6%¥1@O


                                                                      Another port of Jonathan Allan's Jelly answer. Takes input in uppercase.



                                                                      Explanation:



                                                                      ¾4:Ç>6%¥1@O   //full program
                                                                      ¾4: //replace all '0's with '4's
                                                                      Ç //get ASCII code points
                                                                      > //increment
                                                                      6% //modulo 6
                                                                      ¥ //get deltas
                                                                      1@ //is >= 1
                                                                      O //sum


                                                                      Try it online!






                                                                      share|improve this answer



















                                                                      • 1




                                                                        0'4 can be ¾4 to save a byte (relevant 05AB1E tip).
                                                                        – Kevin Cruijssen
                                                                        Nov 28 at 9:06


















                                                                      1















                                                                      05AB1E, 12 11 bytes



                                                                      -1 byte thanks to @Kevin Cruijssen



                                                                      ¾4:Ç>6%¥1@O


                                                                      Another port of Jonathan Allan's Jelly answer. Takes input in uppercase.



                                                                      Explanation:



                                                                      ¾4:Ç>6%¥1@O   //full program
                                                                      ¾4: //replace all '0's with '4's
                                                                      Ç //get ASCII code points
                                                                      > //increment
                                                                      6% //modulo 6
                                                                      ¥ //get deltas
                                                                      1@ //is >= 1
                                                                      O //sum


                                                                      Try it online!






                                                                      share|improve this answer



















                                                                      • 1




                                                                        0'4 can be ¾4 to save a byte (relevant 05AB1E tip).
                                                                        – Kevin Cruijssen
                                                                        Nov 28 at 9:06
















                                                                      1












                                                                      1








                                                                      1







                                                                      05AB1E, 12 11 bytes



                                                                      -1 byte thanks to @Kevin Cruijssen



                                                                      ¾4:Ç>6%¥1@O


                                                                      Another port of Jonathan Allan's Jelly answer. Takes input in uppercase.



                                                                      Explanation:



                                                                      ¾4:Ç>6%¥1@O   //full program
                                                                      ¾4: //replace all '0's with '4's
                                                                      Ç //get ASCII code points
                                                                      > //increment
                                                                      6% //modulo 6
                                                                      ¥ //get deltas
                                                                      1@ //is >= 1
                                                                      O //sum


                                                                      Try it online!






                                                                      share|improve this answer















                                                                      05AB1E, 12 11 bytes



                                                                      -1 byte thanks to @Kevin Cruijssen



                                                                      ¾4:Ç>6%¥1@O


                                                                      Another port of Jonathan Allan's Jelly answer. Takes input in uppercase.



                                                                      Explanation:



                                                                      ¾4:Ç>6%¥1@O   //full program
                                                                      ¾4: //replace all '0's with '4's
                                                                      Ç //get ASCII code points
                                                                      > //increment
                                                                      6% //modulo 6
                                                                      ¥ //get deltas
                                                                      1@ //is >= 1
                                                                      O //sum


                                                                      Try it online!







                                                                      share|improve this answer














                                                                      share|improve this answer



                                                                      share|improve this answer








                                                                      edited Nov 28 at 14:35

























                                                                      answered Nov 26 at 15:04









                                                                      Cowabunghole

                                                                      1,065418




                                                                      1,065418








                                                                      • 1




                                                                        0'4 can be ¾4 to save a byte (relevant 05AB1E tip).
                                                                        – Kevin Cruijssen
                                                                        Nov 28 at 9:06
















                                                                      • 1




                                                                        0'4 can be ¾4 to save a byte (relevant 05AB1E tip).
                                                                        – Kevin Cruijssen
                                                                        Nov 28 at 9:06










                                                                      1




                                                                      1




                                                                      0'4 can be ¾4 to save a byte (relevant 05AB1E tip).
                                                                      – Kevin Cruijssen
                                                                      Nov 28 at 9:06






                                                                      0'4 can be ¾4 to save a byte (relevant 05AB1E tip).
                                                                      – Kevin Cruijssen
                                                                      Nov 28 at 9:06













                                                                      0















                                                                      Retina 0.8.2, 46 bytes



                                                                      T`l1-90`1-61-61-61-61-61-6
                                                                      .
                                                                      ;$&$*
                                                                      &`;(1+);11


                                                                      Try it online! Link includes test cases. Explanation:



                                                                      T`l1-90`1-61-61-61-61-61-6


                                                                      List the alphabet and digits in the order on the OSK and map each one to a (1-indexed) column number.



                                                                      .
                                                                      ;$&$*


                                                                      Convert each column number to unary.



                                                                      &`;(1+);11


                                                                      Count the number of columns that are followed by a larger (i.e. rightwards) column. The &` allows the matches to overlap.






                                                                      share|improve this answer


























                                                                        0















                                                                        Retina 0.8.2, 46 bytes



                                                                        T`l1-90`1-61-61-61-61-61-6
                                                                        .
                                                                        ;$&$*
                                                                        &`;(1+);11


                                                                        Try it online! Link includes test cases. Explanation:



                                                                        T`l1-90`1-61-61-61-61-61-6


                                                                        List the alphabet and digits in the order on the OSK and map each one to a (1-indexed) column number.



                                                                        .
                                                                        ;$&$*


                                                                        Convert each column number to unary.



                                                                        &`;(1+);11


                                                                        Count the number of columns that are followed by a larger (i.e. rightwards) column. The &` allows the matches to overlap.






                                                                        share|improve this answer
























                                                                          0












                                                                          0








                                                                          0







                                                                          Retina 0.8.2, 46 bytes



                                                                          T`l1-90`1-61-61-61-61-61-6
                                                                          .
                                                                          ;$&$*
                                                                          &`;(1+);11


                                                                          Try it online! Link includes test cases. Explanation:



                                                                          T`l1-90`1-61-61-61-61-61-6


                                                                          List the alphabet and digits in the order on the OSK and map each one to a (1-indexed) column number.



                                                                          .
                                                                          ;$&$*


                                                                          Convert each column number to unary.



                                                                          &`;(1+);11


                                                                          Count the number of columns that are followed by a larger (i.e. rightwards) column. The &` allows the matches to overlap.






                                                                          share|improve this answer













                                                                          Retina 0.8.2, 46 bytes



                                                                          T`l1-90`1-61-61-61-61-61-6
                                                                          .
                                                                          ;$&$*
                                                                          &`;(1+);11


                                                                          Try it online! Link includes test cases. Explanation:



                                                                          T`l1-90`1-61-61-61-61-61-6


                                                                          List the alphabet and digits in the order on the OSK and map each one to a (1-indexed) column number.



                                                                          .
                                                                          ;$&$*


                                                                          Convert each column number to unary.



                                                                          &`;(1+);11


                                                                          Count the number of columns that are followed by a larger (i.e. rightwards) column. The &` allows the matches to overlap.







                                                                          share|improve this answer












                                                                          share|improve this answer



                                                                          share|improve this answer










                                                                          answered Nov 24 at 20:49









                                                                          Neil

                                                                          79.3k744177




                                                                          79.3k744177























                                                                              0















                                                                              Python 2, 84 bytes





                                                                              def f(s,k=6):j=(ord(s[0])+('0'<s[0]<':')*2-1)%6;return(j>k)+(~-len(s)and f(s[1:],j))


                                                                              Try it online!






                                                                              share|improve this answer




























                                                                                0















                                                                                Python 2, 84 bytes





                                                                                def f(s,k=6):j=(ord(s[0])+('0'<s[0]<':')*2-1)%6;return(j>k)+(~-len(s)and f(s[1:],j))


                                                                                Try it online!






                                                                                share|improve this answer


























                                                                                  0












                                                                                  0








                                                                                  0







                                                                                  Python 2, 84 bytes





                                                                                  def f(s,k=6):j=(ord(s[0])+('0'<s[0]<':')*2-1)%6;return(j>k)+(~-len(s)and f(s[1:],j))


                                                                                  Try it online!






                                                                                  share|improve this answer















                                                                                  Python 2, 84 bytes





                                                                                  def f(s,k=6):j=(ord(s[0])+('0'<s[0]<':')*2-1)%6;return(j>k)+(~-len(s)and f(s[1:],j))


                                                                                  Try it online!







                                                                                  share|improve this answer














                                                                                  share|improve this answer



                                                                                  share|improve this answer








                                                                                  edited Nov 25 at 6:20

























                                                                                  answered Nov 25 at 4:42









                                                                                  Chas Brown

                                                                                  4,8081522




                                                                                  4,8081522























                                                                                      0














                                                                                      Mathematica, 102 bytes



                                                                                      Differences[Last@@Join[Alphabet,ToString/@Range@9,{"0"}]~Partition~6~Position~#&/@#]~Count~_?(#>0&)&


                                                                                      Pure function. Takes a list of characters as input and returns a number as output. This is a pretty naive solution, golfing suggestions welcome.






                                                                                      share|improve this answer


























                                                                                        0














                                                                                        Mathematica, 102 bytes



                                                                                        Differences[Last@@Join[Alphabet,ToString/@Range@9,{"0"}]~Partition~6~Position~#&/@#]~Count~_?(#>0&)&


                                                                                        Pure function. Takes a list of characters as input and returns a number as output. This is a pretty naive solution, golfing suggestions welcome.






                                                                                        share|improve this answer
























                                                                                          0












                                                                                          0








                                                                                          0






                                                                                          Mathematica, 102 bytes



                                                                                          Differences[Last@@Join[Alphabet,ToString/@Range@9,{"0"}]~Partition~6~Position~#&/@#]~Count~_?(#>0&)&


                                                                                          Pure function. Takes a list of characters as input and returns a number as output. This is a pretty naive solution, golfing suggestions welcome.






                                                                                          share|improve this answer












                                                                                          Mathematica, 102 bytes



                                                                                          Differences[Last@@Join[Alphabet,ToString/@Range@9,{"0"}]~Partition~6~Position~#&/@#]~Count~_?(#>0&)&


                                                                                          Pure function. Takes a list of characters as input and returns a number as output. This is a pretty naive solution, golfing suggestions welcome.







                                                                                          share|improve this answer












                                                                                          share|improve this answer



                                                                                          share|improve this answer










                                                                                          answered Nov 25 at 15:24









                                                                                          LegionMammal978

                                                                                          15.1k41852




                                                                                          15.1k41852























                                                                                              0














                                                                                              PHP, 74 81 77 bytes



                                                                                              for(;$o=ord($argn[$i]);$i++&&$f+=$p<$x,$p=$x)$x=(--$o/48^1?$o:$o+2)%6;echo$f;


                                                                                              Run as pipe with -nR or try it online.






                                                                                              share|improve this answer




























                                                                                                0














                                                                                                PHP, 74 81 77 bytes



                                                                                                for(;$o=ord($argn[$i]);$i++&&$f+=$p<$x,$p=$x)$x=(--$o/48^1?$o:$o+2)%6;echo$f;


                                                                                                Run as pipe with -nR or try it online.






                                                                                                share|improve this answer


























                                                                                                  0












                                                                                                  0








                                                                                                  0






                                                                                                  PHP, 74 81 77 bytes



                                                                                                  for(;$o=ord($argn[$i]);$i++&&$f+=$p<$x,$p=$x)$x=(--$o/48^1?$o:$o+2)%6;echo$f;


                                                                                                  Run as pipe with -nR or try it online.






                                                                                                  share|improve this answer














                                                                                                  PHP, 74 81 77 bytes



                                                                                                  for(;$o=ord($argn[$i]);$i++&&$f+=$p<$x,$p=$x)$x=(--$o/48^1?$o:$o+2)%6;echo$f;


                                                                                                  Run as pipe with -nR or try it online.







                                                                                                  share|improve this answer














                                                                                                  share|improve this answer



                                                                                                  share|improve this answer








                                                                                                  edited Nov 29 at 13:21

























                                                                                                  answered Nov 29 at 12:41









                                                                                                  Titus

                                                                                                  13k11238




                                                                                                  13k11238























                                                                                                      0















                                                                                                      C (gcc),  82 79  77 bytes





                                                                                                      o;c(i){i+=i<60&i>48?1:5;i%=6;}f(char*s){for(o=0;*++s;o+=c(*s)>c(s[-1]));o=o;}


                                                                                                      Try it online!



                                                                                                      This function will only support lowercase inputs





                                                                                                      Ungolfed and commented:





                                                                                                      o; //Used for output
                                                                                                      c(i){ //Calculates the column of given character
                                                                                                      i+= //Correct i to get the correct column
                                                                                                      i<60 //If i is a digit...
                                                                                                      & i>48 //... but not '0'
                                                                                                      ?1 //Then move it one column on the right
                                                                                                      :5; //Else move it five columns on the right
                                                                                                      i%=6; //Get the column number
                                                                                                      }
                                                                                                      f(char*s){ // The actual "frustrating" function
                                                                                                      for( //Loop for each character
                                                                                                      o=0; //reinitialize output
                                                                                                      *++s; //move to next character / while this is not ''
                                                                                                      o+=c(*s)>c(s[-1]) //Increment if current character is on the right of the previous one
                                                                                                      );
                                                                                                      o=o; // Outputs result
                                                                                                      }




                                                                                                      If my function is allowed to accept wide character strings, it can be reduced to 76 bytes with:





                                                                                                      o;c(i){i+=i<60&i>48?1:5;i%=6;}f(int*s){for(o=0;*++s;o+=c(*s)>c(s[-1]));o=o;}


                                                                                                      Try it online!



                                                                                                      This version just accept input as int* instead of char*





                                                                                                      Edits:




                                                                                                      • Golfed 3 bytes in the calculation of the column (function c)

                                                                                                      • Golfed 2 bytes thanks to ceilingcat






                                                                                                      share|improve this answer























                                                                                                      • And there, 77 bytes
                                                                                                        – Rogem
                                                                                                        Nov 26 at 16:59
















                                                                                                      0















                                                                                                      C (gcc),  82 79  77 bytes





                                                                                                      o;c(i){i+=i<60&i>48?1:5;i%=6;}f(char*s){for(o=0;*++s;o+=c(*s)>c(s[-1]));o=o;}


                                                                                                      Try it online!



                                                                                                      This function will only support lowercase inputs





                                                                                                      Ungolfed and commented:





                                                                                                      o; //Used for output
                                                                                                      c(i){ //Calculates the column of given character
                                                                                                      i+= //Correct i to get the correct column
                                                                                                      i<60 //If i is a digit...
                                                                                                      & i>48 //... but not '0'
                                                                                                      ?1 //Then move it one column on the right
                                                                                                      :5; //Else move it five columns on the right
                                                                                                      i%=6; //Get the column number
                                                                                                      }
                                                                                                      f(char*s){ // The actual "frustrating" function
                                                                                                      for( //Loop for each character
                                                                                                      o=0; //reinitialize output
                                                                                                      *++s; //move to next character / while this is not ''
                                                                                                      o+=c(*s)>c(s[-1]) //Increment if current character is on the right of the previous one
                                                                                                      );
                                                                                                      o=o; // Outputs result
                                                                                                      }




                                                                                                      If my function is allowed to accept wide character strings, it can be reduced to 76 bytes with:





                                                                                                      o;c(i){i+=i<60&i>48?1:5;i%=6;}f(int*s){for(o=0;*++s;o+=c(*s)>c(s[-1]));o=o;}


                                                                                                      Try it online!



                                                                                                      This version just accept input as int* instead of char*





                                                                                                      Edits:




                                                                                                      • Golfed 3 bytes in the calculation of the column (function c)

                                                                                                      • Golfed 2 bytes thanks to ceilingcat






                                                                                                      share|improve this answer























                                                                                                      • And there, 77 bytes
                                                                                                        – Rogem
                                                                                                        Nov 26 at 16:59














                                                                                                      0












                                                                                                      0








                                                                                                      0







                                                                                                      C (gcc),  82 79  77 bytes





                                                                                                      o;c(i){i+=i<60&i>48?1:5;i%=6;}f(char*s){for(o=0;*++s;o+=c(*s)>c(s[-1]));o=o;}


                                                                                                      Try it online!



                                                                                                      This function will only support lowercase inputs





                                                                                                      Ungolfed and commented:





                                                                                                      o; //Used for output
                                                                                                      c(i){ //Calculates the column of given character
                                                                                                      i+= //Correct i to get the correct column
                                                                                                      i<60 //If i is a digit...
                                                                                                      & i>48 //... but not '0'
                                                                                                      ?1 //Then move it one column on the right
                                                                                                      :5; //Else move it five columns on the right
                                                                                                      i%=6; //Get the column number
                                                                                                      }
                                                                                                      f(char*s){ // The actual "frustrating" function
                                                                                                      for( //Loop for each character
                                                                                                      o=0; //reinitialize output
                                                                                                      *++s; //move to next character / while this is not ''
                                                                                                      o+=c(*s)>c(s[-1]) //Increment if current character is on the right of the previous one
                                                                                                      );
                                                                                                      o=o; // Outputs result
                                                                                                      }




                                                                                                      If my function is allowed to accept wide character strings, it can be reduced to 76 bytes with:





                                                                                                      o;c(i){i+=i<60&i>48?1:5;i%=6;}f(int*s){for(o=0;*++s;o+=c(*s)>c(s[-1]));o=o;}


                                                                                                      Try it online!



                                                                                                      This version just accept input as int* instead of char*





                                                                                                      Edits:




                                                                                                      • Golfed 3 bytes in the calculation of the column (function c)

                                                                                                      • Golfed 2 bytes thanks to ceilingcat






                                                                                                      share|improve this answer















                                                                                                      C (gcc),  82 79  77 bytes





                                                                                                      o;c(i){i+=i<60&i>48?1:5;i%=6;}f(char*s){for(o=0;*++s;o+=c(*s)>c(s[-1]));o=o;}


                                                                                                      Try it online!



                                                                                                      This function will only support lowercase inputs





                                                                                                      Ungolfed and commented:





                                                                                                      o; //Used for output
                                                                                                      c(i){ //Calculates the column of given character
                                                                                                      i+= //Correct i to get the correct column
                                                                                                      i<60 //If i is a digit...
                                                                                                      & i>48 //... but not '0'
                                                                                                      ?1 //Then move it one column on the right
                                                                                                      :5; //Else move it five columns on the right
                                                                                                      i%=6; //Get the column number
                                                                                                      }
                                                                                                      f(char*s){ // The actual "frustrating" function
                                                                                                      for( //Loop for each character
                                                                                                      o=0; //reinitialize output
                                                                                                      *++s; //move to next character / while this is not ''
                                                                                                      o+=c(*s)>c(s[-1]) //Increment if current character is on the right of the previous one
                                                                                                      );
                                                                                                      o=o; // Outputs result
                                                                                                      }




                                                                                                      If my function is allowed to accept wide character strings, it can be reduced to 76 bytes with:





                                                                                                      o;c(i){i+=i<60&i>48?1:5;i%=6;}f(int*s){for(o=0;*++s;o+=c(*s)>c(s[-1]));o=o;}


                                                                                                      Try it online!



                                                                                                      This version just accept input as int* instead of char*





                                                                                                      Edits:




                                                                                                      • Golfed 3 bytes in the calculation of the column (function c)

                                                                                                      • Golfed 2 bytes thanks to ceilingcat







                                                                                                      share|improve this answer














                                                                                                      share|improve this answer



                                                                                                      share|improve this answer








                                                                                                      edited Dec 4 at 8:28

























                                                                                                      answered Nov 26 at 16:24









                                                                                                      Annyo

                                                                                                      1313




                                                                                                      1313












                                                                                                      • And there, 77 bytes
                                                                                                        – Rogem
                                                                                                        Nov 26 at 16:59


















                                                                                                      • And there, 77 bytes
                                                                                                        – Rogem
                                                                                                        Nov 26 at 16:59
















                                                                                                      And there, 77 bytes
                                                                                                      – Rogem
                                                                                                      Nov 26 at 16:59




                                                                                                      And there, 77 bytes
                                                                                                      – Rogem
                                                                                                      Nov 26 at 16:59


















                                                                                                      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).






                                                                                                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                                                                                      Please pay close attention to the following guidance:


                                                                                                      • Please be sure to answer the question. Provide details and share your research!

                                                                                                      But avoid



                                                                                                      • Asking for help, clarification, or responding to other answers.

                                                                                                      • Making statements based on opinion; back them up with references or personal experience.


                                                                                                      To learn more, see our tips on writing great answers.




                                                                                                      draft saved


                                                                                                      draft discarded














                                                                                                      StackExchange.ready(
                                                                                                      function () {
                                                                                                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f176492%2fhow-frustrating-is-my-movie%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

                                                                                                      Plaza Victoria

                                                                                                      In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

                                                                                                      How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...