USE OCAML PROGRAMMING LANGUAGE :
Posted: Mon May 02, 2022 12:19 pm
USE OCAML PROGRAMMING LANGUAGE :
1 Contagion = (a) Write a function printmat : bool array array -> unit = <fun> that < given a bool matrix it prints it on screen with ones and zeros, instead of true and false. (b) Write a function onstepcontagion : bool array array -> bool array array = <fun> that given a rectangular bool matrix, where true repre- sents an infected square and false represent non-infected square it calculates the next step of infection. Infected squares remain infected indefinitely, non-infected squares become infected if the they are vertically/horizontally adjacent to at least two other infected squares.
1 Contagion = (a) Write a function printmat : bool array array -> unit = <fun> that < given a bool matrix it prints it on screen with ones and zeros, instead of true and false. (b) Write a function onstepcontagion : bool array array -> bool array array = <fun> that given a rectangular bool matrix, where true repre- sents an infected square and false represent non-infected square it calculates the next step of infection. Infected squares remain infected indefinitely, non-infected squares become infected if the they are vertically/horizontally adjacent to at least two other infected squares.