Sunday, July 10, 2005
My 2005 ICFPC Submission
My Ocaml code for the 2005 ICFP Programming Contest is now available at http://www.wutka.com/download/markwutka_icfpc.tgz
I'm sorry to say that there is only one barely informative comment. The only other comments are code that has been commented out.
One of the things I learned last night on IRC was that I can optimize some of my match statements. The parser (parser.ml) has lines like this in its match:
Apparently, I can make this a little shorter with:
Although I am happy with my choice of Ocaml for doing this project, I am not happy with my usage of Ocaml. I didn't use the "O" part of it at all - no objects. I did things as modules and it was a little cumbersome. I should have made a generic Bot class and then derived the cop and robber from that. I ended up copying too much code back and forth.
I'm sorry to say that there is only one barely informative comment. The only other comments are code that has been commented out.
One of the things I learned last night on IRC was that I can optimize some of my match statements. The parser (parser.ml) has lines like this in its match:
| "nod:" :: name :: tag :: x :: y :: [] -> handle_node name (node_tag_of_string tag)
(int_of_string x) (int_of_string y)
Apparently, I can make this a little shorter with:
| ["nod:";name;tag;x;y] -> handle_node name (node_tag_of_string tag)
(int_of_string x) (int_of_string y)
Although I am happy with my choice of Ocaml for doing this project, I am not happy with my usage of Ocaml. I didn't use the "O" part of it at all - no objects. I did things as modules and it was a little cumbersome. I should have made a generic Bot class and then derived the cop and robber from that. I ended up copying too much code back and forth.