Through Space and Time

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
4
down vote

favorite












Introduction:



In general we usually speak of four dimensions: three space dimensions for x, y, and z; and one time dimension. For the sake of this challenge however, we'll split the time dimension into three as well: past, present, and future.



Input:



Two input-lists. One containing integer x,y,z coordinates, and one containing integer years.



Output:



One of any four distinct and constant outputs of your own choice. One to indicate the output space; one to indicate the output time; one to indicate the output both space and time; and one to indicate the output neither space nor time.



We'll indicate we went to all three space dimensions if the differences of the integer-tuples is not 0 for all three dimensions.

We'll indicate we went to all three time dimensions if there is at least one year in the past, at least one year in the future, and at least one year equal to the current year (so in the present).



Example:



Input:

Coordinates-list: [5,7,2, 5,3,8, -6,3,8, 5,7,2]

Year-list: [2039, 2019, 2018, 2039, 2222]



Output:

Constant for space



Why?

The x coordinates are [5,5,-6,5]. Since they are not all the same, we've went through the x space dimension.

The y coordinates are [7,3,3,7]. Since they are not all the same, we've also went through the y space dimension.

The z coordinates are [2,8,8,2]. Since they are not all the same, we've also went through the z space dimension.

The current year is 2018. There are no years before this, so we did not visit the past time dimension.

There is a 2018 present in the year-list, so we did visit the present time dimension.

There are multiple years above 2018 ([2039, 2019, 2039, 2222]), so we also visited the future time dimension.



Since we've visited all three space dimensions, but only two of the three time dimensions, the output will only be (the constant for) space.



Challenge rules:



  • You can use any four distinct and constant outputs for the four possible states.

  • Input can be in any reasonable format. Coordinates list can be tuples, inner lists/arrays of size 3, strings, objects, etc. List of years may be a list of date-objects instead of integers as well if it would benefit your byte-count.

  • You can assume the x,y,z coordinates will be integers, so no need to handle floating point decimals. Any of the x, y, and/or z coordinates can be negative values, though.

  • You cannot take the input-lists pre-ordered. The input-lists should be in the order displayed in the test cases.

  • You can assume all year values will be in the range [0,9999]; and you can assume all coordinates are in the range [-9999,9999].

General rules:



  • This is code-golf, so shortest answer in bytes wins.

    Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.


  • Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.


  • Default Loopholes are forbidden.

  • If possible, please add a link with a test for your code (i.e. TIO).

  • Also, adding an explanation for your answer is highly recommended.

Test cases:



Coordinates-input: [5,7,2, 5,3,8, -6,3,8, 5,7,2]
Years-input: [2039, 2019, 2018, 2039, 2222]
Output: space

Coordinates-input: [0,0,0, -4,-4,0, -4,2,0]
Years-input: [2016, 2019, 2018, 2000]
Output: time

Coordinates-input: [-2,-2,-2, -3,-3,-3]
Years-input: [2020, 1991, 2014, 2018]
Output: both

Coordinates-input: [5,4,2, 3,4,0, 1,4,2, 9,4,4]
Years-input: [2020, 1991, 2014, 2017, 2019, 1850]
Output: neither









