diff --git a/a.out b/a.out index 5b20e33..9e1ca7d 100755 Binary files a/a.out and b/a.out differ diff --git a/pretty_printing.cmi b/pretty_printing.cmi index eed7c34..af94e78 100644 Binary files a/pretty_printing.cmi and b/pretty_printing.cmi differ diff --git a/pretty_printing.cmo b/pretty_printing.cmo index 9cbef29..fabc2c5 100644 Binary files a/pretty_printing.cmo and b/pretty_printing.cmo differ diff --git a/pretty_printing.ml b/pretty_printing.ml index 0175bd1..f2edd79 100644 --- a/pretty_printing.ml +++ b/pretty_printing.ml @@ -130,15 +130,19 @@ let draw_line_bresenham mat cls origin x1 y1 x2 y2 cutoff = done;; let display mat cls = - let colors = [|"\027[30m"; "\027[31m"; "\027[32m"; "\027[33m"; "\027[34m"; "\027[35m"; "\027[36m"; "\027[37m"|] in + let colors = [|"\027[40m"; "\027[41m"; "\027[42m"; "\027[43m"; "\027[44m"; "\027[45m"; "\027[46m"; "\027[47m"; "\027[100m"; "\027[101m"; "\027[102m"; "\027[103m"; "\027[104m"; "\027[105m"; "\027[106m"; "\027[107m"|] in for i = 0 to (Array.length mat -1) do for j = 0 to (Array.length mat.(i) -1) do - print_string colors.(cls.(i).(j) mod (Array.length colors)); + if cls.(i).(j) = 0 then + print_string colors.(0) + else + print_string colors.(max 1 (cls.(i).(j) mod (Array.length colors))); if mat.(i).(j) = '&' then print_char ' ' else print_char mat.(i).(j) done; + print_string "\027[0m"; print_char '\n' done;; @@ -186,14 +190,14 @@ let extremely_fancy_graph_printing g size = if !i >= size then i := size-1 else (); if !j >= size then j := size-1 else (); px.(!i).(3* !j) <- Char.chr (k + 48); - extend px cls !i (3* !j) 3; + extend px cls !i (3* !j) 2; coords.(k) <- (!i, 3* !j); done; (* draw the connections *) for i = 0 to Array.length g -1 do for j = 0 to Array.length g.(i) -1 do - draw_line_bresenham px cls i (fst coords.(i)) (snd coords.(i)) (fst coords.(g.(i).(j))) (snd coords.(g.(i).(j))) 7 + draw_line_bresenham px cls i (fst coords.(i)) (snd coords.(i)) (fst coords.(g.(i).(j))) (snd coords.(g.(i).(j))) 4 done done; @@ -201,7 +205,7 @@ let extremely_fancy_graph_printing g size = display px cls ;; -let gr = [|[|1; 2|]; [|2; 3|]; [|0; 1; 3|]; [|0; 1|]|] ;; +let gr = [|[|1; 2|]; [|2; 3|]; [|0; 1; 3|]; [|0; 1; 4|]; [|2; 3|]; [||]; [||]|] ;; (*print_mat gr ;;*)