
exception Unimplemented
exception AlreadyDone

(*** part a ***)
type move = Home 
          | Forward of float
          | Turn of float
          | For of (int*(move list))

let pi = 3.14159265

(*** part b ***)
let makePoly sides len = 
  [For (sides, [Forward len; Turn (2.0 *. pi /. sides)])]    

raise Unimplemented

(*** part c ***)
let interpLarge (movelist : move list) : (float*float) list = 
  let rec loop movelist x y dir acc =
    match movelist with
      [] -> raise Unimplemented
    | Home::tl -> raise Unimplemented
    | _ -> raise Unimplemented
  # # # # # # # # # # # # # # # # # # # # # # # # # # #
  in List.rev (loop movelist 0.0 0.0 0.0 [(0.0,0.0)])

(*** part d ***)
let interpSmall (movelist : move list) : (float*float) list = 
  let interpSmallStep movelist x y dir : move list * float * float * float = 
  match movelist with
    [] -> raise Unimplemented
  | Home::tl -> raise Unimplemented
  | _ -> raise Unimplemented  
  # # # # # # # # # # # # # # # # # # # # # # # # # # #
  in
  let rec loop movelist x y dir acc =
    raise Unimplemented
  in 
  List.rev (loop movelist 0.0 0.0 0.0 [(0.0,0.0)])

(*** part e ***)

  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

(*** part f ***)
let interpTrans movelist : float->float->float-> (float * float) list * float= 
  # # # # # # # # # # # # # # # # # # # # # # # # #
  in
  match movelist with
    [] -> raise Unimplemented
  | Home::tl -> raise Unimplemented
  | _ -> raise Unimplemented  
  # # # # # # # # # # # # # # # # # # # # # # # # # # #

(*** possibly helpful testing code ***)

  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
let example_logo_prog = raise Unimplemented
let ansL = interpLarge example_logo_prog
let ansS = interpSmall example_logo_prog
let ansI = (0.0,0.0)::(fst ((interpTrans example_logo_prog) 0.0 0.0 0.0))

let rec pr lst =
  match lst with
    [] -> ()
  | (x,y)::tl -> 
      print_string("(" ^ (string_of_float x) ^ "," ^ (string_of_float y) ^ ")");
      pr tl

let _ = 
  pr ansL; print_newline (); 
  pr ansS; print_newline ();
  pr ansI; print_newline (); 


** part a **
** part b **
** part c **
** part d **
** part e **
** part f **
** possibly helpful testing code **

exception Unimplemented
exception AlreadyDone

type move = Home 
          | Forward of float
          | Turn of float
          | For of (int*(move list))

let pi = 3.14159265

let makePoly sides len = 
  [For (sides, [Forward len; Turn (2.0 *. pi /. sides)])]    

raise Unimplemented

let interpLarge (movelist : move list) : (float*float) list = 
  let rec loop movelist x y dir acc =
    match movelist with
      [] -> raise Unimplemented
    | Home::tl -> raise Unimplemented
    | _ -> raise Unimplemented
  # # # # # # # # # # # # # # # # # # # # # # # # # # #
  in List.rev (loop movelist 0.0 0.0 0.0 [(0.0,0.0)])

let interpSmall (movelist : move list) : (float*float) list = 
  let interpSmallStep movelist x y dir : move list * float * float * float = 
  match movelist with
    [] -> raise Unimplemented
  | Home::tl -> raise Unimplemented
  | _ -> raise Unimplemented  
  # # # # # # # # # # # # # # # # # # # # # # # # # # #
  in
  let rec loop movelist x y dir acc =
    raise Unimplemented
  in 
  List.rev (loop movelist 0.0 0.0 0.0 [(0.0,0.0)])


  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

let interpTrans movelist : float->float->float-> (float * float) list * float= 
  # # # # # # # # # # # # # # # # # # # # # # # # #
  in
  match movelist with
    [] -> raise Unimplemented
  | Home::tl -> raise Unimplemented
  | _ -> raise Unimplemented  
  # # # # # # # # # # # # # # # # # # # # # # # # # # #


  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
let example_logo_prog = raise Unimplemented
let ansL = interpLarge example_logo_prog
let ansS = interpSmall example_logo_prog
let ansI = (0.0,0.0)::(fst ((interpTrans example_logo_prog) 0.0 0.0 0.0))

let rec pr lst =
  match lst with
    [] -> ()
  | (x,y)::tl -> 
      print_string("(" ^ (string_of_float x) ^ "," ^ (string_of_float y) ^ ")");
      pr tl

let _ = 
  pr ansL; print_newline (); 
  pr ansS; print_newline ();
  pr ansI; print_newline (); 

