home
/
code
/
cellular-automata.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use a more idiomatic creator name.
[cellular-automata.git]
/
polymorphic-life
/
001
/
src
/
polymorphic_life.ml
diff --git
a/polymorphic-life/001/src/polymorphic_life.ml
b/polymorphic-life/001/src/polymorphic_life.ml
index
544136c
..
b93a79d
100644
(file)
--- a/
polymorphic-life/001/src/polymorphic_life.ml
+++ b/
polymorphic-life/001/src/polymorphic_life.ml
@@
-59,7
+59,7
@@
end
module type CELL = sig
type t
module type CELL = sig
type t
- val
init
: unit -> t
+ val
create
: unit -> t
val to_string : t -> string
val to_string : t -> string
@@
-85,7
+85,7
@@
module Conway : CELL = struct
| D -> " "
| A -> "o"
| D -> " "
| A -> "o"
- let
init
() =
+ let
create
() =
Random.int 2 |> of_int
let state = to_int
Random.int 2 |> of_int
let state = to_int
@@
-104,7
+104,7
@@
end
let main rows cols () =
Random.self_init ();
let main rows cols () =
Random.self_init ();
- let grid = Matrix.create ~rows ~cols ~data:() |> Matrix.map ~f:Conway.
init
in
+ let grid = Matrix.create ~rows ~cols ~data:() |> Matrix.map ~f:Conway.
create
in
Matrix.print grid ~to_string:Conway.to_string
Matrix.print grid ~to_string:Conway.to_string
This page took
0.028511 seconds
and
4
git commands to generate.