Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Commonmark migration
Source Link

#Javascript (削除) 238 (削除ここまで)(削除) 232 (削除ここまで)(削除) 207 (削除ここまで) 201 bytes

Javascript (削除) 238 (削除ここまで)(削除) 232 (削除ここまで)(削除) 207 (削除ここまで) 201 bytes

var r=24*Math.random()|0,o=r%3,b=r-o,v="123513653263154214624564";console.log(` ________
 /\\ \\
 / \\ %s \\
{ %s }-------}
 \\ / %s /
 \\/_______/`,v[r],v[b+(o+1)%3],v[b+(o+2)%3])

which when ungolfed is:

var r = 24 * Math.random() | 0,
 o = r % 3,
 b = r - o,
 v = "123513653263154214624564";
console.log(
` ________
 /\\ \\
 / \\ %s \\
{ %s }-------}
 \\ / %s /
 \\/_______/`,
 
 v[r],
 v[b+(o+1)%3]
 ,v[b+(o+2)%3]
)

Algorithm

Consider that at each of the 8 corner intersections of a die, the intersecting die face values are fixed but can appear in any of 3 rotations. For example while looking down at the "1","2","3" corner, the die can be rotated about an axis through the corner and out the opposite corner, to show "1", "2" or "3" on top of the ASCII art.

v hard codes the die faces which intersect at each corner, b is an offset to the start of a random corner, and o is start of the rotation within corner data. The ASCII art is written to the console using a console.log format string.

#Javascript (削除) 238 (削除ここまで)(削除) 232 (削除ここまで)(削除) 207 (削除ここまで) 201 bytes

var r=24*Math.random()|0,o=r%3,b=r-o,v="123513653263154214624564";console.log(` ________
 /\\ \\
 / \\ %s \\
{ %s }-------}
 \\ / %s /
 \\/_______/`,v[r],v[b+(o+1)%3],v[b+(o+2)%3])

which when ungolfed is:

var r = 24 * Math.random() | 0,
 o = r % 3,
 b = r - o,
 v = "123513653263154214624564";
console.log(
` ________
 /\\ \\
 / \\ %s \\
{ %s }-------}
 \\ / %s /
 \\/_______/`,
 
 v[r],
 v[b+(o+1)%3]
 ,v[b+(o+2)%3]
)

Algorithm

Consider that at each of the 8 corner intersections of a die, the intersecting die face values are fixed but can appear in any of 3 rotations. For example while looking down at the "1","2","3" corner, the die can be rotated about an axis through the corner and out the opposite corner, to show "1", "2" or "3" on top of the ASCII art.

v hard codes the die faces which intersect at each corner, b is an offset to the start of a random corner, and o is start of the rotation within corner data. The ASCII art is written to the console using a console.log format string.

Javascript (削除) 238 (削除ここまで)(削除) 232 (削除ここまで)(削除) 207 (削除ここまで) 201 bytes

var r=24*Math.random()|0,o=r%3,b=r-o,v="123513653263154214624564";console.log(` ________
 /\\ \\
 / \\ %s \\
{ %s }-------}
 \\ / %s /
 \\/_______/`,v[r],v[b+(o+1)%3],v[b+(o+2)%3])

which when ungolfed is:

var r = 24 * Math.random() | 0,
 o = r % 3,
 b = r - o,
 v = "123513653263154214624564";
console.log(
` ________
 /\\ \\
 / \\ %s \\
{ %s }-------}
 \\ / %s /
 \\/_______/`,
 
 v[r],
 v[b+(o+1)%3]
 ,v[b+(o+2)%3]
)

Algorithm

Consider that at each of the 8 corner intersections of a die, the intersecting die face values are fixed but can appear in any of 3 rotations. For example while looking down at the "1","2","3" corner, the die can be rotated about an axis through the corner and out the opposite corner, to show "1", "2" or "3" on top of the ASCII art.

v hard codes the die faces which intersect at each corner, b is an offset to the start of a random corner, and o is start of the rotation within corner data. The ASCII art is written to the console using a console.log format string.

