Game of Life
Game of Life
GRAPHIQUE-----------------------------------------*)
#load "graphics.cma" ;;
open Graphics;;
let open_window size = open_graph (" " ^ string_of_int size ^ "x" ^ string_of_int
(size+20)) ;;
open_window 500;;
(*------------------------------------FONCTIONS
UTILES---------------------------------------------*)
length [1;2;5;4;8;9];;
init_list 5 0;;
get_cell (2 , 3) board;;
(*----------------------GAME OF LIFE----------------------*)
open Random;;
Random.int 10;;
let next_cell (x,y) board size = rules0 (get_cell (x,y) board) (count_neighbours
(x,y) board size);;
next_generation [[1;1];[0;1]] 1
let new_game size nb_cell n = let board = new_board size nb_cell in game board
(size-1) n;;
new_game 20 40 50;;