(* inuyasha4.ml - Don Yang (uguu.org) As of this version, page size is back to standard 8.5in x 11in x 72dpi. Works better with ghostscript (ghostview still looks better though). 01/09/02 *) type t = {x : float; y : float};; let transform tx ty angle sx sy point = {x = tx +. (cos angle) *. point.x *. sx -. (sin angle) *. point.y *. sy; y = ty +. (sin angle) *. point.x *. sx +. (cos angle) *. point.y *. sy};; let rand lowerbound range = lowerbound +. Random.float range;; let write_number x = print_float x; print_char ' ';; let draw_coord c = write_number c.x; write_number c.y;; let rec main index = if index > 0 then ( write_number (rand 0.5 0.5); write_number (rand 0. 0.1); write_number (rand 0. 0.1); print_string "r "; ( match ( List.map (transform (rand 72. 468.) (rand 72. 648.) (rand 0. (4. *. atan2 1. 0.)) (rand 12. 34.) (rand 12. 24.)) [{x = 4.; y = -5.}; {x = 4.; y = 5.}; {x = 0.; y = 6.}; {x = 6.; y = 5.}; {x = 6.; y = -5.}; {x = 0.; y = -6.}] ) with a::b::c::d::e::f::[] -> draw_coord f; print_string "m "; draw_coord a; draw_coord b; draw_coord c; print_string "c "; draw_coord d; draw_coord e; draw_coord f; print_string "d\n" | _ -> () ); main (index - 1) );; Random.self_init();; print_string ("/m{moveto}def/r{setrgbcolor newpath}def" ^ "/c{curveto}def/d{c closepath fill}def\n");; main (16 + Random.int 16);;