From 0969607b001f60517c3811ebc09a0f038cb9d04f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Am=C3=A9lia=20Coutard-Sander?= Date: Sun, 12 Jan 2025 03:16:17 +0100 Subject: [PATCH] =?utf8?q?S=C3=A9rialisation=20des=20lignes=20en=20vraies?= =?utf8?q?=20lignes?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- automata/automata.ml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/automata/automata.ml b/automata/automata.ml index ca931d1..5439adf 100644 --- a/automata/automata.ml +++ b/automata/automata.ml @@ -133,10 +133,8 @@ let deserialise (type t) (m : (module Automaton with type t = t)) channel = and y = In_channel.input_line channel |> Option.get |> int_of_string in let chunk = Array.init chunk_size (fun _ -> - Array.init chunk_size (fun _ -> - (In_channel.input_line channel |> Option.get).[0] - |> M.of_char - |> Option.get)) + let l = In_channel.input_line channel |> Option.get in + Array.init chunk_size (fun i -> l.[i] |> M.of_char |> Option.get)) in aux (CoordMap.add (x, y) chunk board) in @@ -150,7 +148,11 @@ let serialise (type t) (m : (module Automaton with type t = t)) (d, board) chann CoordMap.iter (fun (x, y) chunk -> Printf.fprintf channel "%d\n%d\n" x y; - Array.iter (Array.iter (fun c -> Printf.fprintf channel "%c\n" (M.to_char c))) chunk) + Array.iter + (fun l -> + Array.iter (fun c -> Printf.fprintf channel "%c" (M.to_char c)) l; + Printf.fprintf channel "\n") + chunk) board let automata = -- 2.46.0