SHARE
TWEET

Untitled

a guest Oct 21st, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #use "list_tools.ml" ;;
  2. let new_cell = 1 ;;
  3. let empty = 0 ;;
  4. let is_alive cell = cell <> empty ;;
  5.  
  6. #load "graphics.cma";;
  7. open Graphics ;;
  8. let open_window size = open_graph (" " ^ string_of_int size ^ "x" ^
  9.                                       string_of_int (size+20)) ;;
  10. let grey = rgb 127 127 127 ;;
  11.  
  12. (*1.1 draw_cell*)
  13. let draw_cell (x,y) size color =
  14.   set_color color ; fill_rect x y size size ;
  15.   draw_rect (x+1) (y+1) size size ;;
  16.  
  17. open_window 800 ;;
  18. draw_cell (100,100) 500 grey ;;
  19. clear_graph() ;;
  20.  
  21. let draw_fill_square (x,y) size color =
  22.   set_color color; fill_rect x y size size;
  23.   set_color grey; draw_rect x y size size;;
  24.  
  25. let draw_cell (x,y) size c =  
  26.   draw_fill_square (x * size, y * size) size c ;;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top