We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 558e975 commit c9576e8Copy full SHA for c9576e8
codeflash/after_ml.py
@@ -0,0 +1,11 @@
1
+import jax.numpy as jnp
2
+
3
4
+def sum_hand(hand):
5
+ """Returns the total points in a hand."""
6
+ return jnp.sum(hand) + (10 * usable_ace(hand))
7
8
9
+def usable_ace(hand):
10
+ """Checks to se if a hand has a usable ace."""
11
+ return jnp.logical_and(jnp.any(hand == 1), jnp.sum(hand) + 10 <= 21)
codeflash/before_ml.py
+ return sum(hand) + (10 * usable_ace(hand))
+ return jnp.logical_and((jnp.count_nonzero(hand == 1) > 0), (sum(hand) + 10 <= 21))
0 commit comments