Skip to main content
Commonmark migration
Source Link

#Ruby, 98106#

Ruby, 98106

Fixed error spotted by Reto Koradi.

s=sprintf'%024b',342391 6.times{|i|t='15462315'[i,3];t+=t.reverse;t[1+i%2*3]='07'[i%2];s+=t} p s.split(//) 

Given that coordinates are required, the only corner numbering scheme that made sense seemed to be the one where each corner is the binary representation of its coordinates. That's quite different from the linked question, where various different numbering schemes were tried. In the end I decided to print the coordinates with a dirty hardcode: s is initialised to the string version of 24-bit number000001010011100101110111 whose decimal representation is 342391. Actually with this method of printing coordinates, the numbering of the vertices is flexible, so I may do another answer.

Going round the equator of the cube, we find the vertices 1,5,4,6,2,3 and we can define one triangle for each face from any 3 consecutive numbers on this list (wrapping back to the beginning at the end.) The other triangle on each face is defined by reversing the digits, and substituting the middle digit with 0 or 7 as appropriate.

This gives all the required output, but without any separating characters. To achieve that, I simply convert to an array of characters and print the array, like this (linebreaks inserted to prevent scrolling):

["0", "0", "0", "0", "0", "1", "0", "1", "0", "0", "1", "1", "1", "0", "0", "1", "0", "1", "1", "1", "0", "1", "1", "1", "1", "0", "4", "4", "5", "1", "5", "4", "6", "6", "7", "5", "4", "0", "2", "2", "6", "4", "6", "2", "3", "3", "7", "6", "2", "0", "1", "1", "3", "2", "3", "1", "5", "5", "7", "3"] 

#Ruby, 98106#

Fixed error spotted by Reto Koradi.

s=sprintf'%024b',342391 6.times{|i|t='15462315'[i,3];t+=t.reverse;t[1+i%2*3]='07'[i%2];s+=t} p s.split(//) 

Given that coordinates are required, the only corner numbering scheme that made sense seemed to be the one where each corner is the binary representation of its coordinates. That's quite different from the linked question, where various different numbering schemes were tried. In the end I decided to print the coordinates with a dirty hardcode: s is initialised to the string version of 24-bit number000001010011100101110111 whose decimal representation is 342391. Actually with this method of printing coordinates, the numbering of the vertices is flexible, so I may do another answer.

Going round the equator of the cube, we find the vertices 1,5,4,6,2,3 and we can define one triangle for each face from any 3 consecutive numbers on this list (wrapping back to the beginning at the end.) The other triangle on each face is defined by reversing the digits, and substituting the middle digit with 0 or 7 as appropriate.

This gives all the required output, but without any separating characters. To achieve that, I simply convert to an array of characters and print the array, like this (linebreaks inserted to prevent scrolling):

["0", "0", "0", "0", "0", "1", "0", "1", "0", "0", "1", "1", "1", "0", "0", "1", "0", "1", "1", "1", "0", "1", "1", "1", "1", "0", "4", "4", "5", "1", "5", "4", "6", "6", "7", "5", "4", "0", "2", "2", "6", "4", "6", "2", "3", "3", "7", "6", "2", "0", "1", "1", "3", "2", "3", "1", "5", "5", "7", "3"] 

Ruby, 98106

Fixed error spotted by Reto Koradi.

s=sprintf'%024b',342391 6.times{|i|t='15462315'[i,3];t+=t.reverse;t[1+i%2*3]='07'[i%2];s+=t} p s.split(//) 

Given that coordinates are required, the only corner numbering scheme that made sense seemed to be the one where each corner is the binary representation of its coordinates. That's quite different from the linked question, where various different numbering schemes were tried. In the end I decided to print the coordinates with a dirty hardcode: s is initialised to the string version of 24-bit number000001010011100101110111 whose decimal representation is 342391. Actually with this method of printing coordinates, the numbering of the vertices is flexible, so I may do another answer.

Going round the equator of the cube, we find the vertices 1,5,4,6,2,3 and we can define one triangle for each face from any 3 consecutive numbers on this list (wrapping back to the beginning at the end.) The other triangle on each face is defined by reversing the digits, and substituting the middle digit with 0 or 7 as appropriate.

This gives all the required output, but without any separating characters. To achieve that, I simply convert to an array of characters and print the array, like this (linebreaks inserted to prevent scrolling):

["0", "0", "0", "0", "0", "1", "0", "1", "0", "0", "1", "1", "1", "0", "0", "1", "0", "1", "1", "1", "0", "1", "1", "1", "1", "0", "4", "4", "5", "1", "5", "4", "6", "6", "7", "5", "4", "0", "2", "2", "6", "4", "6", "2", "3", "3", "7", "6", "2", "0", "1", "1", "3", "2", "3", "1", "5", "5", "7", "3"] 
added 201 characters in body
Source Link
Level River St
  • 28.8k
  • 4
  • 40
  • 112

#Ruby, 98#98106#

Fixed error spotted by Reto Koradi.

s=sprintf'%024b',342391 6.times{|i|s+=t='15462315'[i|i|t='15462315'[i,3];t[1]='07'[i%2];s+=t3];t+=t.reversereverse;t[1+i%2*3]='07'[i%2];s+=t} p s.split(//) 

Given that coordinates are required, the only corner numbering scheme that makesmade sense seemsseemed to be the one where each corner is the binary representation of its coordinates. That's quite different from the linked question, where various different numbering schemes were tried. In the end I decided to print the coordinates with a dirty hardcode: s is initialised to the string version of 24-bit number000001010011100101110111 whose decimal representation is 342391. Actually with this method of printing coordinates, the numbering of the vertices is flexible, so I may do another answer.

Going round the equator of the cube, we find the vertices 1,5,4,6,2,3 and we can define one triangle for each face from any 3 consecutive numbers on this list (wrapping back to the beginning at the end.) The other triangle on each face is defined by reversing the digits, and substituting the middle digit with 0 or 7 as appropriate.

This gives all the required output, but without any separating characters. To achieve that, I simply convert to an array of characters and print the array, like this (linebreaks inserted to prevent scrolling):

["0", "0", "0", "0", "0", "1", "0", "1", "0", "0", "1", "1", "1", "0", "0", "1", "0", "1", "1", "1", "0", "1", "1", "1", "1", "5""0", "4", "4", "0""5", "1", "5", "4", "6", "6", "7", "5", "4", "6""0", "2", "2", "0""6", "4", "6", "2", "3", "3", "7", "6", "2", "3""0", "1", "1", "0""3", "2", "3", "1", "5", "5", "7", "3"] 

#Ruby, 98#

s=sprintf'%024b',342391 6.times{|i|s+=t='15462315'[i,3];t[1]='07'[i%2];s+=t.reverse} p s.split(//) 

Given that coordinates are required, the only corner numbering scheme that makes sense seems to be the one where each corner is the binary representation of its coordinates. That's quite different from the linked question, where various different numbering schemes were tried. I print the coordinates with a dirty hardcode: s is initialised to the string version of 24-bit number000001010011100101110111 whose decimal representation is 342391.

Going round the equator of the cube, we find the vertices 1,5,4,6,2,3 and we can define one triangle for each face from any 3 consecutive numbers on this list (wrapping back to the beginning at the end.) The other triangle on each face is defined by reversing the digits, and substituting the middle digit with 0 or 7 as appropriate.

This gives all the required output, but without any separating characters. To achieve that, I simply convert to an array of characters and print the array, like this (linebreaks inserted to prevent scrolling):

["0", "0", "0", "0", "0", "1", "0", "1", "0", "0", "1", "1", "1", "0", "0", "1", "0", "1", "1", "1", "0", "1", "1", "1", "1", "5", "4", "4", "0", "1", "5", "4", "6", "6", "7", "5", "4", "6", "2", "2", "0", "4", "6", "2", "3", "3", "7", "6", "2", "3", "1", "1", "0", "2", "3", "1", "5", "5", "7", "3"] 

#Ruby, 98106#

Fixed error spotted by Reto Koradi.

s=sprintf'%024b',342391 6.times{|i|t='15462315'[i,3];t+=t.reverse;t[1+i%2*3]='07'[i%2];s+=t} p s.split(//) 

Given that coordinates are required, the only corner numbering scheme that made sense seemed to be the one where each corner is the binary representation of its coordinates. That's quite different from the linked question, where various different numbering schemes were tried. In the end I decided to print the coordinates with a dirty hardcode: s is initialised to the string version of 24-bit number000001010011100101110111 whose decimal representation is 342391. Actually with this method of printing coordinates, the numbering of the vertices is flexible, so I may do another answer.

Going round the equator of the cube, we find the vertices 1,5,4,6,2,3 and we can define one triangle for each face from any 3 consecutive numbers on this list (wrapping back to the beginning at the end.) The other triangle on each face is defined by reversing the digits, and substituting the middle digit with 0 or 7 as appropriate.

This gives all the required output, but without any separating characters. To achieve that, I simply convert to an array of characters and print the array, like this (linebreaks inserted to prevent scrolling):

["0", "0", "0", "0", "0", "1", "0", "1", "0", "0", "1", "1", "1", "0", "0", "1", "0", "1", "1", "1", "0", "1", "1", "1", "1", "0", "4", "4", "5", "1", "5", "4", "6", "6", "7", "5", "4", "0", "2", "2", "6", "4", "6", "2", "3", "3", "7", "6", "2", "0", "1", "1", "3", "2", "3", "1", "5", "5", "7", "3"] 
Source Link
Level River St
  • 28.8k
  • 4
  • 40
  • 112

#Ruby, 98#

s=sprintf'%024b',342391 6.times{|i|s+=t='15462315'[i,3];t[1]='07'[i%2];s+=t.reverse} p s.split(//) 

Given that coordinates are required, the only corner numbering scheme that makes sense seems to be the one where each corner is the binary representation of its coordinates. That's quite different from the linked question, where various different numbering schemes were tried. I print the coordinates with a dirty hardcode: s is initialised to the string version of 24-bit number000001010011100101110111 whose decimal representation is 342391.

Going round the equator of the cube, we find the vertices 1,5,4,6,2,3 and we can define one triangle for each face from any 3 consecutive numbers on this list (wrapping back to the beginning at the end.) The other triangle on each face is defined by reversing the digits, and substituting the middle digit with 0 or 7 as appropriate.

This gives all the required output, but without any separating characters. To achieve that, I simply convert to an array of characters and print the array, like this (linebreaks inserted to prevent scrolling):

["0", "0", "0", "0", "0", "1", "0", "1", "0", "0", "1", "1", "1", "0", "0", "1", "0", "1", "1", "1", "0", "1", "1", "1", "1", "5", "4", "4", "0", "1", "5", "4", "6", "6", "7", "5", "4", "6", "2", "2", "0", "4", "6", "2", "3", "3", "7", "6", "2", "3", "1", "1", "0", "2", "3", "1", "5", "5", "7", "3"]