summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobby Zambito <contact@robbyzambito.me>2022-01-21 18:05:19 -0500
committerRobby Zambito <contact@robbyzambito.me>2022-01-21 18:05:19 -0500
commit0846d554b20df412aa16c7e250c400daee82dd59 (patch)
tree9cf853e03cecd34af0be10167bf454ab10519e71
parenta5706c0be5778b911b061deca501271fc2bf2c07 (diff)
Add a strategy which picks a valid move at random
-rw-r--r--strategies/random-move.scm6
1 files changed, 6 insertions, 0 deletions
diff --git a/strategies/random-move.scm b/strategies/random-move.scm
new file mode 100644
index 0000000..8b7e192
--- /dev/null
+++ b/strategies/random-move.scm
@@ -0,0 +1,6 @@
+(use-modules (srfi srfi-1)
+ (srfi srfi-27))
+(random-source-randomize! default-random-source)
+
+(list-ref (valid-moves) (random-integer (length (valid-moves))))
+