Skip to main content
deleted 3 characters in body
Source Link
Jonah
  • 33.8k
  • 4
  • 40
  • 94

J, 39 3839 38 37 bytes

(' ',|.){~[:(>.*=+.*e1=<.,)"0/~|@i:&~#\.<:@#,1}.#\

Try it online!Try it online!

Consider over:

First imagine a table of coordinates like:

┌───┬───┬───┬───┬───┬───┬───┐
│4 4│4 3│4 2│4 1│4 2│4 3│4 4│
├───┼───┼───┼───┼───┼───┼───┤
│3 4│3 3│3 2│3 1│3 2│3 3│3 4│
├───┼───┼───┼───┼───┼───┼───┤
│2 4│2 3│2 2│2 1│2 2│2 3│2 4│
├───┼───┼───┼───┼───┼───┼───┤
│1 4│1 3│1 2│1 1│1 2│1 3│1 4│
├───┼───┼───┼───┼───┼───┼───┤
│2 4│2 3│2 2│2 1│2 2│2 3│2 4│
├───┼───┼───┼───┼───┼───┼───┤
│3 4│3 3│3 2│3 1│3 2│3 3│3 4│
├───┼───┼───┼───┼───┼───┼───┤
│4 4│4 3│4 2│4 1│4 2│4 3│4 4│
└───┴───┴───┴───┴───┴───┴───┘

For each element, ask "Are they equal or does either equal one" =+.*e.,? The answer will be 1 if true, 0 otherwise. Multiply that answer by the max of the two numbers >.*:

4 0 0 4 0 0 4
0 3 0 3 0 3 0
0 0 2 2 2 0 0
4 3 2 1 2 3 4
0 0 2 2 2 0 0
0 3 0 3 0 3 0
4 0 0 4 0 0 4

Now just index into the original input, reversed, with a space prepended (' ',|.){~:

o  o  o
 v v v 
  eee  
overevo
  eee  
 v v v 
o  o  o

J, 39 38 bytes

(' ',|.){~[:(>.*=+.*e.,)"0/~|@i:&.<:@#

Try it online!

Consider over:

First imagine a table of coordinates like:

┌───┬───┬───┬───┬───┬───┬───┐
│4 4│4 3│4 2│4 1│4 2│4 3│4 4│
├───┼───┼───┼───┼───┼───┼───┤
│3 4│3 3│3 2│3 1│3 2│3 3│3 4│
├───┼───┼───┼───┼───┼───┼───┤
│2 4│2 3│2 2│2 1│2 2│2 3│2 4│
├───┼───┼───┼───┼───┼───┼───┤
│1 4│1 3│1 2│1 1│1 2│1 3│1 4│
├───┼───┼───┼───┼───┼───┼───┤
│2 4│2 3│2 2│2 1│2 2│2 3│2 4│
├───┼───┼───┼───┼───┼───┼───┤
│3 4│3 3│3 2│3 1│3 2│3 3│3 4│
├───┼───┼───┼───┼───┼───┼───┤
│4 4│4 3│4 2│4 1│4 2│4 3│4 4│
└───┴───┴───┴───┴───┴───┴───┘

For each element, ask "Are they equal or does either equal one" =+.*e.,? The answer will be 1 if true, 0 otherwise. Multiply that answer by the max of the two numbers >.*:

4 0 0 4 0 0 4
0 3 0 3 0 3 0
0 0 2 2 2 0 0
4 3 2 1 2 3 4
0 0 2 2 2 0 0
0 3 0 3 0 3 0
4 0 0 4 0 0 4

Now just index into the original input, reversed, with a space prepended (' ',|.){~:

o  o  o
 v v v 
  eee  
overevo
  eee  
 v v v 
o  o  o

J, 39 38 37 bytes

(' ',|.){~[:(>.*=+.1=<.)"0/~#\.,1}.#\

Try it online!

Consider over:

First imagine a table of coordinates like:

┌───┬───┬───┬───┬───┬───┬───┐
│4 4│4 3│4 2│4 1│4 2│4 3│4 4│
├───┼───┼───┼───┼───┼───┼───┤
│3 4│3 3│3 2│3 1│3 2│3 3│3 4│
├───┼───┼───┼───┼───┼───┼───┤
│2 4│2 3│2 2│2 1│2 2│2 3│2 4│
├───┼───┼───┼───┼───┼───┼───┤
│1 4│1 3│1 2│1 1│1 2│1 3│1 4│
├───┼───┼───┼───┼───┼───┼───┤
│2 4│2 3│2 2│2 1│2 2│2 3│2 4│
├───┼───┼───┼───┼───┼───┼───┤
│3 4│3 3│3 2│3 1│3 2│3 3│3 4│
├───┼───┼───┼───┼───┼───┼───┤
│4 4│4 3│4 2│4 1│4 2│4 3│4 4│
└───┴───┴───┴───┴───┴───┴───┘

For each element, ask "Are they equal or does either equal one" =+.*e.,? The answer will be 1 if true, 0 otherwise. Multiply that answer by the max of the two numbers >.*:

4 0 0 4 0 0 4
0 3 0 3 0 3 0
0 0 2 2 2 0 0
4 3 2 1 2 3 4
0 0 2 2 2 0 0
0 3 0 3 0 3 0
4 0 0 4 0 0 4

Now just index into the original input, reversed, with a space prepended (' ',|.){~:

o  o  o
 v v v 
  eee  
overevo
  eee  
 v v v 
o  o  o
added 1 character in body
Source Link
Jonah
  • 33.8k
  • 4
  • 40
  • 94

J, 39 38 bytes

(' ',|.){~[:(>.*=+.*e.,)"0/~|@i:&.<:@#

Try it online!

Consider over:

First imagine a table of coordinates like:

┌───┬───┬───┬───┬───┬───┬───┐
│4 4│4 3│4 2│4 1│4 2│4 3│4 4│
├───┼───┼───┼───┼───┼───┼───┤
│3 4│3 3│3 2│3 1│3 2│3 3│3 4│
├───┼───┼───┼───┼───┼───┼───┤
│2 4│2 3│2 2│2 1│2 2│2 3│2 4│
├───┼───┼───┼───┼───┼───┼───┤
│1 4│1 3│1 2│1 1│1 2│1 3│1 4│
├───┼───┼───┼───┼───┼───┼───┤
│2 4│2 3│2 2│2 1│2 2│2 3│2 4│
├───┼───┼───┼───┼───┼───┼───┤
│3 4│3 3│3 2│3 1│3 2│3 3│3 4│
├───┼───┼───┼───┼───┼───┼───┤
│4 4│4 3│4 2│4 1│4 2│4 3│4 4│
└───┴───┴───┴───┴───┴───┴───┘

For each element, ask "Are they equal or does either equal one" =+.*e.,? The answer will be 1 if true, 0 otherwise. Multiply that answer by the max of the two numbers >.*:

4 0 0 4 0 0 4
0 3 0 3 0 3 0
0 0 2 2 2 0 0
4 3 2 1 2 3 4
0 0 2 2 2 0 0
0 3 0 3 0 3 0
4 0 0 4 0 0 4

Now just index into the original input, reversed, with a space appendedprepended (' ',|.){~:

o  o  o
 v v v 
  eee  
overevo
  eee  
 v v v 
o  o  o

J, 39 38 bytes

(' ',|.){~[:(>.*=+.*e.,)"0/~|@i:&.<:@#

Try it online!

Consider over:

First imagine a table of coordinates like:

┌───┬───┬───┬───┬───┬───┬───┐
│4 4│4 3│4 2│4 1│4 2│4 3│4 4│
├───┼───┼───┼───┼───┼───┼───┤
│3 4│3 3│3 2│3 1│3 2│3 3│3 4│
├───┼───┼───┼───┼───┼───┼───┤
│2 4│2 3│2 2│2 1│2 2│2 3│2 4│
├───┼───┼───┼───┼───┼───┼───┤
│1 4│1 3│1 2│1 1│1 2│1 3│1 4│
├───┼───┼───┼───┼───┼───┼───┤
│2 4│2 3│2 2│2 1│2 2│2 3│2 4│
├───┼───┼───┼───┼───┼───┼───┤
│3 4│3 3│3 2│3 1│3 2│3 3│3 4│
├───┼───┼───┼───┼───┼───┼───┤
│4 4│4 3│4 2│4 1│4 2│4 3│4 4│
└───┴───┴───┴───┴───┴───┴───┘

For each element, ask "Are they equal or does either equal one" =+.*e.,? The answer will be 1 if true, 0 otherwise. Multiply that answer by the max of the two numbers >.*:

4 0 0 4 0 0 4
0 3 0 3 0 3 0
0 0 2 2 2 0 0
4 3 2 1 2 3 4
0 0 2 2 2 0 0
0 3 0 3 0 3 0
4 0 0 4 0 0 4

Now just index into the original input, reversed, with a space appended (' ',|.){~:

o  o  o
 v v v 
  eee  
overevo
  eee  
 v v v 
o  o  o

J, 39 38 bytes

(' ',|.){~[:(>.*=+.*e.,)"0/~|@i:&.<:@#

Try it online!

Consider over:

First imagine a table of coordinates like:

┌───┬───┬───┬───┬───┬───┬───┐
│4 4│4 3│4 2│4 1│4 2│4 3│4 4│
├───┼───┼───┼───┼───┼───┼───┤
│3 4│3 3│3 2│3 1│3 2│3 3│3 4│
├───┼───┼───┼───┼───┼───┼───┤
│2 4│2 3│2 2│2 1│2 2│2 3│2 4│
├───┼───┼───┼───┼───┼───┼───┤
│1 4│1 3│1 2│1 1│1 2│1 3│1 4│
├───┼───┼───┼───┼───┼───┼───┤
│2 4│2 3│2 2│2 1│2 2│2 3│2 4│
├───┼───┼───┼───┼───┼───┼───┤
│3 4│3 3│3 2│3 1│3 2│3 3│3 4│
├───┼───┼───┼───┼───┼───┼───┤
│4 4│4 3│4 2│4 1│4 2│4 3│4 4│
└───┴───┴───┴───┴───┴───┴───┘

For each element, ask "Are they equal or does either equal one" =+.*e.,? The answer will be 1 if true, 0 otherwise. Multiply that answer by the max of the two numbers >.*:

4 0 0 4 0 0 4
0 3 0 3 0 3 0
0 0 2 2 2 0 0
4 3 2 1 2 3 4
0 0 2 2 2 0 0
0 3 0 3 0 3 0
4 0 0 4 0 0 4

Now just index into the original input, reversed, with a space prepended (' ',|.){~:

o  o  o
 v v v 
  eee  
overevo
  eee  
 v v v 
o  o  o
added 5 characters in body
Source Link
Jonah
  • 33.8k
  • 4
  • 40
  • 94

J, 3939 38 bytes

(' ',|.){~[:(>.*=+.1 e*e.,)"0/~|@i:&.<:@#

Try it online!Try it online!

Consider over:

First imagine a table of coordinates like:

┌───┬───┬───┬───┬───┬───┬───┐
│4 4│4 3│4 2│4 1│4 2│4 3│4 4│
├───┼───┼───┼───┼───┼───┼───┤
│3 4│3 3│3 2│3 1│3 2│3 3│3 4│
├───┼───┼───┼───┼───┼───┼───┤
│2 4│2 3│2 2│2 1│2 2│2 3│2 4│
├───┼───┼───┼───┼───┼───┼───┤
│1 4│1 3│1 2│1 1│1 2│1 3│1 4│
├───┼───┼───┼───┼───┼───┼───┤
│2 4│2 3│2 2│2 1│2 2│2 3│2 4│
├───┼───┼───┼───┼───┼───┼───┤
│3 4│3 3│3 2│3 1│3 2│3 3│3 4│
├───┼───┼───┼───┼───┼───┼───┤
│4 4│4 3│4 2│4 1│4 2│4 3│4 4│
└───┴───┴───┴───┴───┴───┴───┘

For each element, ask "Are they equal or does either equal one" =+.1 e*e.,? The answer will be 1 if true, 0 otherwise. Multiply that answer by the max of the two numbers >.*:

4 0 0 4 0 0 4
0 3 0 3 0 3 0
0 0 2 2 2 0 0
4 3 2 1 2 3 4
0 0 2 2 2 0 0
0 3 0 3 0 3 0
4 0 0 4 0 0 4

Now just index into the original input, reversed, with a space appended (' ',|.){~:

o  o  o
 v v v 
  eee  
overevo
  eee  
 v v v 
o  o  o

J, 39 bytes

(' ',|.){~[:(>.*=+.1 e.,)"0/~|@i:&.<:@#

Try it online!

Consider over:

First imagine a table of coordinates like:

┌───┬───┬───┬───┬───┬───┬───┐
│4 4│4 3│4 2│4 1│4 2│4 3│4 4│
├───┼───┼───┼───┼───┼───┼───┤
│3 4│3 3│3 2│3 1│3 2│3 3│3 4│
├───┼───┼───┼───┼───┼───┼───┤
│2 4│2 3│2 2│2 1│2 2│2 3│2 4│
├───┼───┼───┼───┼───┼───┼───┤
│1 4│1 3│1 2│1 1│1 2│1 3│1 4│
├───┼───┼───┼───┼───┼───┼───┤
│2 4│2 3│2 2│2 1│2 2│2 3│2 4│
├───┼───┼───┼───┼───┼───┼───┤
│3 4│3 3│3 2│3 1│3 2│3 3│3 4│
├───┼───┼───┼───┼───┼───┼───┤
│4 4│4 3│4 2│4 1│4 2│4 3│4 4│
└───┴───┴───┴───┴───┴───┴───┘

For each element, ask "Are they equal or does either equal one" =+.1 e.,? The answer will be 1 if true, 0 otherwise. Multiply that answer by the max of the two numbers >.*:

4 0 0 4 0 0 4
0 3 0 3 0 3 0
0 0 2 2 2 0 0
4 3 2 1 2 3 4
0 0 2 2 2 0 0
0 3 0 3 0 3 0
4 0 0 4 0 0 4

Now just index into the original input, reversed, with a space appended (' ',|.){~:

o  o  o
 v v v 
  eee  
overevo
  eee  
 v v v 
o  o  o

J, 39 38 bytes

(' ',|.){~[:(>.*=+.*e.,)"0/~|@i:&.<:@#

Try it online!

Consider over:

First imagine a table of coordinates like:

┌───┬───┬───┬───┬───┬───┬───┐
│4 4│4 3│4 2│4 1│4 2│4 3│4 4│
├───┼───┼───┼───┼───┼───┼───┤
│3 4│3 3│3 2│3 1│3 2│3 3│3 4│
├───┼───┼───┼───┼───┼───┼───┤
│2 4│2 3│2 2│2 1│2 2│2 3│2 4│
├───┼───┼───┼───┼───┼───┼───┤
│1 4│1 3│1 2│1 1│1 2│1 3│1 4│
├───┼───┼───┼───┼───┼───┼───┤
│2 4│2 3│2 2│2 1│2 2│2 3│2 4│
├───┼───┼───┼───┼───┼───┼───┤
│3 4│3 3│3 2│3 1│3 2│3 3│3 4│
├───┼───┼───┼───┼───┼───┼───┤
│4 4│4 3│4 2│4 1│4 2│4 3│4 4│
└───┴───┴───┴───┴───┴───┴───┘

For each element, ask "Are they equal or does either equal one" =+.*e.,? The answer will be 1 if true, 0 otherwise. Multiply that answer by the max of the two numbers >.*:

4 0 0 4 0 0 4
0 3 0 3 0 3 0
0 0 2 2 2 0 0
4 3 2 1 2 3 4
0 0 2 2 2 0 0
0 3 0 3 0 3 0
4 0 0 4 0 0 4

Now just index into the original input, reversed, with a space appended (' ',|.){~:

o  o  o
 v v v 
  eee  
overevo
  eee  
 v v v 
o  o  o
added 1092 characters in body
Source Link
Jonah
  • 33.8k
  • 4
  • 40
  • 94
Loading
Source Link
Jonah
  • 33.8k
  • 4
  • 40
  • 94
Loading