module Universe:sig..end
type iworld_t
type ('a, 'b) t =
| |
State of |
(* | 'a is the type of states状態の型が 'a | *) |
| |
Bundle of |
(* | 'a is the type of states,
a list of pairs of a receiver and a message of type 'b,
a list of clients to be disconnected状態の型が 'a、送り先と 'b 型のメッセージのリスト、
disconnect するクライアントのリスト | *) |
val universe : ?on_new:('a -> iworld_t -> ('a, 'b) t) ->
?on_msg:('a -> iworld_t -> 'c -> ('a, 'b) t) ->
?rate:float ->
?on_tick:('a -> ('a, 'b) t) ->
?on_disconnect:('a -> iworld_t -> ('a, 'b) t) -> 'a -> unit'a 型の引数のみ必須)on_new : state と新しく通信に参加したクライアントを受け取り
新しい state を返すon_msg : state と送信者とメッセージを受け取り
新しい state を返すrate : 1 tick の間隔(秒)on_tick : state を受け取り 1 tick 後の state を返すon_disconnect : state と通信から抜けたクライアントを受け取り
新しい state を返す'a : universe の初期状態(必須)