Skip to main content
added 17 characters in body
Source Link
Lecdi
  • 1.2k
  • 6
  • 21

Python 3, 2727 26 bytes

Code

lambda v:sum(v)/2-2*minmin(v)>12>6

Outputs True for cheated and False for valid.

Try it online!Try it online!

Explanation

Let \$a\$, \$b\$ and \$c\$ be the three dice rolls, where \$a\$ is the highest roll. Therefore, if \$a > 6\$, the alien cheated, and otherwise they did not.

The sum of the numbers is \$2a + 2b + 2c\$. The minimum of the numbers is \$b + c\$. Therefore, sum(v)/2-2*minmin(v) is \$(2a + 2b + 2c) - 2(b + c)\$\$(2a + 2b + 2c)/2 - (b + c)\$ which is \$2a\$\$a\$. If this is greater than \$12\$\$6\$, the alien cheated.

Python 3, 27 bytes

Code

lambda v:sum(v)-2*min(v)>12

Outputs True for cheated and False for valid.

Try it online!

Explanation

Let \$a\$, \$b\$ and \$c\$ be the three dice rolls, where \$a\$ is the highest roll. Therefore, if \$a > 6\$, the alien cheated, and otherwise they did not.

The sum of the numbers is \$2a + 2b + 2c\$. The minimum of the numbers is \$b + c\$. Therefore, sum(v)-2*min(v) is \$(2a + 2b + 2c) - 2(b + c)\$ which is \$2a\$. If this is greater than \$12\$, the alien cheated.

Python 3, 27 26 bytes

Code

lambda v:sum(v)/2-min(v)>6

Outputs True for cheated and False for valid.

Try it online!

Explanation

Let \$a\$, \$b\$ and \$c\$ be the three dice rolls, where \$a\$ is the highest roll. Therefore, if \$a > 6\$, the alien cheated, and otherwise they did not.

The sum of the numbers is \$2a + 2b + 2c\$. The minimum of the numbers is \$b + c\$. Therefore, sum(v)/2-min(v) is \$(2a + 2b + 2c)/2 - (b + c)\$ which is \$a\$. If this is greater than \$6\$, the alien cheated.

Source Link
Lecdi
  • 1.2k
  • 6
  • 21

Python 3, 27 bytes

Code

lambda v:sum(v)-2*min(v)>12

Outputs True for cheated and False for valid.

Try it online!

Explanation

Let \$a\$, \$b\$ and \$c\$ be the three dice rolls, where \$a\$ is the highest roll. Therefore, if \$a > 6\$, the alien cheated, and otherwise they did not.

The sum of the numbers is \$2a + 2b + 2c\$. The minimum of the numbers is \$b + c\$. Therefore, sum(v)-2*min(v) is \$(2a + 2b + 2c) - 2(b + c)\$ which is \$2a\$. If this is greater than \$12\$, the alien cheated.