Hash function that describe solid tetromino in the table












0












$begingroup$


I'm trying to find a hash function that describes solid tetromino in a matrix 4x4 consisting of '0' and '1'. Here is what I mean:




1) 1111 0000 0000 0000 - solid tetromino, all this ones have the same hash
0000 1111 0000 0000
0000 0000 1111 0000
0000 0000 0000 1111

2) 0111 0100 0010 - NOT solid tetromino, any other different hashes
1000 1000 0010 (this examples shows that simple byte code
0000 1000 0100 on rowscolumnstheir combination will not
0000 0000 0100 work correctly)

3) 0100 0010 0000 - some more examples for the same hash and what
1110 0111 0000 I mean by "solid" tetromino
0000 0000 0100
0000 0000 1110


I am stuck on an idea with the representation of a matrix as a binary number of length 16 made up of a series of rows or columns. It does not work correctly with series 1 and 2 above.



You can find picture of all possible tetrominos on wiki-page.










share|cite|improve this question









$endgroup$

















    0












    $begingroup$


    I'm trying to find a hash function that describes solid tetromino in a matrix 4x4 consisting of '0' and '1'. Here is what I mean:




    1) 1111 0000 0000 0000 - solid tetromino, all this ones have the same hash
    0000 1111 0000 0000
    0000 0000 1111 0000
    0000 0000 0000 1111

    2) 0111 0100 0010 - NOT solid tetromino, any other different hashes
    1000 1000 0010 (this examples shows that simple byte code
    0000 1000 0100 on rowscolumnstheir combination will not
    0000 0000 0100 work correctly)

    3) 0100 0010 0000 - some more examples for the same hash and what
    1110 0111 0000 I mean by "solid" tetromino
    0000 0000 0100
    0000 0000 1110


    I am stuck on an idea with the representation of a matrix as a binary number of length 16 made up of a series of rows or columns. It does not work correctly with series 1 and 2 above.



    You can find picture of all possible tetrominos on wiki-page.










    share|cite|improve this question









    $endgroup$















      0












      0








      0





      $begingroup$


      I'm trying to find a hash function that describes solid tetromino in a matrix 4x4 consisting of '0' and '1'. Here is what I mean:




      1) 1111 0000 0000 0000 - solid tetromino, all this ones have the same hash
      0000 1111 0000 0000
      0000 0000 1111 0000
      0000 0000 0000 1111

      2) 0111 0100 0010 - NOT solid tetromino, any other different hashes
      1000 1000 0010 (this examples shows that simple byte code
      0000 1000 0100 on rowscolumnstheir combination will not
      0000 0000 0100 work correctly)

      3) 0100 0010 0000 - some more examples for the same hash and what
      1110 0111 0000 I mean by "solid" tetromino
      0000 0000 0100
      0000 0000 1110


      I am stuck on an idea with the representation of a matrix as a binary number of length 16 made up of a series of rows or columns. It does not work correctly with series 1 and 2 above.



      You can find picture of all possible tetrominos on wiki-page.










      share|cite|improve this question









      $endgroup$




      I'm trying to find a hash function that describes solid tetromino in a matrix 4x4 consisting of '0' and '1'. Here is what I mean:




      1) 1111 0000 0000 0000 - solid tetromino, all this ones have the same hash
      0000 1111 0000 0000
      0000 0000 1111 0000
      0000 0000 0000 1111

      2) 0111 0100 0010 - NOT solid tetromino, any other different hashes
      1000 1000 0010 (this examples shows that simple byte code
      0000 1000 0100 on rowscolumnstheir combination will not
      0000 0000 0100 work correctly)

      3) 0100 0010 0000 - some more examples for the same hash and what
      1110 0111 0000 I mean by "solid" tetromino
      0000 0000 0100
      0000 0000 1110


      I am stuck on an idea with the representation of a matrix as a binary number of length 16 made up of a series of rows or columns. It does not work correctly with series 1 and 2 above.



      You can find picture of all possible tetrominos on wiki-page.







      combinatorics matrices hash-function






      share|cite|improve this question













      share|cite|improve this question











      share|cite|improve this question




      share|cite|improve this question










      asked Dec 8 '18 at 19:14









      Maxim FrolovMaxim Frolov

      11




      11






















          1 Answer
          1






          active

          oldest

          votes


















          0












          $begingroup$

          Ok, I found the perfect function for myself. This clusters all figures of the same type into groups with the same hash.



          This takes as input a binary number obtained by condensing the rows of the matrix horizontally.



          $$f(x) = sum_{i=0}^{15} (x[i] == 1) ? (1 << ((i + i div 4) - (fo + fo div 4))) : 0 $$




          Where:
          i - index of digit in binary number
          fo - i of first entry 1 left to right
          « - binary shift to the left





          share|cite|improve this answer









          $endgroup$













            Your Answer





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

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "69"
            };
            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: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            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
            },
            noCode: true, onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3031501%2fhash-function-that-describe-solid-tetromino-in-the-table%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0












            $begingroup$

            Ok, I found the perfect function for myself. This clusters all figures of the same type into groups with the same hash.



            This takes as input a binary number obtained by condensing the rows of the matrix horizontally.



            $$f(x) = sum_{i=0}^{15} (x[i] == 1) ? (1 << ((i + i div 4) - (fo + fo div 4))) : 0 $$




            Where:
            i - index of digit in binary number
            fo - i of first entry 1 left to right
            « - binary shift to the left





            share|cite|improve this answer









            $endgroup$


















              0












              $begingroup$

              Ok, I found the perfect function for myself. This clusters all figures of the same type into groups with the same hash.



              This takes as input a binary number obtained by condensing the rows of the matrix horizontally.



              $$f(x) = sum_{i=0}^{15} (x[i] == 1) ? (1 << ((i + i div 4) - (fo + fo div 4))) : 0 $$




              Where:
              i - index of digit in binary number
              fo - i of first entry 1 left to right
              « - binary shift to the left





              share|cite|improve this answer









              $endgroup$
















                0












                0








                0





                $begingroup$

                Ok, I found the perfect function for myself. This clusters all figures of the same type into groups with the same hash.



                This takes as input a binary number obtained by condensing the rows of the matrix horizontally.



                $$f(x) = sum_{i=0}^{15} (x[i] == 1) ? (1 << ((i + i div 4) - (fo + fo div 4))) : 0 $$




                Where:
                i - index of digit in binary number
                fo - i of first entry 1 left to right
                « - binary shift to the left





                share|cite|improve this answer









                $endgroup$



                Ok, I found the perfect function for myself. This clusters all figures of the same type into groups with the same hash.



                This takes as input a binary number obtained by condensing the rows of the matrix horizontally.



                $$f(x) = sum_{i=0}^{15} (x[i] == 1) ? (1 << ((i + i div 4) - (fo + fo div 4))) : 0 $$




                Where:
                i - index of digit in binary number
                fo - i of first entry 1 left to right
                « - binary shift to the left






                share|cite|improve this answer












                share|cite|improve this answer



                share|cite|improve this answer










                answered Dec 10 '18 at 14:52









                Maxim FrolovMaxim Frolov

                11




                11






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Mathematics Stack Exchange!


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


                    Use MathJax to format equations. MathJax reference.


                    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%2fmath.stackexchange.com%2fquestions%2f3031501%2fhash-function-that-describe-solid-tetromino-in-the-table%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

                    How do I know what Microsoft account the skydrive app is syncing to?

                    When does type information flow backwards in C++?

                    Grease: Live!