aboutsummaryrefslogtreecommitdiffstats
path: root/game.ml
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@gmail.com>2011-06-19 10:06:17 -0400
committerGuillaume Horel <guillaume.horel@gmail.com>2011-06-19 10:06:17 -0400
commit2acffa283e52a449a72539377851ddc8c43d63e8 (patch)
tree4f6c7302a8edd8e9f6dad28c79f1c6546ff78c2d /game.ml
parentf4e6664361f2eaf10f2bd3c81916acc57c547037 (diff)
downloadicfp2011-2acffa283e52a449a72539377851ddc8c43d63e8.tar.gz
Count test
Diffstat (limited to 'game.ml')
-rw-r--r--game.ml12
1 files changed, 6 insertions, 6 deletions
diff --git a/game.ml b/game.ml
index f1cbccf..0313172 100644
--- a/game.ml
+++ b/game.ml
@@ -17,20 +17,20 @@ type slot = {
mutable field: lambda
}
;;
+
let player0 = Array.init 256 (fun _ -> {vitality = 10000; field = id})
let player1 = Array.init 256 (fun _ -> {vitality = 10000; field = id})
-
+let card_count = ref(0)
let proponent = ref player0
let opponent = ref player1
-let zero = Const 0
+let zero = count:=!count+1;Const 0
let succ = Lambda(fun a -> match a with
- |Const n -> if n < 65535 then Const (n+1) else Const n
- |_ -> raise( Rule_error "not an integer"))
+ |Const n -> if n < 65535 then count:=!count+1; Const (n+1) else count:=!count+1; Const n
+ |_ -> raise( Rule_error "not an integer"))
let dbl = Lambda(fun a -> match a with
- |Const n -> if n<32768 then Const(2*n) else Const n
+ |Const n -> if n<32768 then count:=!count+1; Const(2*n) else count:=!count+1; Const n
|_ -> raise( Rule_error "not an integer"))
-
let get = Lambda(fun a -> match a with
|(Const i) -> if !proponent.(i).vitality > 0 then !proponent.(i).field else raise( Rule_error "not a valid slot number")
|_ -> raise( Rule_error "not an integer" ))