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 thex
,y
, and/orz
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]
. - If your language doesn't have ANY way to retrieve the current year, but you'd still like to do this challenge, you may take it as additional input and mark your answer as (non-competing).
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
[0,9999]
is fine (and[-9999,9999]
for the coordinates is fine as well. \$\endgroup\$