use ES6 text template literal
Source Link
traktor
  • 489
  • 3
  • 10

#Javascript (削除) 238 (削除ここまで) (削除) 232 (削除ここまで) 207(削除) 207 (削除ここまで) 201 bytes

var r=24*Math.random()|0,o=r%3,b=r-o,v="123513653263154214624564";console.log("` ________\n________
 /\\ \\\n\\
 / \\ %s \\\n\\
{ %s }-------}\n \\ / %s /\n \\/_______/"`,v[r],v[b+(o+1)%3],v[b+(o+2)%3]);

which when ungolfed is:

var r = 24 * Math.random() | 0,
 o = r % 3,
 b = r - o,
 v = "123513653263154214624564";
console.log(
 "` ________\n________
 /\\ \\\n\\
 / \\ %s \\\n\\
{ %s }-------}\n \\ / %s /\n \\/_______/"`,
 v[ r]v[r],
 v[ b+v[b+(o+1)%3],
 v[ b+,v[b+(o+2)%3]
);

Algorithm

Consider that at each of the 8 corner intersections of a die, the intersecting die face values are fixed but can appear in any of 3 rotations. For example while looking down at the "1","2","3" corner, the die can be rotated about an axis through the corner and out the opposite corner, to show "1", "2" or "3" on top of the ASCII art.

v hard codes the die faces which intersect at each corner, b is an offset to the start of a random corner, and o is start of the rotation within corner data. The ASCII art is written to the console using a console.log format string.

#Javascript (削除) 238 (削除ここまで) (削除) 232 (削除ここまで) 207 bytes

var r=24*Math.random()|0,o=r%3,b=r-o,v="123513653263154214624564";console.log(" ________\n /\\ \\\n / \\ %s \\\n{ %s }-------}\n \\ / %s /\n \\/_______/",v[r],v[b+(o+1)%3],v[b+(o+2)%3]);

which when ungolfed is:

var r = 24 * Math.random() | 0,
 o = r % 3,
 b = r - o,
 v = "123513653263154214624564";
console.log(
 " ________\n /\\ \\\n / \\ %s \\\n{ %s }-------}\n \\ / %s /\n \\/_______/",
 v[ r],
 v[ b+(o+1)%3],
 v[ b+(o+2)%3]
);

Algorithm

Consider that at each of the 8 corner intersections of a die, the intersecting die face values are fixed but can appear in any of 3 rotations. For example while looking down at the "1","2","3" corner, the die can be rotated about an axis through the corner and out the opposite corner, to show "1", "2" or "3" on top of the ASCII art.

v hard codes the die faces which intersect at each corner, b is an offset to the start of a random corner, and o is start of the rotation within corner data. The ASCII art is written to the console using a console.log format string.

#Javascript (削除) 238 (削除ここまで) (削除) 232 (削除ここまで) (削除) 207 (削除ここまで) 201 bytes

var r=24*Math.random()|0,o=r%3,b=r-o,v="123513653263154214624564";console.log(` ________
 /\\ \\
 / \\ %s \\
{ %s }-------} \\ / %s / \\/_______/`,v[r],v[b+(o+1)%3],v[b+(o+2)%3])

which when ungolfed is:

var r = 24 * Math.random() | 0,
 o = r % 3,
 b = r - o,
 v = "123513653263154214624564";
console.log(
` ________
 /\\ \\
 / \\ %s \\
{ %s }-------} \\ / %s / \\/_______/`,
 v[r],
 v[b+(o+1)%3]
 ,v[b+(o+2)%3]
)

Algorithm

Consider that at each of the 8 corner intersections of a die, the intersecting die face values are fixed but can appear in any of 3 rotations. For example while looking down at the "1","2","3" corner, the die can be rotated about an axis through the corner and out the opposite corner, to show "1", "2" or "3" on top of the ASCII art.

v hard codes the die faces which intersect at each corner, b is an offset to the start of a random corner, and o is start of the rotation within corner data. The ASCII art is written to the console using a console.log format string.

remove reference to `f`
Source Link
traktor
  • 489
  • 3
  • 10

#Javascript (削除) 238 (削除ここまで) (削除) 232 (削除ここまで) 207 bytes

var r=24*Math.random()|0,o=r%3,b=r-o,v="123513653263154214624564";console.log(" ________\n /\\ \\\n / \\ %s \\\n{ %s }-------}\n \\ / %s /\n \\/_______/",v[r],v[b+(o+1)%3],v[b+(o+2)%3]);

which when ungolfed is:

var r = 24 * Math.random() | 0,
 o = r % 3,
 b = r - o,
 v = "123513653263154214624564";
console.log(
 " ________\n /\\ \\\n / \\ %s \\\n{ %s }-------}\n \\ / %s /\n \\/_______/",
 v[ r],
 v[ b+(o+1)%3],
 v[ b+(o+2)%3]
);

Algorithm

Consider that at each of the 8 corner intersections of a die, the intersecting die face values are fixed but can appear in any of 3 rotations. For example while looking down at the "1","2","3" corner, the die can be rotated about an axis through the corner and out the opposite corner, to show "1", "2" or "3" on top of the ASCII art.

v hard codes the die faces which intersect at each corner, b is an offset to the start of a random corner, and o is start of the rotation within corner data. f formats theThe ASCII art into string s which is written to the console using a console.log format string.

#Javascript (削除) 238 (削除ここまで) (削除) 232 (削除ここまで) 207 bytes

var r=24*Math.random()|0,o=r%3,b=r-o,v="123513653263154214624564";console.log(" ________\n /\\ \\\n / \\ %s \\\n{ %s }-------}\n \\ / %s /\n \\/_______/",v[r],v[b+(o+1)%3],v[b+(o+2)%3]);

which when ungolfed is:

var r = 24 * Math.random() | 0,
 o = r % 3,
 b = r - o,
 v = "123513653263154214624564";
console.log(
 " ________\n /\\ \\\n / \\ %s \\\n{ %s }-------}\n \\ / %s /\n \\/_______/",
 v[ r],
 v[ b+(o+1)%3],
 v[ b+(o+2)%3]
);

Algorithm

Consider that at each of the 8 corner intersections of a die, the intersecting die face values are fixed but can appear in any of 3 rotations. For example while looking down at the "1","2","3" corner, the die can be rotated about an axis through the corner and out the opposite corner, to show "1", "2" or "3" on top of the ASCII art.

v hard codes the die faces which intersect at each corner, b is an offset to the start of a random corner, and o is start of the rotation within corner data. f formats the ASCII art into string s which is written to the console.

#Javascript (削除) 238 (削除ここまで) (削除) 232 (削除ここまで) 207 bytes

var r=24*Math.random()|0,o=r%3,b=r-o,v="123513653263154214624564";console.log(" ________\n /\\ \\\n / \\ %s \\\n{ %s }-------}\n \\ / %s /\n \\/_______/",v[r],v[b+(o+1)%3],v[b+(o+2)%3]);

which when ungolfed is:

var r = 24 * Math.random() | 0,
 o = r % 3,
 b = r - o,
 v = "123513653263154214624564";
console.log(
 " ________\n /\\ \\\n / \\ %s \\\n{ %s }-------}\n \\ / %s /\n \\/_______/",
 v[ r],
 v[ b+(o+1)%3],
 v[ b+(o+2)%3]
);

Algorithm

Consider that at each of the 8 corner intersections of a die, the intersecting die face values are fixed but can appear in any of 3 rotations. For example while looking down at the "1","2","3" corner, the die can be rotated about an axis through the corner and out the opposite corner, to show "1", "2" or "3" on top of the ASCII art.

v hard codes the die faces which intersect at each corner, b is an offset to the start of a random corner, and o is start of the rotation within corner data. The ASCII art is written to the console using a console.log format string.

use console log to expand format string
Source Link
traktor
  • 489
  • 3
  • 10
Loading
shorten calculation of b and o
Source Link
traktor
  • 489
  • 3
  • 10
Loading
Source Link
traktor
  • 489
  • 3
  • 10
Loading

AltStyle によって変換されたページ (->オリジナル) /