aboutsummaryrefslogtreecommitdiff
path: root/judge/dummy_game.ml
diff options
context:
space:
mode:
Diffstat (limited to 'judge/dummy_game.ml')
-rw-r--r--judge/dummy_game.ml35
1 files changed, 35 insertions, 0 deletions
diff --git a/judge/dummy_game.ml b/judge/dummy_game.ml
new file mode 100644
index 0000000..869513a
--- /dev/null
+++ b/judge/dummy_game.ml
@@ -0,0 +1,35 @@
+open Core
+open Main
+
+module Dummy : GAME = struct
+
+ type game = player * int
+
+ let new_game = (P1, 10), TurnOf P1
+
+ let turn (p0, g) p _ =
+ if p <> p0 || g <= 0 then
+ (p0, g), Eliminated p
+ else
+ let op = other_player p in
+ (op, g-1), (
+ if g - 1 = 0 then
+ if Random.int 100 = 0 then Eliminated p
+ else if Random.int 2 = 0 then Won p
+ else if Random.int 2 = 0 then Won op
+ else Tie
+ else
+ TurnOf op
+ )
+
+ let id = "dummy_game"
+ let name = "Dumm game for testing purposes"
+
+end
+
+module C = Core(Dummy)
+module Main = Juge(C)
+
+let () =
+ Random.self_init ();
+ Main.run ()