share|improve this question























  • What range of years do we need to be able to handle?
    – Shaggy
    30 mins ago











  • @Shaggy I will add it to the challenge description. [0,9999] is fine (and [-9999,9999] for the coordinates is fine as well.
    – Kevin Cruijssen
    30 mins ago











  • Dang, there goes one of my ideas!
    – Shaggy
    25 mins ago










  • @Shaggy Out of curiosity, what range were you hoping for?
    – Kevin Cruijssen
    13 mins ago










  • One where no year was divisible by any other, that's how I was testing for the presence of the current year.
    – Shaggy
    11 mins ago














up vote
4
down vote

favorite












Introduction:



In general we usually speak of four dimensions: three space dimensions for x, y, and z; and one time dimension. For the sake of this challenge however, we'll split the time dimension into three as well: past, present, and future.



Input:



Two input-lists. One containing integer x,y,z coordinates, and one containing integer years.



Output:



One of any four distinct and constant outputs of your own choice. One to indicate the output space; one to indicate the output time; one to indicate the output both space and time; and one to indicate the output neither space nor time.



We'll indicate we went to all three space dimensions if the differences of the integer-tuples is not 0 for all three dimensions.

We'll indicate we went to all three time dimensions if there is at least one year in the past, at least one year in the future, and at least one year equal to the current year (so in the present).



Example:



Input:

Coordinates-list: [5,7,2, 5,3,8, -6,3,8, 5,7,2]

Year-list: [2039, 2019, 2018, 2039, 2222]



Output:

Constant for space



Why?

The x coordinates are [5,5,-6,5]. Since they are not all the same, we've went through the x space dimension.

The y coordinates are [7,3,3,7]. Since they are not all the same, we've also went through the y space dimension.

The z coordinates are [2,8,8,2]. Since they are not all the same, we've also went through the z space dimension.

The current year is 2018. There are no years before this, so we did not visit the past time dimension.

There is a 2018 present in the year-list, so we did visit the present time dimension.

There are multiple years above 2018 ([2039, 2019, 2039, 2222]), so we also visited the future time dimension.



Since we've visited all three space dimensions, but only two of the three time dimensions, the output will only be (the constant for) space.



Challenge rules:



  • You can use any four distinct and constant outputs for the four possible states.

  • Input can be in any reasonable format. Coordinates list can be tuples, inner lists/arrays of size 3, strings, objects, etc. List of years may be a list of date-objects instead of integers as well if it would benefit your byte-count.

  • You can assume the x,y,z coordinates will be integers, so no need to handle floating point decimals. Any of the x, y, and/or z coordinates can be negative values, though.

  • You cannot take the input-lists pre-ordered. The input-lists should be in the order displayed in the test cases.

  • You can assume all year values will be in the range [0,9999]; and you can assume all coordinates are in the range [-9999,9999].

General rules:



  • This is code-golf, so shortest answer in bytes wins.

    Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.


  • Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.


  • Default Loopholes are forbidden.

  • If possible, please add a link with a test for your code (i.e. TIO).

  • Also, adding an explanation for your answer is highly recommended.

Test cases:



Coordinates-input: [5,7,2, 5,3,8, -6,3,8, 5,7,2]
Years-input: [2039, 2019, 2018, 2039, 2222]
Output: space

Coordinates-input: [0,0,0, -4,-4,0, -4,2,0]
Years-input: [2016, 2019, 2018, 2000]
Output: time

Coordinates-input: [-2,-2,-2, -3,-3,-3]
Years-input: [2020, 1991, 2014, 2018]
Output: both

Coordinates-input: [5,4,2, 3,4,0, 1,4,2, 9,4,4]
Years-input: [2020, 1991, 2014, 2017, 2019, 1850]
Output: neither









share|improve this question























  • What range of years do we need to be able to handle?
    – Shaggy
    30 mins ago











  • @Shaggy I will add it to the challenge description. [0,9999] is fine (and [-9999,9999] for the coordinates is fine as well.
    – Kevin Cruijssen
    30 mins ago











  • Dang, there goes one of my ideas!
    – Shaggy
    25 mins ago










  • @Shaggy Out of curiosity, what range were you hoping for?
    – Kevin Cruijssen
    13 mins ago










  • One where no year was divisible by any other, that's how I was testing for the presence of the current year.
    – Shaggy
    11 mins ago












up vote
4
down vote

favorite









up vote
4
down vote

favorite











Introduction:



In general we usually speak of four dimensions: three space dimensions for x, y, and z; and one time dimension. For the sake of this challenge however, we'll split the time dimension into three as well: past, present, and future.



Input:



Two input-lists. One containing integer x,y,z coordinates, and one containing integer years.



Output:



One of any four distinct and constant outputs of your own choice. One to indicate the output space; one to indicate the output time; one to indicate the output both space and time; and one to indicate the output neither space nor time.



We'll indicate we went to all three space dimensions if the differences of the integer-tuples is not 0 for all three dimensions.

We'll indicate we went to all three time dimensions if there is at least one year in the past, at least one year in the future, and at least one year equal to the current year (so in the present).



Example:



Input:

Coordinates-list: [5,7,2, 5,3,8, -6,3,8, 5,7,2]

Year-list: [2039, 2019, 2018, 2039, 2222]



Output:

Constant for space



Why?

The x coordinates are [5,5,-6,5]. Since they are not all the same, we've went through the x space dimension.

The y coordinates are [7,3,3,7]. Since they are not all the same, we've also went through the y space dimension.

The z coordinates are [2,8,8,2]. Since they are not all the same, we've also went through the z space dimension.

The current year is 2018. There are no years before this, so we did not visit the past time dimension.

There is a 2018 present in the year-list, so we did visit the present time dimension.

There are multiple years above 2018 ([2039, 2019, 2039, 2222]), so we also visited the future time dimension.



Since we've visited all three space dimensions, but only two of the three time dimensions, the output will only be (the constant for) space.



Challenge rules:



  • You can use any four distinct and constant outputs for the four possible states.

  • Input can be in any reasonable format. Coordinates list can be tuples, inner lists/arrays of size 3, strings, objects, etc. List of years may be a list of date-objects instead of integers as well if it would benefit your byte-count.

  • You can assume the x,y,z coordinates will be integers, so no need to handle floating point decimals. Any of the x, y, and/or z coordinates can be negative values, though.

  • You cannot take the input-lists pre-ordered. The input-lists should be in the order displayed in the test cases.

  • You can assume all year values will be in the range [0,9999]; and you can assume all coordinates are in the range [-9999,9999].

General rules:



  • This is code-golf, so shortest answer in bytes wins.

    Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.


  • Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.


  • Default Loopholes are forbidden.

  • If possible, please add a link with a test for your code (i.e. TIO).

  • Also, adding an explanation for your answer is highly recommended.

Test cases:



Coordinates-input: [5,7,2, 5,3,8, -6,3,8, 5,7,2]
Years-input: [2039, 2019, 2018, 2039, 2222]
Output: space

Coordinates-input: [0,0,0, -4,-4,0, -4,2,0]
Years-input: [2016, 2019, 2018, 2000]
Output: time

Coordinates-input: [-2,-2,-2, -3,-3,-3]
Years-input: [2020, 1991, 2014, 2018]
Output: both

Coordinates-input: [5,4,2, 3,4,0, 1,4,2, 9,4,4]
Years-input: [2020, 1991, 2014, 2017, 2019, 1850]
Output: neither









share|improve this question















Introduction:



In general we usually speak of four dimensions: three space dimensions for x, y, and z; and one time dimension. For the sake of this challenge however, we'll split the time dimension into three as well: past, present, and future.



Input:



Two input-lists. One containing integer x,y,z coordinates, and one containing integer years.



Output:



One of any four distinct and constant outputs of your own choice. One to indicate the output space; one to indicate the output time; one to indicate the output both space and time; and one to indicate the output neither space nor time.



We'll indicate we went to all three space dimensions if the differences of the integer-tuples is not 0 for all three dimensions.

We'll indicate we went to all three time dimensions if there is at least one year in the past, at least one year in the future, and at least one year equal to the current year (so in the present).



Example:



Input:

Coordinates-list: [5,7,2, 5,3,8, -6,3,8, 5,7,2]

Year-list: [2039, 2019, 2018, 2039, 2222]



Output:

Constant for space



Why?

The x coordinates are [5,5,-6,5]. Since they are not all the same, we've went through the x space dimension.

The y coordinates are [7,3,3,7]. Since they are not all the same, we've also went through the y space dimension.

The z coordinates are [2,8,8,2]. Since they are not all the same, we've also went through the z space dimension.

The current year is 2018. There are no years before this, so we did not visit the past time dimension.

There is a 2018 present in the year-list, so we did visit the present time dimension.

There are multiple years above 2018 ([2039, 2019, 2039, 2222]), so we also visited the future time dimension.



Since we've visited all three space dimensions, but only two of the three time dimensions, the output will only be (the constant for) space.



Challenge rules:



  • You can use any four distinct and constant outputs for the four possible states.

  • Input can be in any reasonable format. Coordinates list can be tuples, inner lists/arrays of size 3, strings, objects, etc. List of years may be a list of date-objects instead of integers as well if it would benefit your byte-count.

  • You can assume the x,y,z coordinates will be integers, so no need to handle floating point decimals. Any of the x, y, and/or z coordinates can be negative values, though.

  • You cannot take the input-lists pre-ordered. The input-lists should be in the order displayed in the test cases.

  • You can assume all year values will be in the range [0,9999]; and you can assume all coordinates are in the range [-9999,9999].

General rules:



  • This is code-golf, so shortest answer in bytes wins.

    Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.


  • Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.


  • Default Loopholes are forbidden.

  • If possible, please add a link with a test for your code (i.e. TIO).

  • Also, adding an explanation for your answer is highly recommended.

Test cases:



Coordinates-input: [5,7,2, 5,3,8, -6,3,8, 5,7,2]
Years-input: [2039, 2019, 2018, 2039, 2222]
Output: space

Coordinates-input: [0,0,0, -4,-4,0, -4,2,0]
Years-input: [2016, 2019, 2018, 2000]
Output: time

Coordinates-input: [-2,-2,-2, -3,-3,-3]
Years-input: [2020, 1991, 2014, 2018]
Output: both

Coordinates-input: [5,4,2, 3,4,0, 1,4,2, 9,4,4]
Years-input: [2020, 1991, 2014, 2017, 2019, 1850]
Output: neither






code-golf number integer date






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 29 mins ago

























asked 1 hour ago









Kevin Cruijssen

33.1k554176




33.1k554176











  • What range of years do we need to be able to handle?
    – Shaggy
    30 mins ago











  • @Shaggy I will add it to the challenge description. [0,9999] is fine (and [-9999,9999] for the coordinates is fine as well.
    – Kevin Cruijssen
    30 mins ago











  • Dang, there goes one of my ideas!
    – Shaggy
    25 mins ago










  • @Shaggy Out of curiosity, what range were you hoping for?
    – Kevin Cruijssen
    13 mins ago










  • One where no year was divisible by any other, that's how I was testing for the presence of the current year.
    – Shaggy
    11 mins ago
















  • What range of years do we need to be able to handle?
    – Shaggy
    30 mins ago











  • @Shaggy I will add it to the challenge description. [0,9999] is fine (and [-9999,9999] for the coordinates is fine as well.
    – Kevin Cruijssen
    30 mins ago











  • Dang, there goes one of my ideas!
    – Shaggy
    25 mins ago










  • @Shaggy Out of curiosity, what range were you hoping for?
    – Kevin Cruijssen
    13 mins ago










  • One where no year was divisible by any other, that's how I was testing for the presence of the current year.
    – Shaggy
    11 mins ago















What range of years do we need to be able to handle?
– Shaggy
30 mins ago





What range of years do we need to be able to handle?
– Shaggy
30 mins ago













@Shaggy I will add it to the challenge description. [0,9999] is fine (and [-9999,9999] for the coordinates is fine as well.
– Kevin Cruijssen
30 mins ago





@Shaggy I will add it to the challenge description. [0,9999] is fine (and [-9999,9999] for the coordinates is fine as well.
– Kevin Cruijssen
30 mins ago













Dang, there goes one of my ideas!
– Shaggy
25 mins ago




Dang, there goes one of my ideas!
– Shaggy
25 mins ago












@Shaggy Out of curiosity, what range were you hoping for?
– Kevin Cruijssen
13 mins ago




@Shaggy Out of curiosity, what range were you hoping for?
– Kevin Cruijssen
13 mins ago












One where no year was divisible by any other, that's how I was testing for the presence of the current year.
– Shaggy
11 mins ago




One where no year was divisible by any other, that's how I was testing for the presence of the current year.
– Shaggy
11 mins ago










5 Answers
5






active

oldest

votes

















up vote
2
down vote














Python 2, 111 109 bytes





lambda S,T:(min(map(len,map(set,zip(*S))))>1,date.today().year in sorted(set(T))[1:-1])
from datetime import*


Try it online!






share|improve this answer






















  • Why do you make T a set before sorting?
    – Black Owl Kai
    7 mins ago

















up vote
2
down vote














Perl 6, 47 bytes





Set(@^b X<=>Date.today.year)>2,!any [Z==] @^a


Try it online!



Anonymous code block that takes two lists and returns a tuple of booleans, with the first element being whether you traveled in time, and the second being whether you traveled in space.



Explanation



 # Anonymous code block
@^b X # Map each element of the year list to:
<=> # Whether it is smaller, equal or larger than
Date.today.year # The current year
Set( ) # Get the unique values
>2 # Is the length larger than 2?
,
[Z ] @^a # Reduce by zipping the lists together
!any # And return if none of them are
== # All equal





share|improve this answer





























    up vote
    1
    down vote













    Japt, 22 bytes



    Takes input as a 2D-array of integers for the space dimensions and a 1D-array of integers for the years. Outputs 2 for space only, 1 for time only, 3 for both and 0 for neither.



    yâ e_ÊÉÃÑ+!Jõ kVmgKi¹Ê


    Try it





    share



























      up vote
      1
      down vote













      JavaScript (ES6), 112 bytes



      Takes input as (space)(time). Returns $1$ for time, $2$ for space, $3$ for both or $0$ for neither.





      s=>t=>2*s.some(a=>a.every((x,i)=>s.some(b=>x-b[i])))|t.map(y=>s|=1<<-~Math.sign((new Date).getFullYear()-y))|s>6


      Try it online!





      share



























        up vote
        1
        down vote














        Japt, 25 bytes



        I'm 100% sure this is not the best approach, still looking for some shorter way to do this :c



        Returns a tuple of booleans. The first is if you traveled in space and the second if you traveled in time



        [Uyâ e_ʦ1ÃV®-Ki)gÃâ Ê¥3]



        [Uyâ e_ʦ1ÃV®-Ki)gÃâ Ê¥3] Full Program, U = Space, V = Time
        -- U = [[-2,-2,-2], [-3,-3,-3]]
        -- V = [2020, 1991, 2014, 2018]
        [ ] Return array containing....
        Uyâ Transpose Space coords
        -- U = [[-2,-3], [-2,-3], [-2,-3]]
        and map Z
        _ʦ1 Z length greater than 1?
        -- U = [1, 1, 1]
        e return true if all Z are true
        -- U = true
        V® Map each time
        -Ki) Subtract current year
        -- V = [2,-27,-4,0]
        gà get sign (-1,0,1)
        -- V = [1,-1,-1,0]
        â unique elements
        -- V = [1,-1,0]
        ʥ3 return true if length == 3
        -- V = true


        Try it online!






        share|improve this answer






















          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',
          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%2f175592%2fthrough-space-and-time%23new-answer', 'question_page');

          );

          Post as a guest






























          5 Answers
          5






          active

          oldest

          votes








          5 Answers
          5






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          2
          down vote














          Python 2, 111 109 bytes





          lambda S,T:(min(map(len,map(set,zip(*S))))>1,date.today().year in sorted(set(T))[1:-1])
          from datetime import*


          Try it online!






          share|improve this answer






















          • Why do you make T a set before sorting?
            – Black Owl Kai
            7 mins ago














          up vote
          2
          down vote














          Python 2, 111 109 bytes





          lambda S,T:(min(map(len,map(set,zip(*S))))>1,date.today().year in sorted(set(T))[1:-1])
          from datetime import*


          Try it online!






          share|improve this answer






















          • Why do you make T a set before sorting?
            – Black Owl Kai
            7 mins ago












          up vote
          2
          down vote










          up vote
          2
          down vote










          Python 2, 111 109 bytes





          lambda S,T:(min(map(len,map(set,zip(*S))))>1,date.today().year in sorted(set(T))[1:-1])
          from datetime import*


          Try it online!






          share|improve this answer















          Python 2, 111 109 bytes





          lambda S,T:(min(map(len,map(set,zip(*S))))>1,date.today().year in sorted(set(T))[1:-1])
          from datetime import*


          Try it online!







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 1 hour ago

























          answered 1 hour ago









          TFeld

          13.2k2939




          13.2k2939











          • Why do you make T a set before sorting?
            – Black Owl Kai
            7 mins ago
















          • Why do you make T a set before sorting?
            – Black Owl Kai
            7 mins ago















          Why do you make T a set before sorting?
          – Black Owl Kai
          7 mins ago




          Why do you make T a set before sorting?
          – Black Owl Kai
          7 mins ago










          up vote
          2
          down vote














          Perl 6, 47 bytes





          Set(@^b X<=>Date.today.year)>2,!any [Z==] @^a


          Try it online!



          Anonymous code block that takes two lists and returns a tuple of booleans, with the first element being whether you traveled in time, and the second being whether you traveled in space.



          Explanation



           # Anonymous code block
          @^b X # Map each element of the year list to:
          <=> # Whether it is smaller, equal or larger than
          Date.today.year # The current year
          Set( ) # Get the unique values
          >2 # Is the length larger than 2?
          ,
          [Z ] @^a # Reduce by zipping the lists together
          !any # And return if none of them are
          == # All equal





          share|improve this answer


























            up vote
            2
            down vote














            Perl 6, 47 bytes





            Set(@^b X<=>Date.today.year)>2,!any [Z==] @^a


            Try it online!



            Anonymous code block that takes two lists and returns a tuple of booleans, with the first element being whether you traveled in time, and the second being whether you traveled in space.



            Explanation



             # Anonymous code block
            @^b X # Map each element of the year list to:
            <=> # Whether it is smaller, equal or larger than
            Date.today.year # The current year
            Set( ) # Get the unique values
            >2 # Is the length larger than 2?
            ,
            [Z ] @^a # Reduce by zipping the lists together
            !any # And return if none of them are
            == # All equal





            share|improve this answer
























              up vote
              2
              down vote










              up vote
              2
              down vote










              Perl 6, 47 bytes





              Set(@^b X<=>Date.today.year)>2,!any [Z==] @^a


              Try it online!



              Anonymous code block that takes two lists and returns a tuple of booleans, with the first element being whether you traveled in time, and the second being whether you traveled in space.



              Explanation



               # Anonymous code block
              @^b X # Map each element of the year list to:
              <=> # Whether it is smaller, equal or larger than
              Date.today.year # The current year
              Set( ) # Get the unique values
              >2 # Is the length larger than 2?
              ,
              [Z ] @^a # Reduce by zipping the lists together
              !any # And return if none of them are
              == # All equal





              share|improve this answer















              Perl 6, 47 bytes





              Set(@^b X<=>Date.today.year)>2,!any [Z==] @^a


              Try it online!



              Anonymous code block that takes two lists and returns a tuple of booleans, with the first element being whether you traveled in time, and the second being whether you traveled in space.



              Explanation



               # Anonymous code block
              @^b X # Map each element of the year list to:
              <=> # Whether it is smaller, equal or larger than
              Date.today.year # The current year
              Set( ) # Get the unique values
              >2 # Is the length larger than 2?
              ,
              [Z ] @^a # Reduce by zipping the lists together
              !any # And return if none of them are
              == # All equal






              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited 58 mins ago

























              answered 1 hour ago









              Jo King

              18.6k241101




              18.6k241101




















                  up vote
                  1
                  down vote













                  Japt, 22 bytes



                  Takes input as a 2D-array of integers for the space dimensions and a 1D-array of integers for the years. Outputs 2 for space only, 1 for time only, 3 for both and 0 for neither.



                  yâ e_ÊÉÃÑ+!Jõ kVmgKi¹Ê


                  Try it





                  share
























                    up vote
                    1
                    down vote













                    Japt, 22 bytes



                    Takes input as a 2D-array of integers for the space dimensions and a 1D-array of integers for the years. Outputs 2 for space only, 1 for time only, 3 for both and 0 for neither.



                    yâ e_ÊÉÃÑ+!Jõ kVmgKi¹Ê


                    Try it





                    share






















                      up vote
                      1
                      down vote










                      up vote
                      1
                      down vote









                      Japt, 22 bytes



                      Takes input as a 2D-array of integers for the space dimensions and a 1D-array of integers for the years. Outputs 2 for space only, 1 for time only, 3 for both and 0 for neither.



                      yâ e_ÊÉÃÑ+!Jõ kVmgKi¹Ê


                      Try it





                      share












                      Japt, 22 bytes



                      Takes input as a 2D-array of integers for the space dimensions and a 1D-array of integers for the years. Outputs 2 for space only, 1 for time only, 3 for both and 0 for neither.



                      yâ e_ÊÉÃÑ+!Jõ kVmgKi¹Ê


                      Try it






                      share











                      share


                      share










                      answered 9 mins ago









                      Shaggy

                      17.8k21663




                      17.8k21663




















                          up vote
                          1
                          down vote













                          JavaScript (ES6), 112 bytes



                          Takes input as (space)(time). Returns $1$ for time, $2$ for space, $3$ for both or $0$ for neither.





                          s=>t=>2*s.some(a=>a.every((x,i)=>s.some(b=>x-b[i])))|t.map(y=>s|=1<<-~Math.sign((new Date).getFullYear()-y))|s>6


                          Try it online!





                          share
























                            up vote
                            1
                            down vote













                            JavaScript (ES6), 112 bytes



                            Takes input as (space)(time). Returns $1$ for time, $2$ for space, $3$ for both or $0$ for neither.





                            s=>t=>2*s.some(a=>a.every((x,i)=>s.some(b=>x-b[i])))|t.map(y=>s|=1<<-~Math.sign((new Date).getFullYear()-y))|s>6


                            Try it online!





                            share






















                              up vote
                              1
                              down vote










                              up vote
                              1
                              down vote









                              JavaScript (ES6), 112 bytes



                              Takes input as (space)(time). Returns $1$ for time, $2$ for space, $3$ for both or $0$ for neither.





                              s=>t=>2*s.some(a=>a.every((x,i)=>s.some(b=>x-b[i])))|t.map(y=>s|=1<<-~Math.sign((new Date).getFullYear()-y))|s>6


                              Try it online!





                              share












                              JavaScript (ES6), 112 bytes



                              Takes input as (space)(time). Returns $1$ for time, $2$ for space, $3$ for both or $0$ for neither.





                              s=>t=>2*s.some(a=>a.every((x,i)=>s.some(b=>x-b[i])))|t.map(y=>s|=1<<-~Math.sign((new Date).getFullYear()-y))|s>6


                              Try it online!






                              share











                              share


                              share










                              answered 8 mins ago









                              Arnauld

                              67.9k584288




                              67.9k584288




















                                  up vote
                                  1
                                  down vote














                                  Japt, 25 bytes



                                  I'm 100% sure this is not the best approach, still looking for some shorter way to do this :c



                                  Returns a tuple of booleans. The first is if you traveled in space and the second if you traveled in time



                                  [Uyâ e_ʦ1ÃV®-Ki)gÃâ Ê¥3]



                                  [Uyâ e_ʦ1ÃV®-Ki)gÃâ Ê¥3] Full Program, U = Space, V = Time
                                  -- U = [[-2,-2,-2], [-3,-3,-3]]
                                  -- V = [2020, 1991, 2014, 2018]
                                  [ ] Return array containing....
                                  Uyâ Transpose Space coords
                                  -- U = [[-2,-3], [-2,-3], [-2,-3]]
                                  and map Z
                                  _ʦ1 Z length greater than 1?
                                  -- U = [1, 1, 1]
                                  e return true if all Z are true
                                  -- U = true
                                  V® Map each time
                                  -Ki) Subtract current year
                                  -- V = [2,-27,-4,0]
                                  gà get sign (-1,0,1)
                                  -- V = [1,-1,-1,0]
                                  â unique elements
                                  -- V = [1,-1,0]
                                  ʥ3 return true if length == 3
                                  -- V = true


                                  Try it online!






                                  share|improve this answer


























                                    up vote
                                    1
                                    down vote














                                    Japt, 25 bytes



                                    I'm 100% sure this is not the best approach, still looking for some shorter way to do this :c



                                    Returns a tuple of booleans. The first is if you traveled in space and the second if you traveled in time



                                    [Uyâ e_ʦ1ÃV®-Ki)gÃâ Ê¥3]



                                    [Uyâ e_ʦ1ÃV®-Ki)gÃâ Ê¥3] Full Program, U = Space, V = Time
                                    -- U = [[-2,-2,-2], [-3,-3,-3]]
                                    -- V = [2020, 1991, 2014, 2018]
                                    [ ] Return array containing....
                                    Uyâ Transpose Space coords
                                    -- U = [[-2,-3], [-2,-3], [-2,-3]]
                                    and map Z
                                    _ʦ1 Z length greater than 1?
                                    -- U = [1, 1, 1]
                                    e return true if all Z are true
                                    -- U = true
                                    V® Map each time
                                    -Ki) Subtract current year
                                    -- V = [2,-27,-4,0]
                                    gà get sign (-1,0,1)
                                    -- V = [1,-1,-1,0]
                                    â unique elements
                                    -- V = [1,-1,0]
                                    ʥ3 return true if length == 3
                                    -- V = true


                                    Try it online!






                                    share|improve this answer
























                                      up vote
                                      1
                                      down vote










                                      up vote
                                      1
                                      down vote










                                      Japt, 25 bytes



                                      I'm 100% sure this is not the best approach, still looking for some shorter way to do this :c



                                      Returns a tuple of booleans. The first is if you traveled in space and the second if you traveled in time



                                      [Uyâ e_ʦ1ÃV®-Ki)gÃâ Ê¥3]



                                      [Uyâ e_ʦ1ÃV®-Ki)gÃâ Ê¥3] Full Program, U = Space, V = Time
                                      -- U = [[-2,-2,-2], [-3,-3,-3]]
                                      -- V = [2020, 1991, 2014, 2018]
                                      [ ] Return array containing....
                                      Uyâ Transpose Space coords
                                      -- U = [[-2,-3], [-2,-3], [-2,-3]]
                                      and map Z
                                      _ʦ1 Z length greater than 1?
                                      -- U = [1, 1, 1]
                                      e return true if all Z are true
                                      -- U = true
                                      V® Map each time
                                      -Ki) Subtract current year
                                      -- V = [2,-27,-4,0]
                                      gà get sign (-1,0,1)
                                      -- V = [1,-1,-1,0]
                                      â unique elements
                                      -- V = [1,-1,0]
                                      ʥ3 return true if length == 3
                                      -- V = true


                                      Try it online!






                                      share|improve this answer















                                      Japt, 25 bytes



                                      I'm 100% sure this is not the best approach, still looking for some shorter way to do this :c



                                      Returns a tuple of booleans. The first is if you traveled in space and the second if you traveled in time



                                      [Uyâ e_ʦ1ÃV®-Ki)gÃâ Ê¥3]



                                      [Uyâ e_ʦ1ÃV®-Ki)gÃâ Ê¥3] Full Program, U = Space, V = Time
                                      -- U = [[-2,-2,-2], [-3,-3,-3]]
                                      -- V = [2020, 1991, 2014, 2018]
                                      [ ] Return array containing....
                                      Uyâ Transpose Space coords
                                      -- U = [[-2,-3], [-2,-3], [-2,-3]]
                                      and map Z
                                      _ʦ1 Z length greater than 1?
                                      -- U = [1, 1, 1]
                                      e return true if all Z are true
                                      -- U = true
                                      V® Map each time
                                      -Ki) Subtract current year
                                      -- V = [2,-27,-4,0]
                                      gà get sign (-1,0,1)
                                      -- V = [1,-1,-1,0]
                                      â unique elements
                                      -- V = [1,-1,0]
                                      ʥ3 return true if length == 3
                                      -- V = true


                                      Try it online!







                                      share|improve this answer














                                      share|improve this answer



                                      share|improve this answer








                                      edited 7 mins ago

























                                      answered 31 mins ago









                                      Luis felipe De jesus Munoz

                                      3,63211051




                                      3,63211051



























                                           

                                          draft saved


                                          draft discarded















































                                           


                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function ()
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f175592%2fthrough-space-and-time%23new-answer', 'question_page');

                                          );

                                          Post as a guest













































































                                          Comments

                                          Popular posts from this blog

                                          What does second last employer means? [closed]

                                          List of Gilmore Girls characters

                                          Confectionery