From 3ccae1a817e2ccc7b4d49d29d7462f4e8070f765 Mon Sep 17 00:00:00 2001 From: Siraaj Khandkar Date: Mon, 6 Aug 2012 14:46:31 -0400 Subject: [PATCH] Board size as CLI args. --- 002/src/life.ml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/002/src/life.ml b/002/src/life.ml index 58ffbca..5e9d6f5 100644 --- a/002/src/life.ml +++ b/002/src/life.ml @@ -24,7 +24,7 @@ let minisleep subsec = let init_board x y = - Array.map (Array.map (fun _ -> Random.int 2)) (Array.make_matrix x y 0) + Array.map (Array.map (fun _ -> Random.int 2)) (Array.make_matrix y x 0) let print_board board = @@ -79,10 +79,14 @@ let rec life_loop board = life_loop (new_generation board) -let main x y = +let main argv = + let x = int_of_string argv.(1) + and y = int_of_string argv.(2) + in + Random.init (int_of_float (Unix.time ())); life_loop (init_board x y) -let () = main 61 236 +let () = main Sys.argv -- 2.20.1