diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2011-06-19 10:06:17 -0400 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2011-06-19 10:06:17 -0400 |
| commit | 2acffa283e52a449a72539377851ddc8c43d63e8 (patch) | |
| tree | 4f6c7302a8edd8e9f6dad28c79f1c6546ff78c2d | |
| parent | f4e6664361f2eaf10f2bd3c81916acc57c547037 (diff) | |
| download | icfp2011-2acffa283e52a449a72539377851ddc8c43d63e8.tar.gz | |
Count test
| -rw-r--r-- | game.ml | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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" )) |
